does not compile (GPU does not resolve to a variable). I tried several other variants but I get (other) compiler errors as well. I import the necessary packages (opencl.* and opencl.util.*). Any ideas what I am doing wrong?
Thanks for your reply. I am running Eclipse and I installed the libraries according the Eclipse IDE User Library instructions. I got the jogamp jocl HelloWorld example which I got up and running. inserted the following statements in the HelloWorls example:
The statement with platform1 complains about GPU cannot be resolved to a variable
The statement with platform2: the method getDefaiut (Filter<CLPlatform> ...) in the type CLPlatform is not applicable for the argument (Filter<CLDevice>)
platform3: Filter, CLDevice and GPU cannot be resolved as a variable
The last 2 examples are suggested reading the javadocs. Are these two imports sufficient?
It was a matter of imports indeed. Thanks for your help!
Results are interesting. I use a slightly adapted version of platformTest:
public void platformTest ()
final CLPlatform platformGPU = CLPlatform.getDefault(version(CL_1_0), type(GPU));
final CLPlatform platformCPU = CLPlatform.getDefault(version(CL_1_0), type(CPU));
if (platformGPU != null && platformGPU.listCLDevices(GPU).length > 0)
System.out.println (platformGPU.listCLDevices(GPU).length + " OpenCL GPU platform(s) present");
} // if
if (platformCPU != null && platformCPU.listCLDevices(CPU).length > 0);
System.out.println (platformCPU.listCLDevices(CPU).length + " OpenCL CPU platform(s) present");
} // if
} /*** platformTest ***/
1 OpenCL GPU platform(s) present
1 OpenCL CPU platform(s) present
However, when in the same program 'enumerating' thru all platforms and for each platform thru all devices I get 2 CPU platforms:
I have 2 exactly the same CPU platforms present. CLPlatform.getDefault(version(CL_1_0), type(CPU)) does not see that. The AMD drivers have the tendency to act as drivers for the Intel CPU's as well. And they are not so performant as the Intel drivers. In the benchmark they are about 3.5 as slow for complex tasks compared to the Intel drivers.
Glad it's working now! The behavior you describe is normal -- CLPlatform.getDefault() returns the default platform, not all of them :) Iterating through them will always be more thorough and informative.