aboutsummaryrefslogtreecommitdiff
path: root/src/diffraction-gpu.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-02-26 16:47:27 +0100
committerThomas White <taw@physics.org>2010-02-26 16:54:59 +0100
commit7d8662ffe897dc2438141ecc8848863bad9b9d92 (patch)
tree46af84456de347220cfcb363c3b4e4ef70362f40 /src/diffraction-gpu.c
parent86dd71e8640394f4e4f5aa71b2e5f51f5fea4a11 (diff)
Move water calculation to diffraction.c, and work out the consequences
Diffstat (limited to 'src/diffraction-gpu.c')
-rw-r--r--src/diffraction-gpu.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c
index 33410701..a2d1c47a 100644
--- a/src/diffraction-gpu.c
+++ b/src/diffraction-gpu.c
@@ -140,7 +140,7 @@ void get_diffraction_gpu(struct gpu_context *gctx, struct image *image,
}
/* Local memory for reduction */
clSetKernelArg(gctx->kern, 15,
- BWSAMPLING*SAMPLING*SAMPLING*2*sizeof(cl_float), NULL);
+ BWSAMPLING*SAMPLING*SAMPLING*sizeof(cl_float), NULL);
if ( err != CL_SUCCESS ) {
ERROR("Couldn't set arg 15: %s\n", clError(err));
return;
@@ -230,20 +230,18 @@ void get_diffraction_gpu(struct gpu_context *gctx, struct image *image,
free(event);
- image->sfacs = calloc(image->width * image->height,
- sizeof(double complex));
+ image->data = calloc(image->width * image->height, sizeof(float));
image->twotheta = calloc(image->width * image->height, sizeof(double));
for ( x=0; x<image->width; x++ ) {
for ( y=0; y<image->height; y++ ) {
- float re, im, tt;
+ float val, tt;
- re = diff_ptr[2*(x + image->width*y)+0];
- im = diff_ptr[2*(x + image->width*y)+1];
+ val = diff_ptr[x + image->width*y];
tt = tt_ptr[x + image->width*y];
- image->sfacs[x + image->width*y] = re + I*im;
+ image->data[x + image->width*y] = val;
image->twotheta[x + image->width*y] = tt;
}
@@ -312,7 +310,7 @@ struct gpu_context *setup_gpu(int no_sfac, struct image *image,
}
/* Create buffer for the picture */
- gctx->diff_size = image->width*image->height*sizeof(cl_float)*2;
+ gctx->diff_size = image->width*image->height*sizeof(cl_float);
gctx->diff = clCreateBuffer(gctx->ctx, CL_MEM_WRITE_ONLY,
gctx->diff_size, NULL, &err);
if ( err != CL_SUCCESS ) {