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

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