Skip to content

Commit

Permalink
Merge pull request #1279 from SyneRBI/no-gpu-no-cuda-tests
Browse files Browse the repository at this point in the history
do not run CUDA tests if GPU not available
  • Loading branch information
KrisThielemans authored Jul 10, 2024
2 parents cb8a998 + bf440d4 commit a4d8cae
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/xSTIR/pSTIR/tests/tests_qp_lc_rdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@
import sirf.config
from sirf.Utilities import runner, RE_PYEXT, __license__, examples_data_path, pTest
__version__ = "2.1.0"
__author__ = "Imraj Singh, Evgueni Ovtchinnikov, Kris Thielemans"
__author__ = "Imraj Singh, Evgueni Ovtchinnikov, Kris Thielemans, Edoardo Pasca"

try:
subprocess.check_output('nvidia-smi')
has_nvidia = True
except:
has_nvidia = False


def Hessian_test(test, prior, x, eps=1e-3):
Expand Down Expand Up @@ -61,7 +67,7 @@ def test_main(rec=False, verb=False, throw=True):
for penalisation_factor in [0,1,4]:
for kappa in [True, False]:
priors = [sirf.STIR.QuadraticPrior(), sirf.STIR.LogcoshPrior(), sirf.STIR.RelativeDifferencePrior()]
if sirf.config.STIR_WITH_CUDA:
if sirf.config.STIR_WITH_CUDA and has_nvidia:
priors.append(sirf.STIR.CudaRelativeDifferencePrior())
for prior in priors:
if kappa:
Expand Down

0 comments on commit a4d8cae

Please sign in to comment.