CL_INVALID_VALUE when creating a command queue with GPU device

I’m on OSX 10.8.1 (with Nvidia GeForce GT 650M) and I am getting an CL_INVALID_VALUE error when I try to create a command queue (no problems with CPU).

The documentation states that CL_INVALID_VALUE is returned, if values specified in properties are not valid. I pass 0 as properties, as is default.

Is this because of OpenCl 1.2? Is this an issue with OSX 10.8.x?

Hello

Nothing should have changed there with OpenCL 1.2. Does any of the samples from the website (e.g. the first one, http://jocl.org/samples/JOCLSample.java ) work for you? I’ll review the code and check whether anything might be wrong there (although a real bug in this function would probably have been noticed earlier :wink: )

bye

EDIT: Although the specification does not say this, it MIGHT be the case that the ‚CL_INVALID_VALUE‘ is also reported when the device is wrong - I’m just wondering, because you mentioned that it only happens for the GPU device: Maybe the device is not initialized properly?

I should have mentioned that I’m trying to run the first sample. As the sample uses the first device

        final long deviceType = CL_DEVICE_TYPE_ALL;
        final int deviceIndex = 0;

it defaults to the CPU, it also works with CL_DEVICE_TYPE_CPU, but fails with CL_DEVICE_TYPE_GPU.

Results are the same with 0.1.7 and 0.1.8.

Created a test project based on the first sample on Github. It fails for me when using GPU as device.


	$ git clone git://github.com/oschrenk/jocl-test.git
	$ cd jocl-test
	$ mvn clean test

Code can be viewed online here: https://github.com/oschrenk/jocl-test

I just ran the test, and it passes

  • for the GPU version when I use the NVIDIA platform
  • for the CPU version when I use the AMD platform
    as expected.

Can you give more details about your setup? I assume that you have an AMD card, otherwise you could not use the CPU version. And I assume that you have OpenCL 1.1, because otherwise, JOCL 0.1.7 would not work. Is that correct?

I’ve seen in your github that you also have a C project for OpenCL: Can you initialize a command queue for CPU and GPU devices in the native version?

Sorry, but I don’t see any possible reason for this error message until now…

bye

It seems Apple supplies old/faulty drivers with their machines.

I have a Retina Macbook Pro with Intel HD 4000 (which isn’t even shown as an OpenCL device), and a GeForce GT 650M as the discrete graphic device.

After scratching my head for a while I even Apple’s Open CL Hello World which also fails to create a CommandQueue. I crossposted to Khronos Message Board to see if anybody has the same issues.

OSX 10.8.1
XCode 4.4.1
I did not install an SDK as it comes with the OS, 10.8 supplies OpenCL 1.2
Retina Macbook Pro, w/ Intel HD 4000, GeForce GT 650M

In Detail

  1. Device: Intel® Core™ i7-3720QM CPU @ 2.60GHz
    1.1 Hardware version: OpenCL 1.2
    1.2 Software version: 1.1
    1.3 OpenCL C version: OpenCL C 1.2
    1.4 Parallel compute units: 8
  2. Device: GeForce GT 650M
    2.1 Hardware version: OpenCL 1.1
    2.2 Software version: CLH 1.0
    2.3 OpenCL C version: OpenCL C 1.1
    2.4 Parallel compute units: 2

Hmm… I’m not sure about some aspects there. I’m not familiar with MacOS, and can not say whether this is a driver issue or so. I first thought that you might have used the wrong platform, because for me platform=0 is the NVIDIA platform, which only supports the GPU, and platform=1 is the AMD platform, which only works with the CPU (due to my NVIDIA card, of course). But if obviously finds the device, otherwise it would bail out earlier, with a DEVICE_NOT_FOUND.

““Fortunately”” it seems not to be related to JOCL, but of course, this does not help you -_- Let’s see whether someone at the Khronos board knows more about that… Maybe, one day in the distant future, the NVIDIA boards might also be open again…

I will try the code again tomorrow on a Linux machine and AMD SDK, but I strongly believe that this is Apple’s fault.

No response in the Khronos forum so far -_- …
Did you have a chance to run the test on the linux machine?

The code is working fine on my OpenSuse machine with Radeon HD 7950. I spent the weekend trying to figure out why it isn’t working on my Mac and I ended up reinstalling XCode (and it’s Command Line Tools) which should have no effect (OpenCL is a system library) but I think I found the problem.

It works, but ONLY after a fresh restart of my machine. Once the MacBook has gone to sleep I can’t create command queues anymore until after the next reboot. The hours wasted because of this.

This sounds strange… and annoying, because it’s hard to find -_- Of course I have no idea what might go wrong there, but … at least you know it (and maybe can turn off the sleep mode or so…), and if someone has the same problem, he might see whether it has the same reason. Maybe you could also mention this in the Khronos forum, in order to prevent others from wasting time as well - or, maybe, someone then has an idea what’s going on there.

I will post my results to Khronos and Apple Bug Report after I did some more research. There may be some more variables to the equation, as I’m developing in an account with standard permissions. I want to try to bump it to an account with administrator privileges and see what happens. Hopefully I find the time in the next days.

Hi guys,

I have the same problem w/ my rMBP. I can create/destroy the OCL context & queue ~ 25 times, and then it fails and I have to reboot the machine. This happened on 10.8, 10.8.1 and now 10.8.2. I can send you a test to verify the problem if you want, let me know.

I opened a radar #12186778 at Apple, no response so far, though. Please open a radar as well, the more the higher the chance it gets fixed RSN.

In what thread in in the Khronos forum did you post the problem?

cheers,
–Philippe

Hello

The thread is at http://www.khronos.org/message_boards/viewtopic.php?f=56&t=5281 - Still no response.

But what you described sounds at least a little bit different - the summary/analysis of oschrenk was
"Once the MacBook has gone to sleep I can’t create command queues anymore until after the next reboot."
Your description sounds like there’s something wrong with the creation/desctruction of contexts, some sort of a ““memory leak”” maybe…? Stange enough, especially since Apple was one of the first implementors who provided OpenCL 1.2…

bye
Marco

@marco13
Maybe I saw a pattern when there was none.

@Philippe
I’m “happy” to see other people are having the same problem. Hopefully move voices are heard. I since moved on doing my OpenCL work on another, dedicated Linux machine.

I’m now on 10.8.2, XCode 4.5 and just run some tests with success, even when waking up from sleep, so I can’t even reproduce my old error for the time being. I ran into them with 10.8, 10.8.1 using Xcode 4.3.2

As I said, I think my OSX environment is complicating the issue, as I have one admin account to install applications, and a development account that only has default user permissions. Because of this I even ran into compilation problems with other non-OpenCL projects (forcing me to run sudo xcodebuild -license on development account, after su admin, without sudo I had some problems). What I see when I first started XCode 4.5 (fresh install!) from the development account was a dialog asking for admin permissions to install “Device Components” (whatever that is). So maybe some of that helped.

I’ll open a bug report with apple if I run into this problem again. But as I don’t see the problem with JOCL I suggest we move the discussion the Khronos board.