Skip to content

Commit

Permalink
make running of CUDA tests optional
Browse files Browse the repository at this point in the history
CUDA run-time is not available on GitHub actions,
so we need to able to disable them.
  • Loading branch information
KrisThielemans committed Jul 7, 2024
1 parent dcd3b86 commit 3e43ca7
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions src/recon_test/test_priors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,27 @@ USING_NAMESPACE_STIR
int
main(int argc, char** argv)
{
// option processing
bool do_cuda_tests = true;
while (argc > 1 && strncmp(argv[1], "--", 2) == 0)
{
if (strcmp(argv[1], "--help") == 0)
{
std::cerr << "Usage:\n"
<< " test_priors [--skip-cuda] [image_filename]\n";
exit(EXIT_SUCCESS);
}
else if (strcmp(argv[1], "--skip-cuda") == 0)
do_cuda_tests = false;
else
{
std::cerr << "Unknown option: " << argv[1] << "\nUse --help for more information\n";
exit(EXIT_FAILURE);
}
--argc;
++argv;
}

set_default_num_threads();

bool everything_ok = true;
Expand All @@ -617,11 +638,12 @@ main(int argc, char** argv)
everything_ok = everything_ok && tests.is_everything_ok();
}
#ifdef STIR_WITH_CUDA
{
RelativeDifferencePriorTests<CudaRelativeDifferencePrior<float>> tests(argc > 1 ? argv[1] : nullptr);
tests.run_tests();
everything_ok = everything_ok && tests.is_everything_ok();
}
if (do_cuda_tests)
{
RelativeDifferencePriorTests<CudaRelativeDifferencePrior<float>> tests(argc > 1 ? argv[1] : nullptr);
tests.run_tests();
everything_ok = everything_ok && tests.is_everything_ok();
}
#endif
{
PLSPriorTests tests(argc > 1 ? argv[1] : nullptr);
Expand Down

0 comments on commit 3e43ca7

Please sign in to comment.