Evaluating element-wise expressions with PyOpenCl

Similar to PyCUDA, PyOpenCL provides the functionality in the pyopencl.elementwise class that allows us to evaluate the complicated expressions in a single computational pass. The method that realized this is:

   ElementwiseKernel(context, argument, operation, name,",",", 
                          optional_parameters)

Here:

  • context: This is the device or the group of devices on which the element-wise operation will be executed
  • argument: This is a C-like argument list of all the parameters involved in the computation
  • operation: This is a string that represents the operation that is to be performed on the argument list
  • name: This is the kernel name associated with ElementwiseKernel
  • optional_parameters: These are not important for ...

Get Python Parallel Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.