cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

AptypR
Journeyman III

--device cpu

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??

0 Likes
6 Replies
omkaranathan
Adept I

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.

0 Likes

I haven't any GPU on my laptop,and CPU is Intel Core 2 Duo.And trying examples under Ubuntu 10.04 LTS.

0 Likes
genaganna
Journeyman III

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;
    }

0 Likes

Well,it's better than run programs with "--device cpu".

but isn't it a bug?

i thought opencl useheterogeneous systems(

0 Likes

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.

 

0 Likes

IMHO solution for this is make examples fall back to CPU device if they can't create GPU context.

0 Likes