[gegl/gsoc2011-opencl: 5/46] Change in Makefiles in order to support OpenCL
- From: Victor Matheus de Araujo Oliveira <vmaolive src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/gsoc2011-opencl: 5/46] Change in Makefiles in order to support OpenCL
- Date: Sat, 2 Jul 2011 04:47:11 +0000 (UTC)
commit 7128e2c31c2f46fc6f3ec7e133e6410c0ae10a3b
Author: victor matheus de araujo <victormatheus gmail com>
Date: Sun May 8 23:22:30 2011 -0300
Change in Makefiles in order to support OpenCL
Signed-off-by: Victor Oliveira <victormatheus gmail com>
bin/Makefile.am | 4 +++-
configure.ac | 4 ++--
examples/Makefile.am | 4 +++-
gegl/Makefile.am | 2 +-
gegl/opencl/gegl-cl-init.c | 4 ++--
operations/Makefile-common.am | 6 ++++--
operations/common/over.c | 36 ++++++++++++++++++++++++++++++++++++
7 files changed, 51 insertions(+), 9 deletions(-)
---
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 22b972d..c85ecbd 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -13,7 +13,9 @@ AM_CPPFLAGS = \
-I$(top_builddir)/gegl/operation \
-I$(top_srcdir)/gegl/operation \
-I$(top_builddir)/gegl/module \
- -I$(top_srcdir)/gegl/module
+ -I$(top_srcdir)/gegl/module \
+ -I$(top_builddir)/gegl/opencl \
+ -I$(top_srcdir)/gegl/opencl
AM_CFLAGS = \
$(DEP_CFLAGS) $(BABL_CFLAGS) $(PNG_CFLAGS)
diff --git a/configure.ac b/configure.ac
index 4018efd..10f65a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1025,8 +1025,8 @@ AC_SUBST(UMFPACK_LIBS)
# OPENCL
#######################
-OPENCL_CFLAGS="$OPENCL_CFLAGS -ldt",
-OPENCL_LIBS="$OPENCL_LIBS -rdynamic",
+OPENCL_CFLAGS="$OPENCL_CFLAGS"
+OPENCL_LIBS="$OPENCL_LIBS -ldl"
AC_SUBST(OPENCL_CFLAGS)
AC_SUBST(OPENCL_LIBS)
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 3e95374..91fe0f5 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -41,7 +41,9 @@ AM_CPPFLAGS = \
-I$(top_builddir)/gegl/operation \
-I$(top_srcdir)/gegl/operation \
-I$(top_builddir)/gegl/module \
- -I$(top_srcdir)/gegl/module
+ -I$(top_srcdir)/gegl/module \
+ -I$(top_builddir)/gegl/opencl \
+ -I$(top_srcdir)/gegl/opencl
AM_CFLAGS = $(DEP_CFLAGS) $(GTK_CFLAGS) $(BABL_CFLAGS) $(PNG_CFLAGS)
diff --git a/gegl/Makefile.am b/gegl/Makefile.am
index 094307c..c1ae67e 100644
--- a/gegl/Makefile.am
+++ b/gegl/Makefile.am
@@ -27,7 +27,7 @@ AM_CPPFLAGS = \
-DLIBDIR=\""$(libdir)"\" \
-DGEGL_LOCALEDIR=\""$(GEGL_LOCALEDIR)"\"
-AM_CFLAGS = $(DEP_CFLAGS) $(BABL_CFLAGS)
+AM_CFLAGS = $(DEP_CFLAGS) $(BABL_CFLAGS) $(OPENCL_CFLAGS)
AM_LDFLAGS = \
$(no_undefined) -export-dynamic -version-info $(GEGL_LIBRARY_VERSION)
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index 9a9390e..873de27 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -14,12 +14,12 @@ gegl_cl_is_accelerated (void)
}
#define CL_LOAD_FUNCTION(func) \
-gegl_##func = (t_##func) dlsym(handle, "#func"); \
+gegl_##func = (t_##func) dlsym(handle, #func); \
\
dlsym_error = dlerror(); \
if (dlsym_error) \
{ \
- fprintf(stderr, "Cannot load symbol '%s': %s\n", "#func", dlsym_error); \
+ fprintf(stderr, "Cannot load symbol" #func ": %s\n", dlsym_error); \
dlclose(handle); \
return; \
}
diff --git a/operations/Makefile-common.am b/operations/Makefile-common.am
index 55bdc54..ab59841 100644
--- a/operations/Makefile-common.am
+++ b/operations/Makefile-common.am
@@ -3,7 +3,7 @@ no_undefined = -no-undefined
libgegl = $(top_builddir)/gegl/libgegl-$(GEGL_API_VERSION).la $(BABL_LIBS)
endif
-op_libs = $(DEP_LIBS) $(libgegl)
+op_libs = $(DEP_LIBS) $(libgegl) $(OPENCL_LIBS)
GEGLHEADERS = $(wildcard $(top_srcdir)/gegl/*.h)\
$(wildcard $(top_srcdir)/gegl/buffer/*.h)
@@ -19,7 +19,9 @@ AM_CPPFLAGS = \
-I$(top_builddir)/gegl/property-types \
-I$(top_srcdir)/gegl/property-types \
-I$(top_builddir)/gegl/module \
- -I$(top_srcdir)/gegl/module
+ -I$(top_srcdir)/gegl/module \
+ -I$(top_builddir)/gegl/opencl \
+ -I$(top_srcdir)/gegl/opencl
AM_CFLAGS = $(DEP_CFLAGS) $(BABL_CFLAGS)
diff --git a/operations/common/over.c b/operations/common/over.c
index 1519ec2..2356b15 100644
--- a/operations/common/over.c
+++ b/operations/common/over.c
@@ -40,6 +40,40 @@ static void prepare (GeglOperation *operation)
gegl_operation_set_format (operation, "output", format);
}
+
+#include <gegl-cl-init.h>
+
+static gboolean
+cl_process (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
+{
+ gegl_cl_init();
+
+ char buffer[65536];
+ cl_int error;
+ cl_platform_id platforms[1024];
+ cl_uint num_platforms;
+ int i;
+
+ gegl_clGetPlatformIDs (1024, platforms, &num_platforms);
+
+ for (i=0; i<num_platforms; i++)
+ {
+ gegl_clGetPlatformInfo (platforms[i], CL_PLATFORM_NAME, sizeof(buffer), buffer, NULL);
+ printf("Device ID:%u\n%s\n", i, buffer);
+ gegl_clGetPlatformInfo (platforms[i], CL_PLATFORM_VERSION, sizeof(buffer), buffer, NULL);
+ printf("Version:%s\n", buffer);
+ gegl_clGetPlatformInfo (platforms[i], CL_PLATFORM_EXTENSIONS, sizeof(buffer), buffer, NULL);
+ printf("Extensions:%s\n", buffer);
+ }
+
+ return TRUE;
+}
+
static gboolean
process (GeglOperation *op,
void *in_buf,
@@ -67,6 +101,8 @@ process (GeglOperation *op,
aux += 4;
out += 4;
}
+
+ cl_process(op, in_buf, aux_buf, out_buf, n_pixels, roi);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]