Skip to content

Commit

Permalink
Handle platforms with no devices correctly
Browse files Browse the repository at this point in the history
Some tests were not correctly handling the case where an OpenCL platform
had no devices, and instead assumed there was always at least one.

Signed-off-by: Rodrigo Tobar <[email protected]>
  • Loading branch information
rtobar committed Jul 10, 2024
1 parent e08bed4 commit 5f89d3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/profit/tests/test_convolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ class TestConvolver : public CxxTest::TestSuite {
if (has_fftw()) {
_test_psf_bigger_than_image(ConvolverType::FFT);
}
if (has_opencl() && !get_opencl_info().empty()) {
auto opencl_info = get_opencl_info();
if (!opencl_info.empty() && !opencl_info[0].dev_info.empty()) {
ConvolverCreationPreferences prefs;
prefs.opencl_env = get_opencl_environment(0, 0, false, false);
_test_psf_bigger_than_image(ConvolverType::OPENCL, prefs);
Expand Down
3 changes: 2 additions & 1 deletion src/profit/tests/test_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@ class TestFluxCapturing : public CxxTest::TestSuite {
if (has_fftw()) {
convolvers.emplace_back(create_convolver(ConvolverType::FFT));
}
if (has_opencl() && !get_opencl_info().empty()) {
auto opencl_info = get_opencl_info();
if (!opencl_info.empty() && !opencl_info[0].dev_info.empty()) {
ConvolverCreationPreferences prefs;
prefs.opencl_env = get_opencl_environment(0, 0, false, false);
convolvers.emplace_back(create_convolver(ConvolverType::OPENCL, prefs));
Expand Down

0 comments on commit 5f89d3e

Please sign in to comment.