cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

cymick
Journeyman III

Invalid device HD 5800

I'm trying to get my current OpenCL program to run on my secondary video card. At the moment I'm running two Radeon HD 5800 cards (no crossfire) with a Windows 7 64 bit OS. The program compiles and runs just fine when I select my primary video card but when I try to select my secondary card it gives an invalid device error when I try to create command queue. The device shows up when I do a device query and I don't think I'm doing something wrong when selecting the device since I run the same exact process to pick my primary card. Are there any subtleties I should be aware of that may resolve this?

0 Likes
1 Solution

It is a very nice code, your problem is:


context = clCreateContext(properties, 1, devices, NULL, NULL, &err);

You are including only the 1st device in the context. You should have


context = clCreateContext(properties, num_devs_returned, devices, NULL, NULL, &err);

But just as a warning, if you create memory objects, they might get copied to all the devices in the context. So you might instead prefer

context = clCreateContext(properties, 1, &devices[device_used], NULL, NULL, &err);

View solution in original post

0 Likes
7 Replies
binying
Challenger

Is the second device recognized using "clinfo"?

0 Likes

Yes. I have a function that pulls up all pertinent device info before I select which device to use. Both video cards give information back. Of course both are the same make and model so that information in more or less identical (I don't have my program in front of me at the moment so I can't confirm all this), so it's possible that it's showing me the same card twice. But I don't think that's that case.

0 Likes

could you post some sample code?

0 Likes

Not sure how exactly to post code but I've attached a simplified version of my code. I'm running the matrix multiplication sample kernel.

0 Likes

It is a very nice code, your problem is:


context = clCreateContext(properties, 1, devices, NULL, NULL, &err);

You are including only the 1st device in the context. You should have


context = clCreateContext(properties, num_devs_returned, devices, NULL, NULL, &err);

But just as a warning, if you create memory objects, they might get copied to all the devices in the context. So you might instead prefer

context = clCreateContext(properties, 1, &devices[device_used], NULL, NULL, &err);

0 Likes

Thanks! That did the trick.

0 Likes
nou
Exemplar

try run SimpleMultiDevice example program from SDK or any other program with -d N parameter. N is number which one device should be used. it start at 0.

0 Likes