From 23ba669b6c3aae05eda5e777a90bf97196061c08 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 17:09:22 +0000 Subject: [PATCH 01/14] [CMake] use NiftyPET 2 --- CMakeLists.txt | 4 +- src/cmake/FindNiftyPET.cmake | 82 ----------------------------- src/recon_buildblock/CMakeLists.txt | 5 +- 3 files changed, 3 insertions(+), 88 deletions(-) delete mode 100644 src/cmake/FindNiftyPET.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 2873ad6dc..7aff09083 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,8 +183,8 @@ endif() if(NOT DISABLE_NiftyPET_PROJECTOR) if (CUDAToolkit_FOUND) - find_package(NiftyPET) - if (NiftyPET_FOUND) + find_package(NiftyPETnipet COMPONENTS mmr_auxe mmr_lmproc petprj REQUIRED) + if (NiftyPETnipet_FOUND) set(STIR_WITH_NiftyPET_PROJECTOR ON) endif() endif() diff --git a/src/cmake/FindNiftyPET.cmake b/src/cmake/FindNiftyPET.cmake deleted file mode 100644 index 59c0f8c54..000000000 --- a/src/cmake/FindNiftyPET.cmake +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 2019-2020 University College London -# @Author Richard Brown -# -# This file is part of STIR. -# -# SPDX-License-Identifier: Apache-2.0 -# -# See STIR/LICENSE.txt for details - -include(FindPackageHandleStandardArgs) - -set(package NiftyPET) - -if (NOT ${package}_PATH) - set(${package}_PATH "" CACHE PATH "Path to ${package} installation") -endif() - -############################################################### -# Headers -############################################################### - -# Find the base folder containing def.h -find_path(${package}_INCLUDE_DIR "niftypet/nipet/def.h" - PATHS ${${package}_PATH} - PATH_SUFFIXES include - ) -mark_as_advanced(${package}_INCLUDE_DIR) - -############################################################### -# Libraries -############################################################### - -set(${package}_required_libraries - petprj - mmr_auxe - mmr_lmproc - ) -set(${package}_libraries "") - -foreach(l ${${package}_required_libraries}) - find_library(${package}_${l} - NAMES ${l}${CMAKE_SHARED_LIBRARY_SUFFIX} ${l}${CMAKE_STATIC_LIBRARY_SUFFIX} - PATHS ${${package}_PATH} - ) - mark_as_advanced(${package}_${l}) - list(APPEND ${package}_libraries ${package}_${l}) -endforeach() - -############################################################### -# Check everything has been found -############################################################### - -find_package_handle_standard_args(${package} - FOUND_VAR ${package}_FOUND - REQUIRED_VARS - ${${package}_libraries} ${package}_INCLUDE_DIR -) - -############################################################### -# Get header subdirectories -############################################################### - -SET(${package}_INCLUDE_DIRS - "${${package}_INCLUDE_DIR}/niftypet/nipet" - "${${package}_INCLUDE_DIR}/niftypet/nipet/dinf" - "${${package}_INCLUDE_DIR}/niftypet/nipet/lm/src" - "${${package}_INCLUDE_DIR}/niftypet/nipet/prj/src" - "${${package}_INCLUDE_DIR}/niftypet/nipet/sct/src" - "${${package}_INCLUDE_DIR}/niftypet/nipet/src" -) - -############################################################### -# Create imported targets -############################################################### - -foreach(l ${${package}_required_libraries}) - add_library(${package}::${l} UNKNOWN IMPORTED) - set_target_properties(${package}::${l} PROPERTIES - IMPORTED_LOCATION "${${package}_${l}}" - INTERFACE_INCLUDE_DIRECTORIES "${${package}_INCLUDE_DIRS}" - ) -endforeach() diff --git a/src/recon_buildblock/CMakeLists.txt b/src/recon_buildblock/CMakeLists.txt index 89d3c5e27..a7b9968f6 100644 --- a/src/recon_buildblock/CMakeLists.txt +++ b/src/recon_buildblock/CMakeLists.txt @@ -143,10 +143,7 @@ endif() target_link_libraries(recon_buildblock PUBLIC modelling_buildblock display numerics_buildblock listmode_buildblock data_buildblock buildblock spatial_transformation_buildblock ) if (STIR_WITH_NiftyPET_PROJECTOR) - target_link_libraries(recon_buildblock PUBLIC NiftyPET::petprj) - target_link_libraries(recon_buildblock PUBLIC NiftyPET::mmr_auxe) - target_link_libraries(recon_buildblock PUBLIC NiftyPET::mmr_lmproc) - target_link_libraries(recon_buildblock PUBLIC CUDA::cudart) + target_link_libraries(recon_buildblock PRIVATE NiftyPET::mmr_auxe NiftyPET::mmr_lmproc NiftyPET::petprj) endif() if (STIR_WITH_Parallelproj_PROJECTOR) From 1c3cba5eb438a6a1aee026b2882252ab684349aa Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 18:35:05 +0000 Subject: [PATCH 02/14] [GHA] added CUDA and NiftyPET --- .github/workflows/build-test.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 2f5a18405..a83cf4d85 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -37,6 +37,7 @@ jobs: - os: ubuntu-latest compiler: gcc compiler_version: 9 + CUDA: "OFF" BUILD_FLAGS: "-DSTIR_OPENMP=ON" BUILD_TYPE: "Release" parallelproj: "ON" @@ -45,6 +46,7 @@ jobs: - os: ubuntu-latest compiler: clang #compiler_version: + CUDA: "OFF" BUILD_FLAGS: "-DSTIR_OPENMP=ON" BUILD_TYPE: "Release" parallelproj: "ON" @@ -54,6 +56,7 @@ jobs: - os: ubuntu-latest compiler: gcc compiler_version: 10 + CUDA: "OFF" BUILD_FLAGS: "-DSTIR_OPENMP=ON -DCMAKE_CXX_STANDARD=17" BUILD_TYPE: "Debug" parallelproj: "OFF" @@ -62,14 +65,25 @@ jobs: - os: ubuntu-latest compiler: gcc compiler_version: 12 + CUDA: "OFF" BUILD_FLAGS: "-DSTIR_OPENMP=ON -DCMAKE_CXX_STANDARD=14" BUILD_TYPE: "RelWithDebInfo" parallelproj: "ON" ROOT: "OFF" ITK: "ON" + - os: ubuntu-latest + compiler: gcc + compiler_version: 12 + CUDA: "ON" + BUILD_FLAGS: "-DSTIR_OPENMP=ON -DCMAKE_CXX_STANDARD=14" + BUILD_TYPE: "Release" + parallelproj: "ON" + ROOT: "OFF" + ITK: "ON" - os: macOS-latest compiler: gcc compiler_version: 11 + CUDA: "OFF" BUILD_FLAGS: "-DSTIR_OPENMP=OFF" parallelproj: "OFF" BUILD_TYPE: "Debug" @@ -152,6 +166,12 @@ jobs: echo CC="$CC" >> $GITHUB_ENV echo CXX="$CXX" >> $GITHUB_ENV + - if: ${{ matrix.CUDA }} == "ON" + uses: Jimver/cuda-toolkit@v0.2.11 + id: cuda-toolkit + with: + cuda: '12.1.0' + - name: install_dependencies shell: bash run: | @@ -216,6 +236,12 @@ jobs: cmake --build . --target install --config Release cd ../.. fi + # Install NiftyPET + if test "${{matrix.CUDA}}XX" == "ONXX"; then + export PATHTOOLS=${GITHUB_WORKSPACE}/NiftyPET_tools + export HMUDIR=${GITHUB_WORKSPACE}/mmr_hardwareumaps + python -m pip install "nipet>=2" + fi # Install ROOT (warning: currently only valid on Ubuntu) if test "${{matrix.ROOT}}XX" == "ONXX"; then From 3bcc1e7a2012a4dac658310d2900ce0bcf62d34f Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 21:20:20 +0000 Subject: [PATCH 03/14] [GHA] fix/improve CUDA and NiftyPET - use CUDA version - let CMake find NiftyPET --- .github/workflows/build-test.yml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index a83cf4d85..14d102b40 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -37,7 +37,7 @@ jobs: - os: ubuntu-latest compiler: gcc compiler_version: 9 - CUDA: "OFF" + cuda_version: "0" BUILD_FLAGS: "-DSTIR_OPENMP=ON" BUILD_TYPE: "Release" parallelproj: "ON" @@ -46,7 +46,7 @@ jobs: - os: ubuntu-latest compiler: clang #compiler_version: - CUDA: "OFF" + cuda_version: "0" BUILD_FLAGS: "-DSTIR_OPENMP=ON" BUILD_TYPE: "Release" parallelproj: "ON" @@ -56,7 +56,7 @@ jobs: - os: ubuntu-latest compiler: gcc compiler_version: 10 - CUDA: "OFF" + cuda_version: "0" BUILD_FLAGS: "-DSTIR_OPENMP=ON -DCMAKE_CXX_STANDARD=17" BUILD_TYPE: "Debug" parallelproj: "OFF" @@ -65,7 +65,7 @@ jobs: - os: ubuntu-latest compiler: gcc compiler_version: 12 - CUDA: "OFF" + cuda_version: "0" BUILD_FLAGS: "-DSTIR_OPENMP=ON -DCMAKE_CXX_STANDARD=14" BUILD_TYPE: "RelWithDebInfo" parallelproj: "ON" @@ -74,7 +74,7 @@ jobs: - os: ubuntu-latest compiler: gcc compiler_version: 12 - CUDA: "ON" + cuda_version: "12.1.0" BUILD_FLAGS: "-DSTIR_OPENMP=ON -DCMAKE_CXX_STANDARD=14" BUILD_TYPE: "Release" parallelproj: "ON" @@ -83,7 +83,7 @@ jobs: - os: macOS-latest compiler: gcc compiler_version: 11 - CUDA: "OFF" + cuda_version: "0" BUILD_FLAGS: "-DSTIR_OPENMP=OFF" parallelproj: "OFF" BUILD_TYPE: "Debug" @@ -102,7 +102,7 @@ jobs: # let's run all of them, as opposed to aborting when one fails fail-fast: false - name: ${{ matrix.os }}-${{ matrix.compiler }}${{ matrix.compiler_version }}-${{ matrix.BUILD_TYPE }}-pp=${{ matrix.parallelproj }}-ROOT=${{ matrix.ROOT }} + name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.compiler_version }}-cuda${{ matrix.cuda_version }}-${{ matrix.BUILD_TYPE }}-pp=${{ matrix.parallelproj }}-ROOT=${{ matrix.ROOT }} steps: - name: disk space @@ -166,11 +166,12 @@ jobs: echo CC="$CC" >> $GITHUB_ENV echo CXX="$CXX" >> $GITHUB_ENV - - if: ${{ matrix.CUDA }} == "ON" + - if: ${{ ! matrix.cuda_version == '0' }} uses: Jimver/cuda-toolkit@v0.2.11 id: cuda-toolkit with: - cuda: '12.1.0' + cuda: ${{ matrix.cuda_version }} + linux-local-args: '["--toolkit"]' - name: install_dependencies shell: bash @@ -232,15 +233,20 @@ jobs: git clone --depth 1 --branch v1.3.7 https://github.com/gschramm/parallelproj mkdir parallelproj/build cd parallelproj/build - cmake .. -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DSKIP_CUDA_LIB:BOOL=ON + if test "${{matrix.cuda_version}}" == "0"; then + extra_args="-DSKIP_CUDA_LIB:BOOL=ON" + fi + cmake .. -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${extra_args} cmake --build . --target install --config Release cd ../.. fi # Install NiftyPET - if test "${{matrix.CUDA}}XX" == "ONXX"; then + if test ! "${{matrix.cuda_version}}" == "0"; then export PATHTOOLS=${GITHUB_WORKSPACE}/NiftyPET_tools export HMUDIR=${GITHUB_WORKSPACE}/mmr_hardwareumaps python -m pip install "nipet>=2" + niftypet_cmake_prefix=$(python -c "from niftypet.nipet import cmake_prefix; print(cmake_prefix)") + echo NiftyPET_PREFIX="$niftypet_cmake_prefix" >> $GITHUB_ENV fi # Install ROOT (warning: currently only valid on Ubuntu) @@ -269,7 +275,7 @@ jobs: - name: ccache uses: hendrikmuhs/ccache-action@v1 with: - key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.compiler_version }}-${{ matrix.BUILD_TYPE }} + key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.compiler_version }}-cuda${{ matrix.cuda_version }}-${{ matrix.BUILD_TYPE }} max-size: "2G" - name: configure @@ -291,6 +297,7 @@ jobs: echo CMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" >> $GITHUB_ENV EXTRA_BUILD_FLAGS="-DBUILD_SWIG_PYTHON=ON -DPYTHON_EXECUTABLE=`which python`" EXTRA_BUILD_FLAGS="${EXTRA_BUILD_FLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${BUILD_TYPE}" + EXTRA_BUILD_FLAGS="${EXTRA_BUILD_FLAGS} -DCMAKE_PREFIX_DIR=${NiftyPET_PREFIX}" EXTRA_BUILD_FLAGS="${EXTRA_BUILD_FLAGS} -DDOWNLOAD_ZENODO_TEST_DATA=ON" EXTRA_BUILD_FLAGS="${EXTRA_BUILD_FLAGS} -DDISABLE_STIR_LOCAL=OFF -DSTIR_LOCAL=${GITHUB_WORKSPACE}/examples/C++/src" echo "cmake flags $BUILD_FLAGS $EXTRA_BUILD_FLAGS" From b32fc7421a0f4398b2320a1a62562a3271fc5c53 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 22:02:33 +0000 Subject: [PATCH 04/14] try to fix CUDA - change step condition - see where NiftyPET*cmake is - exclude CUDA tests from ctest --- .github/workflows/build-test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 14d102b40..70cd00382 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -166,7 +166,7 @@ jobs: echo CC="$CC" >> $GITHUB_ENV echo CXX="$CXX" >> $GITHUB_ENV - - if: ${{ ! matrix.cuda_version == '0' }} + - if: matrix.cuda_version != '0' uses: Jimver/cuda-toolkit@v0.2.11 id: cuda-toolkit with: @@ -246,6 +246,7 @@ jobs: export HMUDIR=${GITHUB_WORKSPACE}/mmr_hardwareumaps python -m pip install "nipet>=2" niftypet_cmake_prefix=$(python -c "from niftypet.nipet import cmake_prefix; print(cmake_prefix)") + ls -R "$niftypet_cmake_prefix" echo NiftyPET_PREFIX="$niftypet_cmake_prefix" >> $GITHUB_ENV fi @@ -333,6 +334,10 @@ jobs: if test ${BUILD_TYPE} = Debug; then EXCLUDE="-E test_data_processor_projectors|test_export_array|test_ArcCorrection|test_blocks_on_cylindrical_projectors" fi + if test ${{matrix.cuda_version}} != "0" + # No CUDA drivers on GitHub Actions + EXCLUDE="${EXCLUDE}|parallelproj|NiftyPET|test_blocks_on_cylindrical_projectors" + fi ctest --output-on-failure -C ${BUILD_TYPE} ${EXCLUDE} - name: recon_test_pack From 2c508baa1aa0f5a2524360fc97ab4d0ce16293b3 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 22:42:06 +0000 Subject: [PATCH 05/14] fix niftypet - use NiftyPETnipet_DIR - fix condition in ctest --- .github/workflows/build-test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 70cd00382..70498c7ef 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -246,8 +246,7 @@ jobs: export HMUDIR=${GITHUB_WORKSPACE}/mmr_hardwareumaps python -m pip install "nipet>=2" niftypet_cmake_prefix=$(python -c "from niftypet.nipet import cmake_prefix; print(cmake_prefix)") - ls -R "$niftypet_cmake_prefix" - echo NiftyPET_PREFIX="$niftypet_cmake_prefix" >> $GITHUB_ENV + echo NiftyPET_DIR="$niftypet_cmake_prefix" >> $GITHUB_ENV fi # Install ROOT (warning: currently only valid on Ubuntu) @@ -298,7 +297,7 @@ jobs: echo CMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" >> $GITHUB_ENV EXTRA_BUILD_FLAGS="-DBUILD_SWIG_PYTHON=ON -DPYTHON_EXECUTABLE=`which python`" EXTRA_BUILD_FLAGS="${EXTRA_BUILD_FLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${BUILD_TYPE}" - EXTRA_BUILD_FLAGS="${EXTRA_BUILD_FLAGS} -DCMAKE_PREFIX_DIR=${NiftyPET_PREFIX}" + EXTRA_BUILD_FLAGS="${EXTRA_BUILD_FLAGS} -DNiftyPETnipet_DIR=${NiftyPET_DIR}" EXTRA_BUILD_FLAGS="${EXTRA_BUILD_FLAGS} -DDOWNLOAD_ZENODO_TEST_DATA=ON" EXTRA_BUILD_FLAGS="${EXTRA_BUILD_FLAGS} -DDISABLE_STIR_LOCAL=OFF -DSTIR_LOCAL=${GITHUB_WORKSPACE}/examples/C++/src" echo "cmake flags $BUILD_FLAGS $EXTRA_BUILD_FLAGS" @@ -334,7 +333,7 @@ jobs: if test ${BUILD_TYPE} = Debug; then EXCLUDE="-E test_data_processor_projectors|test_export_array|test_ArcCorrection|test_blocks_on_cylindrical_projectors" fi - if test ${{matrix.cuda_version}} != "0" + if test ${{matrix.cuda_version}} != "0"; then # No CUDA drivers on GitHub Actions EXCLUDE="${EXCLUDE}|parallelproj|NiftyPET|test_blocks_on_cylindrical_projectors" fi From 1dd3f2bdd127d5473319742200bc89c709126e3b Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 22:44:43 +0000 Subject: [PATCH 06/14] [CMake] force NiftyPET CONFIG to simplify error message --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7aff09083..932837d6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,7 +183,7 @@ endif() if(NOT DISABLE_NiftyPET_PROJECTOR) if (CUDAToolkit_FOUND) - find_package(NiftyPETnipet COMPONENTS mmr_auxe mmr_lmproc petprj REQUIRED) + find_package(NiftyPETnipet REQUIRED COMPONENTS mmr_auxe mmr_lmproc petprj CONFIG) if (NiftyPETnipet_FOUND) set(STIR_WITH_NiftyPET_PROJECTOR ON) endif() From 7757b07a4232ea14d00d11b1dadf04544751cb0e Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 23:03:04 +0000 Subject: [PATCH 07/14] remove CONFIG from find_package --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 932837d6a..da790b6cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,7 +183,7 @@ endif() if(NOT DISABLE_NiftyPET_PROJECTOR) if (CUDAToolkit_FOUND) - find_package(NiftyPETnipet REQUIRED COMPONENTS mmr_auxe mmr_lmproc petprj CONFIG) + find_package(NiftyPETnipet REQUIRED COMPONENTS mmr_auxe mmr_lmproc petprj) if (NiftyPETnipet_FOUND) set(STIR_WITH_NiftyPET_PROJECTOR ON) endif() From 700a6279197a84025060dff0b84a0c31e79eaca0 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 23:26:25 +0000 Subject: [PATCH 08/14] require CMake 3.14 NiftyPET's Config.cmake needs CMake 3.3, but we announced in STIR 5.2 that we'd require 3.14 anyway. --- CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da790b6cb..567520145 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,7 @@ # See STIR/LICENSE.txt for details # cmake file for building STIR. See the STIR User's Guide and http://www.cmake.org. -if (CMAKE_HOST_WIN32) - cmake_minimum_required(VERSION 3.12.0) -else() - cmake_minimum_required(VERSION 3.1.0) -endif() +cmake_minimum_required(VERSION 3.14.0) # enable ccache https://ccache.samba.org/ find_program(CCACHE_PROGRAM ccache) From 5a3458cd06edd227f1e2b023a2cb0f1fa06db0cf Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 23:27:15 +0000 Subject: [PATCH 09/14] reinstated CONFIG for NiftyPET --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 567520145..a930f5e18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,7 +179,7 @@ endif() if(NOT DISABLE_NiftyPET_PROJECTOR) if (CUDAToolkit_FOUND) - find_package(NiftyPETnipet REQUIRED COMPONENTS mmr_auxe mmr_lmproc petprj) + find_package(NiftyPETnipet REQUIRED COMPONENTS mmr_auxe mmr_lmproc petprj CONFIG) if (NiftyPETnipet_FOUND) set(STIR_WITH_NiftyPET_PROJECTOR ON) endif() From eac8deeb18ca0ba47a290c6c21b37ffb0c319cce Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 23:39:22 +0000 Subject: [PATCH 10/14] [CMake] add explicit extensions to a few more sources --- examples/C++/src/CMakeLists.txt | 2 +- src/listmode_utilities/CMakeLists.txt | 4 ++-- src/test/NiftyPET_projector/CMakeLists.txt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/C++/src/CMakeLists.txt b/examples/C++/src/CMakeLists.txt index 3e3308501..9ef4f3fae 100644 --- a/examples/C++/src/CMakeLists.txt +++ b/examples/C++/src/CMakeLists.txt @@ -5,7 +5,7 @@ set(dir examples) set(dir_EXE_SOURCES ${dir}_EXE_SOURCES) set(${dir_EXE_SOURCES} - demo1 demo2 demo3 demo4_obj_fun demo5_line_search + demo1.cxx demo2.cxx demo3.cxx demo4_obj_fun.cxx demo5_line_search.cxx ) diff --git a/src/listmode_utilities/CMakeLists.txt b/src/listmode_utilities/CMakeLists.txt index af031bc95..d6a72b4e4 100644 --- a/src/listmode_utilities/CMakeLists.txt +++ b/src/listmode_utilities/CMakeLists.txt @@ -35,8 +35,8 @@ if (HAVE_ECAT) endif() if (STIR_WITH_NiftyPET_PROJECTOR) - list(APPEND ${dir_EXE_SOURCES} conv_NiftyPET_stir) - list(APPEND ${dir_EXE_SOURCES} lm_to_projdata_NiftyPET) + list(APPEND ${dir_EXE_SOURCES} conv_NiftyPET_stir.cxx) + list(APPEND ${dir_EXE_SOURCES} lm_to_projdata_NiftyPET.cxx) endif() diff --git a/src/test/NiftyPET_projector/CMakeLists.txt b/src/test/NiftyPET_projector/CMakeLists.txt index d5ed2caf5..e2eddbb37 100644 --- a/src/test/NiftyPET_projector/CMakeLists.txt +++ b/src/test/NiftyPET_projector/CMakeLists.txt @@ -14,10 +14,10 @@ set(dir_INVOLVED_TEST_EXE_SOURCES ${dir}_INVOLVED_TEST_EXE_SOURCES) set(dir_SIMPLE_TEST_EXE_SOURCES_NO_REGISTRIES ${dir}_SIMPLE_TEST_EXE_SOURCES_NO_REGISTRIES) set(${dir_INVOLVED_TEST_EXE_SOURCES} - test_ProjectorNiftyPET_adjoint + test_ProjectorNiftyPET_adjoint.cxx ) ADD_TEST(test_ProjectorNiftyPET_adjoint ${CMAKE_CURRENT_BINARY_DIR}/test_ProjectorNiftyPET_adjoint 3) -include(stir_test_exe_targets) \ No newline at end of file +include(stir_test_exe_targets) From 789b73a6e76091ec9ee37010935622c9aa049463 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 23:50:10 +0000 Subject: [PATCH 11/14] remove NiftyPET REQUIRED --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a930f5e18..195fe1da8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,7 +179,7 @@ endif() if(NOT DISABLE_NiftyPET_PROJECTOR) if (CUDAToolkit_FOUND) - find_package(NiftyPETnipet REQUIRED COMPONENTS mmr_auxe mmr_lmproc petprj CONFIG) + find_package(NiftyPETnipet COMPONENTS mmr_auxe mmr_lmproc petprj CONFIG) if (NiftyPETnipet_FOUND) set(STIR_WITH_NiftyPET_PROJECTOR ON) endif() From 5d1ee53d3d4b620a9c2bc9e483cc6b44baa1cc13 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 25 Nov 2023 23:58:43 +0000 Subject: [PATCH 12/14] [CMake] add NiftyPET to listmode_buildblock (if used) --- src/listmode_buildblock/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/listmode_buildblock/CMakeLists.txt b/src/listmode_buildblock/CMakeLists.txt index baed95da4..45df9b8b2 100644 --- a/src/listmode_buildblock/CMakeLists.txt +++ b/src/listmode_buildblock/CMakeLists.txt @@ -58,3 +58,7 @@ endif() include(stir_lib_target) target_link_libraries(listmode_buildblock PUBLIC data_buildblock ) + +if (STIR_WITH_NiftyPET_PROJECTOR) + target_link_libraries(listmode_buildblock PRIVATE NiftyPET::mmr_auxe NiftyPET::mmr_lmproc NiftyPET::petprj) +endif() From 71f01f633c494843e78898ab8c8d5ae395f8591e Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sun, 26 Nov 2023 00:02:37 +0000 Subject: [PATCH 13/14] debug finding of prbj.h --- .github/workflows/build-test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 70498c7ef..336fe748d 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -246,6 +246,7 @@ jobs: export HMUDIR=${GITHUB_WORKSPACE}/mmr_hardwareumaps python -m pip install "nipet>=2" niftypet_cmake_prefix=$(python -c "from niftypet.nipet import cmake_prefix; print(cmake_prefix)") + find /home/runner/work/STIR/STIR/my-env/ -name prjb.h echo NiftyPET_DIR="$niftypet_cmake_prefix" >> $GITHUB_ENV fi @@ -321,8 +322,9 @@ jobs: run: | cd ${GITHUB_WORKSPACE}/build; source ${GITHUB_WORKSPACE}/my-env/bin/activate - cmake --build . -j 2 --config ${BUILD_TYPE}} --target install - + cmake --build . -j 2 --config ${BUILD_TYPE}} --target install || true + #debug + make VERBOSE=ON - name: ctest shell: bash env: From 745d449f41e54725a7e8739578b8dd057314ee40 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Wed, 29 Nov 2023 23:19:16 +0000 Subject: [PATCH 14/14] fixed 2 updates to NiftyPET2 some members were removed from Cnts --- src/recon_buildblock/NiftyPET_projector/NiftyPETHelper.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/recon_buildblock/NiftyPET_projector/NiftyPETHelper.cxx b/src/recon_buildblock/NiftyPET_projector/NiftyPETHelper.cxx index 53b92c308..3e215c869 100644 --- a/src/recon_buildblock/NiftyPET_projector/NiftyPETHelper.cxx +++ b/src/recon_buildblock/NiftyPET_projector/NiftyPETHelper.cxx @@ -83,7 +83,7 @@ shared_ptr get_cnst(const Scanner &scanner, const bool cuda_verbose, const shared_ptr cnt_sptr = MAKE_SHARED(); cnt_sptr->DEVID = cuda_device; // device (GPU) ID. allows choosing the device on which to perform calculations - cnt_sptr->VERBOSE = cuda_verbose; + cnt_sptr->LOG = cuda_verbose; if (scanner.get_type() == Scanner::Siemens_mMR) { if (!(span==0 || span==1 || span==11)) @@ -123,8 +123,10 @@ shared_ptr get_cnst(const Scanner &scanner, const bool cuda_verbose, const cnt_sptr->MRD = mxRD; // maximum ring difference cnt_sptr->ALPHA = aLPHA; //angle subtended by a crystal +#if 0 // NiftyPET v1 or so. Now this is hardwored as R_RING in sct.h float R = 32.8f; // ring radius cnt_sptr->RE = R + 0.67f; // effective ring radius accounting for the depth of interaction +#endif cnt_sptr->AXR = SZ_RING; //axial crystal dim cnt_sptr->COSUPSMX = 0.725f; //cosine of max allowed scatter angle