0

Is it possible to run code on a Raspberry Pi which simulates the use of OpenCL?

I am developing code on a computer which is capable of using OpenCL, and am testing this code remotely on a Raspberry Pi to simulate deployment on the final production machine which will have its own GPUs.

I want to run the program in the testing environment, with any OpenCL code embedded. I am not expecting any performance gains on the Raspberry Pi, I just want to have as much continuity between the three environments.

This would be similar to me utilising all eight cores of the development machine to get performance enhancements from parallelism. When this code is run on the Pi, it uses only the one core available (see below), so there is no performance gain, but it is simulating parallelization.

I am coding in Python (using PyOpenCL) on a Raspberry Pi 1B+. If it's not possible on this old version of the Pi, would it work on a newer model?

0

PoCL would likely meet your requirements. Here's a fairly recent guide for setting up PoCL on a Pi 3B+. While there's nothing that would make this outright fail on a Pi B+, if compiling natively that alone will take a long time and could run out of RAM.

Simulating parallelization: To run with more virtual cores than the number of physical ones, configure the POCL_MAX_PTHREAD_COUNT environment variable.

PyOpenCL uses ctypes to talk to any particular OpenCL implementation so in theory it can work with PoCL on the Pi. However, assuming pip install pyopencl[pocl] doesn't simply work out of the box it may be up to you to do the necessary plumbing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.