PyOpenCL vs. Clyther vs. pure OpenCL and C99: which is better for beginners?

I have a problem: a quick solution to linear systems (I have many such systems). I am going to solve this using GPU and OpenCL.

I like dynamic languages ​​like Ruby or Python, and I got the habit of using low-level languages ​​like C.

So, I have two simultaneous goals:

  • Design such an OpenCL solution for linear systems as fast as I can with minimal effort.
  • Do not lose a lot of performance. I do not want to pay 2-10 times for convenience, but I am willing to pay 30-50% for working with a high-level language.

Best option for me: almost python code compiles in OpenCL C with almost no loss.

I found such solutions: pure OpenCL C, PyOpenCL , Clyther .

Where to begin?

+4
source share
2 answers

My opinion is that trying to set a dynamic language in OpenCL is not worth the effort. You will lose most of what you like in Python and probably not save a lot of time for your efforts in the end.

But I'm only talking about writing OpenCL cores in Python. There is also a host application that prepares and presents kernels. If you like Python, I suggest writing a host application in pure Python using a shell such as PyOpenCL to access the OpenCL API. Then write your kernels in pure OpenCL and ask the Python application to present them as they are. I believe this will bring most of what you want from Python, while it costs almost nothing in performance.

+4
source

The hardest part of programming with OpenCL is parallelizing your algorithm, which means writing your kernels. Most likely, you will spend most of the time setting up and understanding your OpenCL C code, which AFAIK is your only choice for writing kernels.

In this case, I say that I want to use a pure C / OpenCL implementation. Once you enable and run the OpenCL API toolbar, you are unlikely to have much to change. Anyway, you'll play with things like the size of the workgroup that you pass to clEnqueueNDRangeKernel .

If you are new to CL, I say that it is simple. Adding a different level of software to the problem - especially a problem defined as a linear solver - only complicates your efforts.

EDIT:

I must add that you are expanding your potential for online help / support using the standard OpenCL API. If you decide to go with one of the python bundles, you can limit your potential support to people from these communities.

+1
source

Source: https://habr.com/ru/post/1381369/


All Articles