Kyle Wright
Kyle Wright

Reputation: 520

Does PyOpenCL only parallelize C++ code?

Trying to learn PyOpenCL but the only example I've found is:

http://enja.org/2010/07/13/adventures-in-opencl-part-1-getting-started/

Which seems to parallelize a C++ script, taken in quotes. I can't find any definitive answers on this. Has anyone here ever used PyOpenCL to speed up python code, or is it only used for C++?

Upvotes: 2

Views: 315

Answers (2)

Hugh Perkins
Hugh Perkins

Reputation: 8602

PyOpenCL lets you run algorithms on a GPU. A GPU has a lot of power ("flops") for very low cost (relative to the flops; and compared to eg a CPU). You write the algorithms in C. PyOpenCL will convert your C programs into a form the GPU can execute, and run them on the GPU for you. Recent versions of OpenCL also allow you to write the algorithms in C++. There is no particular reason why GPU programs couldnt be expressed in Python, and translated from there into the actual GPU code, through some kind of compilation process. However, this isnt what PyOpenCL does, and, to my knowledge, no such compiler exists for the time being (though, you could write one :-) ).

Upvotes: 1

benshope
benshope

Reputation: 3024

It seems you may be looking for the fastest and most effective path to learn GPU programming.

The Udacity parallel programming course is a great place to start with GPGPU. https://www.udacity.com/course/cs344 This course will teach you fundamental GPGPU concepts very quickly.

After (or during) the Udacity course, I recommend you read, run, and customize the PyOpenCL code examples: https://github.com/inducer/pyopencl/tree/master/examples

Upvotes: 4

Related Questions