OpenCL - runs ok except the first calls to clGetPlatformIDs

Hello All,

I have code, multi-threaded, each thread using GPUs:
it loops over:

  • get data
  • spawn : each thread treat data, running 2 subtasks on GPUs,
  • join.
    It works fine, and I get good performance.

Except that the firsts calls to clGetPlatformIDs returns -1001, the code having an alternative code running on CPUs, it executes the first subtasks on CPUs, which increase the overall elapse time.

Any idea why ?

Thanks

Claude

Is this in Linux? Try enabling persistance mode via nvidia-smi if so.

This error is often associated with OpenCL not finding the correct library in Linux:
http://stackoverflow.com/questions/20335579/error-clgetplatformids-1001-when-running-opencl-code-linux

Hello,

Yes this is Linux. No problem with library.

I have the same problem with Xeon Phi, I finally solved it by making one call
to clGetPlatformIDs, at the beginning of the main, before starting the threads,
which then redo it without error.

Looks like it needs a “wake up”.

Claude