Evaluating element-wise expressions with PyCUDA

The PyCuda.elementwise.ElementwiseKernel function allows us to execute the kernel on complex expressions that are made of one or more operands into a single computational step, which is as follows:

ElementwiseKernel(arguments,operation,name,optional_parameters)

Here, we note that:

  • arguments: This is a C argument list of all the parameters that are involved in the kernel's execution.
  • operation: This is the operation that is to be executed on the specified arguments. If the argument is a vector, each operation will be performed for each entry.
  • name: This is the kernel's name.
  • optional_parameters: These are the compilation directives that are not used in the following example.

How to do it…

In this example, ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.