gpu / JOCL

Java bindings for OpenCL
http://www.jocl.org
Other
187 stars 33 forks source link

Trying to run any sample on osx big sur, results in "The function clCreateCommandQueueWithProperties is not supported" #39

Closed tonywestonuk closed 3 years ago

tonywestonuk commented 3 years ago

Im trying to get JOCL working on an Apple M1 Macbook.

Downloading version 2.0.4 appears to pick up the correct dylib for arm. but get the error function clCreateCommandQueueWithProperties is not supported, reardless what sample I attempt to run.

trying with Zulu java for arm64. Its probably me not not knowing what I should do. But, help. :/

gpu commented 3 years ago

As far as I know, the OpenCL support of Mac is not entirely "up to date". Specifically, I think that it does not support OpenCL 2.0, where clCreateCommandQueueWithProperties was introduced. You should be able to run https://github.com/gpu/JOCLSamples/blob/master/src/main/java/org/jocl/samples/JOCLDeviceQuery.java though, and it should print the CL_PLATFORM_VERSION.

Surprisingly, this prints OpenCL 1.2 CUDA 11.2.66 for me, so strictly speaking, clCreateCommandQueueWithProperties shouln't be available for me either, but apparently, it is supported (handwaving: Maybe NVIDIA added it, even though they only support 1.2 officially and fully, and it is just picked up by the ICD).

In any case, when there is code like this in one of the samples...

    // Create a command-queue for the selected device
    cl_queue_properties properties = new cl_queue_properties();
    cl_command_queue commandQueue = clCreateCommandQueueWithProperties(
        context, device, properties, null);

then you should be able to replace it with

    // Create a command-queue for the selected device
    cl_command_queue commandQueue = clCreateCommandQueue(
        context, device, 0, null);

(the function is marked as "deprecated", and I'd have to look up how you could sensibly emulate the cl_queue_properties is this is required, but maybe it's sufficient for a first test...)

tonywestonuk commented 3 years ago

Yes, this works..... The Mandelbrot sample working using this 👍

Screenshot 2021-02-19 at 15 44 08

Thank You for your time and efforts :-)

gpu commented 3 years ago

Good to hear that. Assuming that it's OK to close then.