O'Reilly logo

Python Parallel Programming Cookbook by Giancarlo Zaccone

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required