aboutsummaryrefslogtreecommitdiff
path: root/tests/gpu_sim_check.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-01-17 16:52:57 +0100
committerThomas White <taw@physics.org>2014-01-20 17:20:14 +0100
commit90ee3c269580104f2d16d28aeaa565063f6fc1f2 (patch)
treebd3c69f932648dc6fb01e4cce69bd27fb4831be2 /tests/gpu_sim_check.c
parent8e2f2f44f46c18f7bd621a2ef9a3d0aa813d76d9 (diff)
RNG overhaul
Previously, we were using random(), which is really really bad.
Diffstat (limited to 'tests/gpu_sim_check.c')
-rw-r--r--tests/gpu_sim_check.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/gpu_sim_check.c b/tests/gpu_sim_check.c
index c183a2a2..d2475213 100644
--- a/tests/gpu_sim_check.c
+++ b/tests/gpu_sim_check.c
@@ -3,7 +3,11 @@
*
* Check that GPU simulation agrees with CPU version
*
- * Copyright © 2012 Thomas White <taw@physics.org>
+ * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Authors:
+ * 2012-2014 Thomas White <taw@physics.org>
*
* This file is part of CrystFEL.
*
@@ -80,6 +84,9 @@ int main(int argc, char *argv[])
double start, end;
double gpu_time, cpu_time;
SymOpList *sym;
+ gsl_rng *rng;
+
+ rng = gsl_rng_alloc(gsl_rng_mt19937);
gctx = setup_gpu(1, NULL, NULL, NULL, 0);
if ( gctx == NULL ) {
@@ -90,7 +97,7 @@ int main(int argc, char *argv[])
cell_raw = cell_new_from_parameters(28.1e-9, 28.1e-9, 16.5e-9,
deg2rad(90.0), deg2rad(90.0), deg2rad(120.0));
- cell = cell_rotate(cell_raw, random_quaternion());
+ cell = cell_rotate(cell_raw, random_quaternion(rng));
gpu_image.width = 1024;
gpu_image.height = 1024;
@@ -217,5 +224,7 @@ int main(int argc, char *argv[])
}
+ gsl_rng_free(rng);
+
return 0;
}