From fa010578c3ad146e6c7c89305fe57394eaff4b92 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 15 Nov 2011 16:37:04 +0100 Subject: Move cl-utils back out of libcrystfel --- libcrystfel/Makefile.am | 6 +- libcrystfel/Makefile.in | 15 ++-- libcrystfel/src/cl-utils.c | 200 --------------------------------------------- libcrystfel/src/cl-utils.h | 27 ------ 4 files changed, 8 insertions(+), 240 deletions(-) delete mode 100644 libcrystfel/src/cl-utils.c delete mode 100644 libcrystfel/src/cl-utils.h (limited to 'libcrystfel') diff --git a/libcrystfel/Makefile.am b/libcrystfel/Makefile.am index 141842ff..40846412 100644 --- a/libcrystfel/Makefile.am +++ b/libcrystfel/Makefile.am @@ -4,7 +4,7 @@ libcrystfel_la_SOURCES = src/reflist.c src/utils.c src/cell.c src/detector.c \ src/thread-pool.c src/image.c src/hdf5-file.c \ src/beam-parameters.c src/geometry.c src/statistics.c \ src/symmetry.c src/stream.c src/peaks.c \ - src/reflist-utils.c src/filters.c src/cl-utils.c \ + src/reflist-utils.c src/filters.c \ src/render.c src/index.c src/dirax.c src/mosflm.c \ src/reax.c @@ -13,10 +13,10 @@ libcrystfel_la_includedir=$(includedir)/crystfel/ libcrystfel_la_include_HEADERS = src/beam-parameters.h src/hdf5-file.h \ src/reflist.h src/symmetry.h src/cell.h \ src/reflist-utils.h src/thread-pool.h \ - src/cl-utils.h src/filters.h \ src/statistics.h src/utils.h src/detector.h \ src/geometry.h src/peaks.h src/stream.h \ - src/render.h src/index.h src/image.h + src/render.h src/index.h src/image.h \ + src/filters.h INCLUDES = "-I$(top_srcdir)/data" AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I$(top_builddir)/lib diff --git a/libcrystfel/Makefile.in b/libcrystfel/Makefile.in index 8992f9ed..0a03ee42 100644 --- a/libcrystfel/Makefile.in +++ b/libcrystfel/Makefile.in @@ -88,9 +88,8 @@ am_libcrystfel_la_OBJECTS = src/reflist.lo src/utils.lo src/cell.lo \ src/detector.lo src/thread-pool.lo src/image.lo \ src/hdf5-file.lo src/beam-parameters.lo src/geometry.lo \ src/statistics.lo src/symmetry.lo src/stream.lo src/peaks.lo \ - src/reflist-utils.lo src/filters.lo src/cl-utils.lo \ - src/render.lo src/index.lo src/dirax.lo src/mosflm.lo \ - src/reax.lo + src/reflist-utils.lo src/filters.lo src/render.lo src/index.lo \ + src/dirax.lo src/mosflm.lo src/reax.lo libcrystfel_la_OBJECTS = $(am_libcrystfel_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) @@ -351,7 +350,7 @@ libcrystfel_la_SOURCES = src/reflist.c src/utils.c src/cell.c src/detector.c \ src/thread-pool.c src/image.c src/hdf5-file.c \ src/beam-parameters.c src/geometry.c src/statistics.c \ src/symmetry.c src/stream.c src/peaks.c \ - src/reflist-utils.c src/filters.c src/cl-utils.c \ + src/reflist-utils.c src/filters.c \ src/render.c src/index.c src/dirax.c src/mosflm.c \ src/reax.c @@ -359,10 +358,10 @@ libcrystfel_la_includedir = $(includedir)/crystfel/ libcrystfel_la_include_HEADERS = src/beam-parameters.h src/hdf5-file.h \ src/reflist.h src/symmetry.h src/cell.h \ src/reflist-utils.h src/thread-pool.h \ - src/cl-utils.h src/filters.h \ src/statistics.h src/utils.h src/detector.h \ src/geometry.h src/peaks.h src/stream.h \ - src/render.h src/index.h src/image.h + src/render.h src/index.h src/image.h \ + src/filters.h INCLUDES = "-I$(top_srcdir)/data" AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I$(top_builddir)/lib \ @@ -455,7 +454,6 @@ src/peaks.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/reflist-utils.lo: src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/filters.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) -src/cl-utils.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/render.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/index.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/dirax.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) @@ -470,8 +468,6 @@ mostlyclean-compile: -rm -f src/beam-parameters.lo -rm -f src/cell.$(OBJEXT) -rm -f src/cell.lo - -rm -f src/cl-utils.$(OBJEXT) - -rm -f src/cl-utils.lo -rm -f src/detector.$(OBJEXT) -rm -f src/detector.lo -rm -f src/dirax.$(OBJEXT) @@ -514,7 +510,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/beam-parameters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/cell.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/cl-utils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/detector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dirax.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/filters.Plo@am__quote@ diff --git a/libcrystfel/src/cl-utils.c b/libcrystfel/src/cl-utils.c deleted file mode 100644 index 65a09363..00000000 --- a/libcrystfel/src/cl-utils.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * cl-utils.c - * - * OpenCL utility functions - * - * (c) 2006-2011 Thomas White - * - * Part of CrystFEL - crystallography with a FEL - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#ifdef HAVE_CL_CL_H -#include -#else -#include -#endif - -#include "utils.h" - - -const char *clError(cl_int err) -{ - switch ( err ) { - case CL_SUCCESS : return "no error"; - case CL_INVALID_PLATFORM : return "invalid platform"; - case CL_INVALID_KERNEL : return "invalid kernel"; - case CL_INVALID_ARG_INDEX : return "invalid argument index"; - case CL_INVALID_ARG_VALUE : return "invalid argument value"; - case CL_INVALID_MEM_OBJECT : return "invalid memory object"; - case CL_INVALID_SAMPLER : return "invalid sampler"; - case CL_INVALID_ARG_SIZE : return "invalid argument size"; - case CL_INVALID_COMMAND_QUEUE : return "invalid command queue"; - case CL_INVALID_CONTEXT : return "invalid context"; - case CL_INVALID_VALUE : return "invalid value"; - case CL_INVALID_EVENT_WAIT_LIST : return "invalid wait list"; - case CL_MAP_FAILURE : return "map failure"; - case CL_MEM_OBJECT_ALLOCATION_FAILURE : return "object allocation failure"; - case CL_OUT_OF_HOST_MEMORY : return "out of host memory"; - case CL_OUT_OF_RESOURCES : return "out of resources"; - case CL_INVALID_KERNEL_NAME : return "invalid kernel name"; - case CL_INVALID_KERNEL_ARGS : return "invalid kernel arguments"; - case CL_INVALID_WORK_GROUP_SIZE : return "invalid work group size"; - case CL_IMAGE_FORMAT_NOT_SUPPORTED : return "image format not supported"; - case CL_INVALID_WORK_DIMENSION : return "invalid work dimension"; - default : - return "unknown error"; - } -} - - -static char *get_device_string(cl_device_id dev, cl_device_info info) -{ - int r; - size_t size; - char *val; - - r = clGetDeviceInfo(dev, info, 0, NULL, &size); - if ( r != CL_SUCCESS ) { - ERROR("Couldn't get device vendor size: %s\n", - clError(r)); - return NULL; - } - val = malloc(size); - r = clGetDeviceInfo(dev, info, size, val, NULL); - if ( r != CL_SUCCESS ) { - ERROR("Couldn't get dev vendor: %s\n", clError(r)); - return NULL; - } - - return val; -} - - -cl_device_id get_cl_dev(cl_context ctx, int n) -{ - cl_device_id *dev; - cl_int r; - size_t size; - int i, num_devs; - - /* Get the required size of the array */ - r = clGetContextInfo(ctx, CL_CONTEXT_DEVICES, 0, NULL, &size); - if ( r != CL_SUCCESS ) { - ERROR("Couldn't get array size for devices: %s\n", clError(r)); - return 0; - } - - dev = malloc(size); - r = clGetContextInfo(ctx, CL_CONTEXT_DEVICES, size, dev, NULL); - if ( r != CL_SUCCESS ) { - ERROR("Couldn't get device: %s\n", clError(r)); - return 0; - } - num_devs = size/sizeof(cl_device_id); - - if ( n >= num_devs ) { - ERROR("Device ID out of range\n"); - return 0; - } - - if ( n < 0 ) { - - STATUS("Available devices:\n"); - for ( i=0; i - * - * Part of CrystFEL - crystallography with a FEL - * - */ - -#ifndef CLUTILS_H -#define CLUTILS_H - -#ifdef HAVE_CONFIG_H -#include -#endif - - -extern const char *clError(cl_int err); -extern cl_device_id get_cl_dev(cl_context ctx, int n); -extern cl_program load_program(const char *filename, cl_context ctx, - cl_device_id dev, cl_int *err, - const char *extra_cflags); - - -#endif /* CLUTILS_H */ -- cgit v1.2.3