diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a91735539..f592c7b2a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,7 +61,7 @@ jobs: -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -G Ninja -D USE_SEQ=ON -D USE_MPI=ON -D USE_OMP=ON -D USE_TBB=ON -D USE_STL=ON -D USE_FUNC_TESTS=ON -D USE_PERF_TESTS=ON - -D CMAKE_BUILD_TYPE=RELEASE + -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=install env: CC: gcc-14 CXX: g++-14 @@ -76,6 +76,41 @@ jobs: env: CC: gcc-14 CXX: g++-14 + - name: Install project + run: | + cmake --build build --target install + - name: Archive installed package + run: | + tar -czvf ubuntu-gcc-install.tar.gz -C install . + - name: Upload installed package + uses: actions/upload-artifact@v4 + with: + name: ubuntu-gcc-install + path: ubuntu-gcc-install.tar.gz + ubuntu-gcc-test: + needs: + - ubuntu-gcc-build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup environment + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install gcc-14 g++-14 + sudo apt-get install ninja-build + sudo apt-get install mpich + sudo apt-get install libomp-dev + sudo apt-get install valgrind + python3 -m pip install -r requirements.txt + - name: Download installed package + uses: actions/download-artifact@v4 + with: + name: ubuntu-gcc-install + - name: Extract installed package + run: | + mkdir -p install + tar -xzvf ubuntu-gcc-install.tar.gz -C install - name: Run func tests (MPI, num_proc=1) run: | source scripts/run_mpi.sh @@ -116,14 +151,12 @@ jobs: run: source scripts/run_threads.sh env: OMP_NUM_THREADS: 4 - ubuntu-gcc-build-extended: + ubuntu-gcc-test-extended: needs: - - ubuntu-gcc-build + - ubuntu-gcc-test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - submodules: recursive - name: Setup environment run: | sudo add-apt-repository ppa:ubuntu-toolchain-r/test @@ -134,28 +167,14 @@ jobs: sudo apt-get install libomp-dev sudo apt-get install valgrind python3 -m pip install -r requirements.txt - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 + - name: Download installed package + uses: actions/download-artifact@v4 with: - key: ${{ github.job }} - create-symlink: true - max-size: 1G - - name: CMake configure - run: > - cmake -S . -B build - -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache - -G Ninja -D USE_SEQ=ON -D USE_MPI=ON -D USE_OMP=ON -D USE_TBB=ON -D USE_STL=ON - -D USE_FUNC_TESTS=ON -D USE_PERF_TESTS=ON - -D CMAKE_BUILD_TYPE=RELEASE - env: - CC: gcc-14 - CXX: g++-14 - - name: Build project + name: ubuntu-gcc-install + - name: Extract installed package run: | - cmake --build build --parallel - env: - CC: gcc-14 - CXX: g++-14 + mkdir -p install + tar -xzvf ubuntu-gcc-install.tar.gz -C install - name: Run func tests (threads, num_threads=5) run: source scripts/run_threads.sh env: @@ -899,7 +918,7 @@ jobs: CLANG_BUILD: 1 ubuntu-gcc-build-codecov: needs: - - ubuntu-gcc-build-extended + - ubuntu-gcc-test-extended - ubuntu-clang-build-extended - macos-clang-build-extended runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 6e473f43e..d8b266179 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ sln/ CMakeSettings.json .DS_Store .cache +install diff --git a/cmake/onetbb.cmake b/cmake/onetbb.cmake index f565aed09..625bee1d3 100644 --- a/cmake/onetbb.cmake +++ b/cmake/onetbb.cmake @@ -28,4 +28,6 @@ if( USE_TBB ) BUILD_COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/build" --config ${CMAKE_BUILD_TYPE} --parallel INSTALL_COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/build" --prefix "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/install") endif() + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/install/" + DESTINATION "${CMAKE_INSTALL_PREFIX}") endif( USE_TBB ) diff --git a/cmake/opencv.cmake b/cmake/opencv.cmake index 90d2ec1c2..6904e4925 100644 --- a/cmake/opencv.cmake +++ b/cmake/opencv.cmake @@ -28,3 +28,5 @@ else() BUILD_COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_CURRENT_BINARY_DIR}/ppc_opencv/build" --config ${CMAKE_BUILD_TYPE} --parallel INSTALL_COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_CURRENT_BINARY_DIR}/ppc_opencv/build" --prefix "${CMAKE_CURRENT_BINARY_DIR}/ppc_opencv/install") endif() +install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ppc_opencv/install/" + DESTINATION "${CMAKE_INSTALL_PREFIX}") diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt index 19c6b92e3..0237aab38 100644 --- a/modules/core/CMakeLists.txt +++ b/modules/core/CMakeLists.txt @@ -32,3 +32,12 @@ target_link_libraries(${exec_func_tests} PUBLIC ${exec_func_lib}) enable_testing() add_test(NAME ${exec_func_tests} COMMAND ${exec_func_tests}) + +# Installation rules +install(TARGETS ${exec_func_lib} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) + +install(TARGETS ${exec_func_tests} + RUNTIME DESTINATION bin) diff --git a/modules/ref/CMakeLists.txt b/modules/ref/CMakeLists.txt index 4b10cc49a..3887641b1 100644 --- a/modules/ref/CMakeLists.txt +++ b/modules/ref/CMakeLists.txt @@ -42,3 +42,12 @@ target_link_libraries(${exec_func_tests} PUBLIC ${exec_func_lib}) enable_testing() add_test(NAME ${exec_func_tests} COMMAND ${exec_func_tests}) + +# Installation rules +install(TARGETS ${exec_func_lib} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) + +install(TARGETS ${exec_func_tests} + RUNTIME DESTINATION bin) diff --git a/scripts/run_mpi.sh b/scripts/run_mpi.sh index 92d2835a9..bbc0cb667 100644 --- a/scripts/run_mpi.sh +++ b/scripts/run_mpi.sh @@ -1,18 +1,24 @@ #!/bin/bash -source build/ppc_opencv/install/bin/setup_vars_opencv4.sh +if [[ -f build/ppc_opencv/install/bin/setup_vars_opencv4.sh ]]; then + INSTALL_BIN_DIR="build/bin" + source build/ppc_opencv/install/bin/setup_vars_opencv4.sh +else + INSTALL_BIN_DIR="install/bin" + source $INSTALL_BIN_DIR/setup_vars_opencv4.sh +fi if [[ $OSTYPE == "linux-gnu" && -z "$ASAN_RUN" ]]; then - valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/core_func_tests - valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/ref_func_tests + valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/core_func_tests + valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/ref_func_tests -# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/all_func_tests -# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/mpi_func_tests +# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/all_func_tests +# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/mpi_func_tests fi -./build/bin/core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating -./build/bin/ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating +$INSTALL_BIN_DIR/core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating +$INSTALL_BIN_DIR/ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating if [[ -z "$ASAN_RUN" ]]; then - mpirun $1 -np $PROC_COUNT ./build/bin/all_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating - mpirun $1 -np $PROC_COUNT ./build/bin/mpi_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating + mpirun $1 -np $PROC_COUNT $INSTALL_BIN_DIR/all_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating + mpirun $1 -np $PROC_COUNT $INSTALL_BIN_DIR/mpi_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating fi diff --git a/scripts/run_threads.sh b/scripts/run_threads.sh index 731276bc8..6b2d13575 100644 --- a/scripts/run_threads.sh +++ b/scripts/run_threads.sh @@ -1,20 +1,26 @@ #!/bin/bash -source build/ppc_opencv/install/bin/setup_vars_opencv4.sh +if [[ -f build/ppc_opencv/install/bin/setup_vars_opencv4.sh ]]; then + INSTALL_BIN_DIR="build/bin" + source build/ppc_opencv/install/bin/setup_vars_opencv4.sh +else + INSTALL_BIN_DIR="install/bin" + source $INSTALL_BIN_DIR/setup_vars_opencv4.sh +fi if [[ $OSTYPE == "linux-gnu" && -z "$ASAN_RUN" ]]; then - valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/core_func_tests - valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/ref_func_tests + valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/core_func_tests + valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/ref_func_tests -# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/omp_func_tests - valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/seq_func_tests - valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/stl_func_tests -# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/tbb_func_tests +# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/omp_func_tests + valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/seq_func_tests + valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/stl_func_tests +# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/tbb_func_tests fi -./build/bin/core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating -./build/bin/ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating +$INSTALL_BIN_DIR/core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating +$INSTALL_BIN_DIR/ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating -./build/bin/omp_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating -./build/bin/seq_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating -./build/bin/stl_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating -./build/bin/tbb_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating +$INSTALL_BIN_DIR/omp_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating +$INSTALL_BIN_DIR/seq_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating +$INSTALL_BIN_DIR/stl_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating +$INSTALL_BIN_DIR/tbb_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating diff --git a/tasks/CMakeLists.txt b/tasks/CMakeLists.txt index 2b49fc830..b539bbf72 100644 --- a/tasks/CMakeLists.txt +++ b/tasks/CMakeLists.txt @@ -169,8 +169,14 @@ foreach(TASK_TYPE ${LIST_OF_TASKS}) target_link_libraries(${EXEC_FUNC} PUBLIC gtest gtest_main) enable_testing() add_test(NAME ${EXEC_FUNC} COMMAND ${EXEC_FUNC}) + + # Install the executable + install(TARGETS ${EXEC_FUNC} RUNTIME DESTINATION bin) endforeach () + # Install the library + install(TARGETS ${exec_func_lib} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) + set(LIST_OF_EXEC_TESTS "") set(LIB_SOURCE_FILES "") set(SRC_RES "")