I started recently with OpenCL and ARM (Particularly I'm using an Odroid U3, which has a Cortex A-9 and a Mali-400). First thing I did is an example project with some test cases. The first case get information about the retrieved "devices" with the library. The code is simple:
int dev; cl_platform_id platform; cl_device_type devs[NDEVS] = { CL_DEVICE_TYPE_CPU, CL_DEVICE_TYPE_GPU }; // get Platform clGetPlatformIDs(1, &platform, NULL); // For every device: for (dev = 0; dev < NDEVS; dev++){ cl_device_id device; // Find device clGetDeviceIDs(platform, devs[dev], 1, &device, NULL); char vendor[1024]; char deviceName[1024]; cl_bool isAvailble = false; char devicePlatform[1024]; clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(deviceName), deviceName, NULL); clGetDeviceInfo(device, CL_DEVICE_VENDOR, sizeof(vendor), vendor, NULL); clGetDeviceInfo(device, CL_DEVICE_AVAILABLE, sizeof(isAvailble), &isAvailble, NULL); clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(devicePlatform), devicePlatform, NULL); std::cout << "---------------------------------------------------------------------------" << std::endl; std::cout << "Device type is " << (dev ? "GPU" : "CPU") << " with ID: " << device << "and " << (isAvailble ? "is " : "isn't ") << "available." << std::endl; std::cout << "Device's platform is " << devicePlatform << std::endl; std::cout << "Vendor is " << vendor << std::endl; std::cout << "Device's name is " << deviceName << std::endl; std::cout << "---------------------------------------------------------------------------" << std::endl; }
It gets a CPU device and a GPU device and extract some information about it. I tested it on my PC and got it's information:
--------------------------------------------------------------------------- Device type is CPU with ID: 02AAB628and is available. Device's platform is ¶ñØ► Vendor is GenuineIntel Device's name is Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz --------------------------------------------------------------------------- --------------------------------------------------------------------------- Device type is GPU with ID: 007266F0and is available. Device's platform is ¶ñØ► Vendor is Advanced Micro Devices, Inc. Device's name is Turks ---------------------------------------------------------------------------
But when I use this code on the Odroid U3 I got:
--------------------------------------------------------------------------- Device type is CPU with ID: 0x3b9cand isn't available. Device's platform is Y0ý¶ Vendor is ¨; Device's name is ∟ --------------------------------------------------------------------------- --------------------------------------------------------------------------- Device type is GPU with ID: 0x3b9cand isn't available. Device's platform is Y0ý¶ Vendor is ¨; Device's name is ∟ ---------------------------------------------------------------------------
I don't know why, the system tells me that devices are unavailable and could not retrieve either vendor's, platform's or device's names.
Can anybody help me?
Thanks in advance,
Pablo R.S.
Hi Pablo,
Can I ask where you acquired OpenCL libs for this board? Are they perhaps intended for the XU3 family of boards?
Thanks,
Chris
I got OpenCL from here: Mali OpenCL SDK - Mali Developer Center Mali Developer Center. I thought that has compatibility with Mali-400 but as Michael says, not.
Ahh, were you linking at runtime against the libOpenCl.so provided in the SDK? This is not a real implementation, it just exposes the symbols for the purposes of cross-compiling an application. A real implementation is needed on the target device. Sorry for any confusion!