Tomorrow I founded out that almost all samples didn't work.they quit with
"Error: clCreateContextFromType failed. Error code : CL_DEVICE_NOT_FOUND",even if CLInfo and HelloCL works properly.
After googling I tried to use --device cpu and it worked.
Can I set some variable or something not to use "--device cpu" all the time I run opencl applications??
You need to have a supported GPU and drivers to get the samples working on GPU. Which GPU are you having? Have you insatalled latest drivers?
The samples other than CLInfo and HelloCL run on GPU by default.
I haven't any GPU on my laptop,and CPU is Intel Core 2 Duo.And trying examples under Ubuntu 10.04 LTS.
Originally posted by: AptypRCan I set some variable or something not to use "--device cpu" all the time I run opencl applications??
Only one way to do this. You need to change each sample to run by default on CPU.
This is what is now in each sample
------------------------------------------------
if(deviceType.compare("cpu") == 0)
{
dType = CL_DEVICE_TYPE_CPU;
}
else //deviceType = "gpu"
{
dType = CL_DEVICE_TYPE_GPU;
}
Modify as follows
----------------------------------------------
if(deviceType.compare("gpu") == 0)
{
dType = CL_DEVICE_TYPE_GPU;
}
else //deviceType = "cpu"
{
dType = CL_DEVICE_TYPE_CPU;
}
Well,it's better than run programs with "--device cpu".
but isn't it a bug?
i thought opencl useheterogeneous systems(
Originally posted by: AptypR Well,it's better than run programs with "--device cpu".
but isn't it a bug?
It is not a bug. Samples are selecting by default GPU as device.
i thought opencl useheterogeneous systems(
You are right OpenCL designed such way that user can use heterogeneous devices.
IMHO solution for this is make examples fall back to CPU device if they can't create GPU context.