aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2016-07-29 17:10:29 +0200
committerThomas White <taw@physics.org>2016-07-29 17:10:29 +0200
commit2ced78d5e2929ece710f8bf4ce8719ce6d81514f (patch)
tree22d03648956d1fe1719ce7c387e7520561adc587
parent31f02efd79b8533639ee25698ee0e69e5020c768 (diff)
Panel coordinate fixes for GPU simulation
-rw-r--r--src/diffraction-gpu.c20
-rw-r--r--tests/gpu_sim_check.c14
2 files changed, 8 insertions, 26 deletions
diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c
index 1f937bf8..70f3ff58 100644
--- a/src/diffraction-gpu.c
+++ b/src/diffraction-gpu.c
@@ -191,17 +191,13 @@ static int do_panels(struct gpu_context *gctx, struct image *image,
cl_mem diff;
size_t diff_size;
float *diff_ptr;
- int pan_width, pan_height;
int fs, ss;
cl_int err;
p = &image->det->panels[i];
- pan_width = 1 + p->max_fs - p->min_fs;
- pan_height = 1 + p->max_ss - p->min_ss;
-
/* Buffer for the results of this panel */
- diff_size = pan_width * pan_height * sizeof(cl_float);
+ diff_size = p->w * p->h * sizeof(cl_float);
diff = clCreateBuffer(gctx->ctx, CL_MEM_WRITE_ONLY,
diff_size, NULL, &err);
if ( err != CL_SUCCESS ) {
@@ -211,7 +207,7 @@ static int do_panels(struct gpu_context *gctx, struct image *image,
if ( set_arg_mem(gctx, 0, diff) ) return 1;
- if ( set_arg_int(gctx, 3, pan_width) ) return 1;
+ if ( set_arg_int(gctx, 3, p->w) ) return 1;
if ( set_arg_float(gctx, 4, p->cnx) ) return 1;
if ( set_arg_float(gctx, 5, p->cny) ) return 1;
if ( set_arg_float(gctx, 6, p->fsx) ) return 1;
@@ -221,8 +217,8 @@ static int do_panels(struct gpu_context *gctx, struct image *image,
if ( set_arg_float(gctx, 10, p->res) ) return 1;
if ( set_arg_float(gctx, 11, p->clen) ) return 1;
- dims[0] = pan_width * sampling;
- dims[1] = pan_height * sampling;
+ dims[0] = p->w * sampling;
+ dims[1] = p->h * sampling;
ldims[0] = sampling;
ldims[1] = sampling;
@@ -253,17 +249,17 @@ static int do_panels(struct gpu_context *gctx, struct image *image,
return 1;
}
- for ( ss=0; ss<pan_height; ss++ ) {
- for ( fs=0; fs<pan_width; fs++ ) {
+ for ( ss=0; ss<p->h; ss++ ) {
+ for ( fs=0; fs<p->w; fs++ ) {
float val;
- val = diff_ptr[fs + pan_width*ss];
+ val = diff_ptr[fs + p->w*ss];
if ( isinf(val) ) (*n_inf)++;
if ( val < 0.0 ) (*n_neg)++;
if ( isnan(val) ) (*n_nan)++;
- image->dp[i][fs + pan_width*ss] += val;
+ image->dp[i][fs + p->w*ss] += val;
}
}
diff --git a/tests/gpu_sim_check.c b/tests/gpu_sim_check.c
index 7c7c8e0c..5a98456f 100644
--- a/tests/gpu_sim_check.c
+++ b/tests/gpu_sim_check.c
@@ -103,20 +103,10 @@ int main(int argc, char *argv[])
cell = cell_rotate(cell_raw, random_quaternion(rng));
- gpu_image.width = 1024;
- gpu_image.height = 1024;
- cpu_image.width = 1024;
- cpu_image.height = 1024;
det = calloc(1, sizeof(struct detector));
det->n_panels = 2;
det->panels = calloc(2, sizeof(struct panel));
- det->max_fs = 1024;
- det->max_ss = 1024;
- det->panels[0].min_fs = 0;
- det->panels[0].max_fs = 1023;
- det->panels[0].min_ss = 0;
- det->panels[0].max_ss = 511;
det->panels[0].orig_min_fs = 0;
det->panels[0].orig_max_fs = 1023;
det->panels[0].orig_min_ss = 0;
@@ -138,10 +128,6 @@ int main(int argc, char *argv[])
det->panels[0].adu_per_eV = 1.0;
det->panels[0].data = NULL;
- det->panels[1].min_fs = 0;
- det->panels[1].max_fs = 1023;
- det->panels[1].min_ss = 512;
- det->panels[1].max_ss = 1023;
det->panels[1].orig_min_fs = 0;
det->panels[1].orig_max_fs = 1023;
det->panels[1].orig_min_ss = 512;