[gegl/gsoc2011-opencl: 7/14] platform detection inside gegl-cl-init



commit c277e93a4f21ce7d0d3b97434aa30e3a2057f87b
Author: Victor Matheus de A. Oliveira <victormatheus gmail com>
Date:   Sat May 14 12:17:55 2011 -0300

    platform detection inside gegl-cl-init
    
    Signed-off-by: Victor Oliveira <victormatheus gmail com>

 gegl/opencl/gegl-cl-init.c |   17 +++++++++++++++++
 operations/common/over.c   |   18 ------------------
 2 files changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index fc878f5..864f783 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -34,6 +34,12 @@ gboolean
 gegl_cl_init (GError **error)
 {
   GModule *module;
+
+  char buffer[65536];
+  cl_platform_id platforms[1024];
+  cl_uint num_platforms;
+  int i;
+
   module = g_module_open ("libOpenCL.so", G_MODULE_BIND_LAZY);
 
   if (!module)
@@ -48,6 +54,17 @@ gegl_cl_init (GError **error)
 
   cl_is_accelerated = TRUE;
 
+  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;
 }
 
diff --git a/operations/common/over.c b/operations/common/over.c
index 85a7c85..18c6515 100644
--- a/operations/common/over.c
+++ b/operations/common/over.c
@@ -53,24 +53,6 @@ cl_process (GeglOperation        *op,
 {
   gegl_cl_init(NULL);
 
-  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;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]