diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ee108a9f..0fdb52b22 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,6 +205,12 @@ if(NOT DISABLE_STIR_CUDA) message(STATUS "STIR CUDA support enabled. Using CUDA version ${CUDAToolkit_VERSION}.") set(STIR_WITH_CUDA ON) endif() + # check if run-time is available for ctests + find_program(NVIDIA_SMI nvidia-smi) + if (NOT NVIDIA_SMI) + message(WARNING "nvidia-smi not found. Disabling the ctests using CUDA") + set(SKIP_CUDA_TESTS ON) + endif() else() message(WARNING "No CUDA compiler found. Setting DISABLE_STIR_CUDA to ON.") set(DISABLE_STIR_CUDA ON) diff --git a/src/recon_test/CMakeLists.txt b/src/recon_test/CMakeLists.txt index 8a5eaf169..93a0eb29e 100644 --- a/src/recon_test/CMakeLists.txt +++ b/src/recon_test/CMakeLists.txt @@ -24,7 +24,6 @@ set(${dir_SIMPLE_TEST_EXE_SOURCES} test_DataSymmetriesForBins_PET_CartesianGrid.cxx test_FBP2D.cxx test_FBP3DRP.cxx - test_priors.cxx test_blocks_on_cylindrical_projectors.cxx test_geometry_blocks_on_cylindrical.cxx ) @@ -37,6 +36,7 @@ set(${dir_INVOLVED_TEST_EXE_SOURCES} test_data_processor_projectors.cxx test_OSMAPOSL.cxx test_PoissonLogLikelihoodWithLinearModelForMeanAndListModeWithProjMatrixByBin.cxx + test_priors.cxx ) if (DOWNLOAD_ZENODO_TEST_DATA) @@ -149,3 +149,8 @@ if (parallelproj_FOUND) ADD_TEST(test_OSMAPOSL_parallelproj test_OSMAPOSL ${CMAKE_SOURCE_DIR}/examples/samples/projector_pair_parallelproj.par) endif() +if (SKIP_CUDA_TESTS) + set (CUDA_TEST_ARG "--skip-cuda") +endif() + +ADD_TEST(test_priors test_priors ${CUDA_TEST_ARG}) diff --git a/src/recon_test/test_priors.cxx b/src/recon_test/test_priors.cxx index 0f7cbd2b3..eb5e6249a 100644 --- a/src/recon_test/test_priors.cxx +++ b/src/recon_test/test_priors.cxx @@ -16,7 +16,7 @@ \par Usage
-  test_priors [ density_filename ]
+  test_priors [--skip-cuda] [ density_filename ]
   
where the argument is optional. See the class documentation for more info.