Hi all, thanks for your input!
Brian Cole <[email protected]> writes: > Oops, just realized I replied only to Andreas, not the whole list, for the > record here it is: > > This has come up multiple times with the C++ bindings and even in the > OpenCL working group. The stance taken there is the user should > explicitly create copies of kernels for each thread that needs to set > arguments. Though doing so is kind of cumbersome from an C API > perspective as it means multiple calls to clCreateKernel with the > associated kernel name lookup. A clCloneKernel API has been talked > about, but needs someone to champion it all the way to inclusion in > the specification. My request to the working group would be to remove this whole problem by moving to an inherently safe, non-stateful API, as CUDA has done in 4.0: http://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/html/group__CUDA__EXEC_gb8f3dc3031b40da29d5f9a7139e52e15.html I.e. the parameters are set along with the enqueue. Less state, less pain. :) As I said, in the meantime, we'll go with your suggestion--with a slight modification. program.kernel_name will continue to directly correspond to clCreateKernel, and we'll make it the users problem to ensure that to get a fresh kernel for each thread. Rationale: Even if we had your code in Program.__getattr__, a user could still pass a kernel reference to a different thread and get herself into hot water. No safety > partial safety, IMO. Here's the note I've added to the docs: http://documen.tician.de/pyopencl/runtime.html#pyopencl.Kernel.__call__ Andreas _______________________________________________ PyOpenCL mailing list [email protected] http://lists.tiker.net/listinfo/pyopencl
