aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-05-13 15:41:54 +0200
committerThomas White <taw@physics.org>2019-05-13 15:41:54 +0200
commit8aff8c658925f0c7522555ff5907632bcafe4554 (patch)
tree5d9ec01501d87894537145972dffc7c1e0c1ee9c /tests
parent6121e26bd0282dadcb0090611cb26aceaac1ed30 (diff)
gpu_sim_check: Succeed if GPU not available
On recent OSes, OpenCL (the API) is always available, but a GPU device not always. Therefore, this test will always be built, and shouldn't fail just because a GPU isn't present.
Diffstat (limited to 'tests')
-rw-r--r--tests/gpu_sim_check.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/gpu_sim_check.c b/tests/gpu_sim_check.c
index aee7a068..e42bc68b 100644
--- a/tests/gpu_sim_check.c
+++ b/tests/gpu_sim_check.c
@@ -3,11 +3,11 @@
*
* Check that GPU simulation agrees with CPU version
*
- * Copyright © 2012-2015 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2019 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
*
* Authors:
- * 2012-2015 Thomas White <taw@physics.org>
+ * 2012-2019 Thomas White <taw@physics.org>
*
* This file is part of CrystFEL.
*
@@ -42,6 +42,7 @@
#include "../src/diffraction.h"
#include "../src/diffraction-gpu.h"
+#include "../src/cl-utils.h"
#include <detector.h>
#include <utils.h>
#include <symmetry.h>
@@ -90,6 +91,11 @@ int main(int argc, char *argv[])
SymOpList *sym;
gsl_rng *rng;
+ if ( have_gpu_device() == 0 ) {
+ ERROR("No GPU device found - skipping test.\n");
+ return 0;
+ }
+
rng = gsl_rng_alloc(gsl_rng_mt19937);
gctx = setup_gpu(1, NULL, NULL, NULL, 0);