Revision: 56750
          http://sourceforge.net/p/brlcad/code/56750
Author:   ejno
Date:     2013-08-12 17:42:33 +0000 (Mon, 12 Aug 2013)
Log Message:
-----------
actually, it can be parallelized by librt

Modified Paths:
--------------
    brlcad/branches/opencl/src/librt/primitives/sph/sph.c

Modified: brlcad/branches/opencl/src/librt/primitives/sph/sph.c
===================================================================
--- brlcad/branches/opencl/src/librt/primitives/sph/sph.c       2013-08-12 
17:31:58 UTC (rev 56749)
+++ brlcad/branches/opencl/src/librt/primitives/sph/sph.c       2013-08-12 
17:42:33 UTC (rev 56750)
@@ -210,22 +210,18 @@
            sizeof(cl_double3), &result, &error);
     if (error != CL_SUCCESS) bu_bomb("failed to create OpenCL output buffer");
 
-    /* it's too expensive to create a new kernel for each shot; disable 
parallelism from librt */
     bu_semaphore_acquire(clt_semaphore);
-
     error = clSetKernelArg(clt_kernel, 0, sizeof(cl_mem), &output);
     error |= clSetKernelArg(clt_kernel, 1, sizeof(cl_double3), &o);
     error |= clSetKernelArg(clt_kernel, 2, sizeof(cl_double3), &l);
     error |= clSetKernelArg(clt_kernel, 3, sizeof(cl_double3), &c);
     error |= clSetKernelArg(clt_kernel, 4, sizeof(cl_double), &r);
     if (error != CL_SUCCESS) bu_bomb("failed to set OpenCL kernel arguments");
-
     error = clEnqueueNDRangeKernel(clt_queue, clt_kernel, 1, NULL, 
&global_size, NULL, 0, NULL, &done_kernel);
+    bu_semaphore_release(clt_semaphore);
     if (error != CL_SUCCESS) bu_bomb("failed to enqueue OpenCL kernel");
-    if (clWaitForEvents(1, &done_kernel) != CL_SUCCESS) bu_bomb("failure in 
clWaitForEvents()");
 
-    bu_semaphore_release(clt_semaphore);
-
+    if (clFinish(clt_queue) != CL_SUCCESS) bu_bomb("failure in clFinish()");
     clReleaseMemObject(output);
     return result;
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to