diff --git a/Jenkinsfile b/Jenkinsfile index 40ac2ccb7ab..1106a805fb7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -287,8 +287,7 @@ pipeline { unstash 'MathSetup' if (!(params.optimizeUnitTests || isBranch('develop') || isBranch('master'))) { sh "echo O=1 >> make/local" - } - sh''' + } sh''' CXX=${CLANG_CXX} CC=${CLANG_CC} cmake -S . -B \"build\" -DCMAKE_BUILD_TYPE=RELEASE -DSTAN_OPENCL=ON -DSTAN_OPENCL_PLATFORM_ID=${OPENCL_PLATFORM_ID_GPU} -DSTAN_OPENCL_DEVICE_ID=${OPENCL_DEVICE_ID_GPU} && \ cd build && make -j${PARALLEL} test_unit_math_opencl_tests && ctest --output-on-failure --label-regex unit_math_opencl ''' diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a777d9860fa..54806240344 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -98,7 +98,7 @@ function(add_gtest_grouped_test test_directory folder_test_name target_pch) string(REPLACE ".cpp" "" SUB_TEST_TARGET_NAME ${TMP_TEST_TARGET_NAME}) list(APPEND ALL_SUB_TEST_TARGETS ${SUB_TEST_TARGET_NAME}) add_executable(${SUB_TEST_TARGET_NAME} ${cpp_file}) - target_compile_options(${SUB_TEST_TARGET_NAME} PUBLIC -Wno-misleading-indentation) + target_compile_options(${SUB_TEST_TARGET_NAME} PUBLIC -O1 -Wno-misleading-indentation) target_include_directories(${SUB_TEST_TARGET_NAME} PRIVATE ${CMAKE_SOURCE_DIR}) target_precompile_headers(${SUB_TEST_TARGET_NAME} REUSE_FROM ${target_pch}) target_link_libraries(${SUB_TEST_TARGET_NAME} diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index ec86fc13eb9..28c5a77402f 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -14,6 +14,14 @@ target_precompile_headers(unit_pch PRIVATE "$<$:>" "$<$:>" ) +target_compile_options(unit_pch PUBLIC -O1 -Wno-misleading-indentation) +if (STAN_OPENCL) +target_link_libraries(unit_pch OpenCL::OpenCL) +target_include_directories(unit_pch PRIVATE ${CLCPP_SOURCE_DIR}/include) +endif() +if (STAN_MPI) +target_link_libraries(unit_pch Boost::mpi MPI::MPI_CXX) +endif() target_link_libraries(unit_pch gtest_main benchmark::benchmark TBB::tbb