0

I installed ArrayFire successfully, and the example helloworld works fine when I choose the Visual Studio configuration CUDA_x64. However when I change to OpenCL_x64, the compilation is successful, but I get the running error as below:

/*********************************************************************/

ArrayFire Exception (Internal error:998):
In function __cdecl opencl::DeviceManager::DeviceManager(void)
In file src\backend\opencl\platform.cpp:329
OpenCL Error (-2): Device Not Available when calling clCreateContext

In function void __cdecl af::setDevice(const int)
In file src\api\cpp\device.cpp:91

/*********************************************************************/

Any answers will be appreciated. Thanks in advance.

yinhao
  • 101
  • 1
  • 6

1 Answers1

0

-2 is CL_DEVICE_NOT_AVAILABLE which occurs "if a device in devices is currently not available even though the device was returned by clGetDeviceIDs". You can Google for the name of the error and find a number of web pages which describe cases where this can happen; two common ones are using the Intel CPU driver on an older chip (The latest Intel OpenCL SDK requires SSE 4.2), or requesting OpenCL/OpenGL interop when it is not available.

Dithermaster
  • 6,223
  • 1
  • 12
  • 20
  • My PC has two platforms for OpenCL, one is Intel the other is NVIDIA. For OpenCL the devices can be queried on a specific platform. However ArrayFire does not provide us the API to set the platform. When I invoke both of the af::getDevice() and af::devicecount(), the program throws exceptions. – yinhao Jun 08 '16 at 00:22
  • Then create it manually, and set it to ArrayFire, it has the functionality to do so: http://arrayfire.org/docs/group__opencl__mat.htm#ga49f596a4041fb757f1f5a75999cf8858 – DarkZeros Jun 08 '16 at 09:30