aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-02-24 19:05:45 +0100
committerThomas White <taw@physics.org>2010-02-24 19:05:45 +0100
commit8493aedf54b0747c33c9dbdb85c8fdbf15616d02 (patch)
tree791bc266628f6d61aa47abae1d4db3e0bcabc76a
parentb8872a44c8a6dc60d98d992dca992573a28d059b (diff)
indexamajig can use the GPU too
-rw-r--r--src/Makefile.am3
-rw-r--r--src/Makefile.in22
-rw-r--r--src/indexamajig.c19
3 files changed, 33 insertions, 11 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 963c5373..921208f6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,6 +25,9 @@ indexamajig_SOURCES = indexamajig.c hdf5-file.c utils.c cell.c image.c \
intensities.c peaks.c index.c filters.c \
diffraction.c detector.c sfac.c
indexamajig_LDADD = @LIBS@
+if HAVE_OPENCL
+indexamajig_SOURCES += diffraction-gpu.c cl-utils.c
+endif
if HAVE_GLIB
indexamajig_SOURCES += dirax.c
diff --git a/src/Makefile.in b/src/Makefile.in
index 5df5985a..9f9618b6 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -37,8 +37,9 @@ bin_PROGRAMS = pattern_sim$(EXEEXT) process_hkl$(EXEEXT) \
powder_plot$(EXEEXT) $(am__EXEEXT_1)
@HAVE_GTK_TRUE@am__append_1 = hdfsee
@HAVE_OPENCL_TRUE@am__append_2 = diffraction-gpu.c cl-utils.c
-@HAVE_GLIB_TRUE@am__append_3 = dirax.c
+@HAVE_OPENCL_TRUE@am__append_3 = diffraction-gpu.c cl-utils.c
@HAVE_GLIB_TRUE@am__append_4 = dirax.c
+@HAVE_GLIB_TRUE@am__append_5 = dirax.c
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -70,24 +71,25 @@ hdfsee_OBJECTS = $(am_hdfsee_OBJECTS)
hdfsee_DEPENDENCIES =
am__indexamajig_SOURCES_DIST = indexamajig.c hdf5-file.c utils.c \
cell.c image.c intensities.c peaks.c index.c filters.c \
- diffraction.c detector.c sfac.c dirax.c
-@HAVE_GLIB_TRUE@am__objects_1 = dirax.$(OBJEXT)
+ diffraction.c detector.c sfac.c diffraction-gpu.c cl-utils.c \
+ dirax.c
+@HAVE_OPENCL_TRUE@am__objects_1 = diffraction-gpu.$(OBJEXT) \
+@HAVE_OPENCL_TRUE@ cl-utils.$(OBJEXT)
+@HAVE_GLIB_TRUE@am__objects_2 = dirax.$(OBJEXT)
am_indexamajig_OBJECTS = indexamajig.$(OBJEXT) hdf5-file.$(OBJEXT) \
utils.$(OBJEXT) cell.$(OBJEXT) image.$(OBJEXT) \
intensities.$(OBJEXT) peaks.$(OBJEXT) index.$(OBJEXT) \
filters.$(OBJEXT) diffraction.$(OBJEXT) detector.$(OBJEXT) \
- sfac.$(OBJEXT) $(am__objects_1)
+ sfac.$(OBJEXT) $(am__objects_1) $(am__objects_2)
indexamajig_OBJECTS = $(am_indexamajig_OBJECTS)
indexamajig_DEPENDENCIES =
am__pattern_sim_SOURCES_DIST = pattern_sim.c diffraction.c utils.c \
image.c cell.c hdf5-file.c detector.c sfac.c intensities.c \
reflections.c diffraction-gpu.c cl-utils.c
-@HAVE_OPENCL_TRUE@am__objects_2 = diffraction-gpu.$(OBJEXT) \
-@HAVE_OPENCL_TRUE@ cl-utils.$(OBJEXT)
am_pattern_sim_OBJECTS = pattern_sim.$(OBJEXT) diffraction.$(OBJEXT) \
utils.$(OBJEXT) image.$(OBJEXT) cell.$(OBJEXT) \
hdf5-file.$(OBJEXT) detector.$(OBJEXT) sfac.$(OBJEXT) \
- intensities.$(OBJEXT) reflections.$(OBJEXT) $(am__objects_2)
+ intensities.$(OBJEXT) reflections.$(OBJEXT) $(am__objects_1)
pattern_sim_OBJECTS = $(am_pattern_sim_OBJECTS)
pattern_sim_DEPENDENCIES =
am__powder_plot_SOURCES_DIST = powder_plot.c cell.c utils.c image.c \
@@ -95,7 +97,7 @@ am__powder_plot_SOURCES_DIST = powder_plot.c cell.c utils.c image.c \
am_powder_plot_OBJECTS = powder_plot.$(OBJEXT) cell.$(OBJEXT) \
utils.$(OBJEXT) image.$(OBJEXT) hdf5-file.$(OBJEXT) \
detector.$(OBJEXT) index.$(OBJEXT) diffraction.$(OBJEXT) \
- sfac.$(OBJEXT) $(am__objects_1)
+ sfac.$(OBJEXT) $(am__objects_2)
powder_plot_OBJECTS = $(am_powder_plot_OBJECTS)
powder_plot_DEPENDENCIES =
am_process_hkl_OBJECTS = process_hkl.$(OBJEXT) sfac.$(OBJEXT) \
@@ -222,7 +224,7 @@ process_hkl_SOURCES = process_hkl.c sfac.c statistics.c cell.c utils.c \
process_hkl_LDADD = @LIBS@
indexamajig_SOURCES = indexamajig.c hdf5-file.c utils.c cell.c image.c \
intensities.c peaks.c index.c filters.c diffraction.c \
- detector.c sfac.c $(am__append_3)
+ detector.c sfac.c $(am__append_3) $(am__append_4)
indexamajig_LDADD = @LIBS@
@HAVE_GTK_TRUE@hdfsee_SOURCES = hdfsee.c displaywindow.c render.c hdf5-file.c utils.c image.c \
@HAVE_GTK_TRUE@ filters.c
@@ -233,7 +235,7 @@ get_hkl_LDADD = @LIBS@
compare_hkl_SOURCES = compare_hkl.c sfac.c cell.c utils.c reflections.c
compare_hkl_LDADD = @LIBS@
powder_plot_SOURCES = powder_plot.c cell.c utils.c image.c hdf5-file.c \
- detector.c index.c diffraction.c sfac.c $(am__append_4)
+ detector.c index.c diffraction.c sfac.c $(am__append_5)
powder_plot_LDADD = @LIBS@
INCLUDES = "-I$(top_srcdir)/data"
all: all-am
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 9408f9a3..490dc1ea 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -28,6 +28,7 @@
#include "intensities.h"
#include "peaks.h"
#include "diffraction.h"
+#include "diffraction-gpu.h"
#include "detector.h"
#include "sfac.h"
#include "filters.h"
@@ -65,6 +66,7 @@ static void show_help(const char *s)
int main(int argc, char *argv[])
{
int c;
+ struct gpu_context *gctx = NULL;
char *filename = NULL;
FILE *fh;
char *rval;
@@ -77,6 +79,7 @@ int main(int argc, char *argv[])
int config_simulate = 0;
int config_clean = 0;
int config_nomatch = 0;
+ int config_gpu = 0;
IndexingMethod indm;
char *indm_str = NULL;
@@ -84,6 +87,7 @@ int main(int argc, char *argv[])
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
{"input", 1, NULL, 'i'},
+ {"gpu", 0, &config_gpu, 1},
{"no-index", 0, &config_noindex, 1},
{"dump-peaks", 0, &config_dumpfound, 1},
{"near-bragg", 0, &config_nearbragg, 1},
@@ -240,7 +244,16 @@ int main(int argc, char *argv[])
image.data = NULL;
- get_diffraction(&image, 8, 8, 8, 0);
+ if ( config_gpu ) {
+ if ( gctx == NULL ) {
+ gctx = setup_gpu(0, &image,
+ image.molecule);
+ }
+ get_diffraction_gpu(gctx, &image,
+ 8, 8, 8);
+ } else {
+ get_diffraction(&image, 8, 8, 8, 0);
+ }
if ( image.molecule == NULL ) {
ERROR("Couldn't open molecule.pdb\n");
return 1;
@@ -268,5 +281,9 @@ done:
STATUS("There were %i images.\n", n_images);
STATUS("%i hits were found.\n", n_hits);
+ if ( gctx != NULL ) {
+ cleanup_gpu(gctx);
+ }
+
return 0;
}