aboutsummaryrefslogtreecommitdiff
path: root/src/pattern_sim.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pattern_sim.c')
-rw-r--r--src/pattern_sim.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index c722d2f9..54d9ab88 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -152,6 +152,7 @@ int main(int argc, char *argv[])
{
int c;
struct image image;
+ struct gpu_context *gctx = NULL;
long long int *powder;
int config_simdetails = 0;
int config_nearbragg = 0;
@@ -289,7 +290,11 @@ int main(int argc, char *argv[])
na, nb, nc, na*a/1.0e-9, nb*b/1.0e-9, nc*c/1.0e-9);
if ( config_gpu ) {
- get_diffraction_gpu(&image, na, nb, nc, config_nosfac);
+ if ( gctx == NULL ) {
+ gctx = setup_gpu(config_nosfac, &image,
+ image.molecule);
+ }
+ get_diffraction_gpu(gctx, &image, na, nb, nc);
} else {
get_diffraction(&image, na, nb, nc, config_nosfac);
}
@@ -354,5 +359,9 @@ skip:
} while ( !done );
+ if ( gctx != NULL ) {
+ cleanup_gpu(gctx);
+ }
+
return 0;
}