Chapter 3, Getting Started with PyCUDA

  1. Yes.
  2. Memory transfers between host/device, and compilation time.
  3. You can, but this will vary depending on your GPU and CPU setup.
  4. Do this using the C ? operator for both the point-wise and reduce operations.
  5. If a gpuarray object goes out of scope its destructor is called, which will deallocate (free) the memory it represents on the GPU automatically.
  6. ReductionKernel may perform superfluous operations, which may be necessary depending on how the underlying GPU code is structured. A neutral element will ensure that no values are altered as a result of these superfluous operations.
  7. We should set neutral to the smallest possible value of a signed 32-bit integer.

Get Hands-On GPU Programming with Python and CUDA 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.