OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1719 Discussions

Unable to find Intel platform at runtime on Linux

robpieke
Beginner
809 Views
I'm struggling to get the 1.5 SDK working in Linux. I copied the code from the User's Guide (with a tiny fix - noted below). But when I execute the code, it only finds my NVIDIA card as a possible platform.

The Intel files are at least being polled, but somehow rejected.

How can I debug this further?

THE OUTPUT FROM 'strace -eopen':
...
open("/etc/OpenCL/vendors/", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3
open("/etc/OpenCL/vendors/nvidia.icd", O_RDONLY) = 4
open("/etc/ld.so.cache", O_RDONLY) = 5
open("/usr/lib64/libcuda.so", O_RDONLY) = 5
open("/usr/lib64/libz.so.1", O_RDONLY) = 5
open("/proc/stat", O_RDONLY) = 5
open("/dev/nvidiactl", O_RDWR) = 5
open("/dev/nvidia0", O_RDWR) = 6
open("/proc/interrupts", O_RDONLY) = 7
open("/dev/nvidia0", O_RDWR) = 7
open("/proc/interrupts", O_RDONLY) = 8
open("/dev/nvidia0", O_RDWR) = 8
open("/proc/interrupts", O_RDONLY) = 9
open("/etc/OpenCL/vendors/intelocl64.icd", O_RDONLY) = 4
open("/usr/lib64/OpenCL/vendors/intel/libintelocl.so", O_RDONLY) = 9
open("/usr/lib64/OpenCL/vendors/intel/tls/x86_64/libcl_logger.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/OpenCL/vendors/intel/tls/libcl_logger.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/OpenCL/vendors/intel/x86_64/libcl_logger.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/OpenCL/vendors/intel/libcl_logger.so", O_RDONLY) = 9
open("/usr/lib64/OpenCL/vendors/intel/libtask_executor.so", O_RDONLY) = 9
open("/usr/lib64/OpenCL/vendors/intel/libnuma.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 9
open("/usr/lib64/libnuma.so.1", O_RDONLY) = 9
open("/usr/lib64/OpenCL/vendors/intel/libtbb.so.2", O_RDONLY) = 9
open("/usr/lib64/OpenCL/vendors/intel/libtbbmalloc.so.2", O_RDONLY) = 9
open("/lib64/librt.so.1", O_RDONLY) = 9

FOUND A PLATFORM: NVIDIA Corporation



THE CODE:

[cpp]#include 
#include 

int main()
{
	cl_platform_id * platforms = NULL;
	char vendor_name[128] = {0};
	cl_uint num_platforms = 0;
	// get number of available platforms
	cl_int err = clGetPlatformIDs(0, NULL, & num_platforms);
	if (CL_SUCCESS != err)
	{
		// handle error
	}
	platforms = (cl_platform_id*)malloc(
				sizeof(cl_platform_id)* num_platforms);  // ***THE USER'S GUIDE PDF HAS A SLIGHT TYPO HERE***
	if (NULL == platforms)
	{
		// handle error
	}
	err = clGetPlatformIDs(num_platforms, platforms, NULL);
	if (CL_SUCCESS != err)
	{
		// handle error
	}
	for (cl_uint ui=0; ui< num_platforms; ++ui)
	{
		err = clGetPlatformInfo(platforms[ui],
					CL_PLATFORM_VENDOR,
					128 * sizeof(char),
					vendor_name,NULL);
		if (CL_SUCCESS != err)
		{
			// handle error
		}
		if (vendor_name != NULL)
		{
			{
				std::cout << "FOUND A PLATFORM: " << vendor_name << std::endl;
			}
		}
	}
	return 0;
}
[/cpp]
0 Kudos
7 Replies
Evgeny_F_Intel
Employee
809 Views
Please check the origination of libOpenCL.so.
Is it comes from NVidia or Intel? Which OCL version of the NVidia drivers do you have?

It's possiable that thereare compatability issues.
0 Kudos
robpieke
Beginner
809 Views
Hi Evgeny,

I've tried switching between the NVIDIA and Intel libOpenCL.so and issue occurs in both cases. When using the Intel version, I get two extra output lines from strace:

open("/sys/devices/system/node", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3
open("/sys/devices/system/node", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3

Dumping out more data about the identified NVIDIA platform:

CL_DEVICE_NAME: Quadro 4000
CL_DEVICE_VENDOR: NVIDIA Corporation
CL_DRIVER_VERSION: 275.28
CL_DEVICE_TYPE: CL_DEVICE_TYPE_GPU
...
clDeviceQuery, Platform Name = NVIDIA CUDA, Platform Version = OpenCL 1.0 CUDA 4.0.1, NumDevs = 1, Device = Quadro 4000

Thanks

- Rob
0 Kudos
Evgeny_F_Intel
Employee
809 Views
Which linux version are you using?

Please try to link directly with libintelocl.so.

Evgeny
0 Kudos
robpieke
Beginner
809 Views
Hi Evgeny,

I'm using Linux 2.6.18-238 CentOS release 5.5

Some progress here. Trying to directly link in the Intel libraries, I'm now getting:

/usr/lib64/OpenCL/vendors/intel/libintelocl.so:-1: error: undefined reference to `std::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long)@GLIBCXX_3.4.9'

/usr/lib64/OpenCL/vendors/intel/libintelocl.so:-1: error: undefined reference to `numa_node_to_cpus@libnuma_1.2'

/usr/lib64/OpenCL/vendors/intel/libintelocl.so:-1: error: undefined reference to `numa_max_node@libnuma_1.1'

I'm not sure what's triggering these last two, but I know the first one. If I go back to not linking in libintelocl.so and force my process at runtime to use a newer libstdc++.so (from GCC 4.3.5 instead of 4.1.2), then I now get both "NVIDIA" and "Intel" as identified platforms.

Next step: try an actual kernel. I'll post back and let you know if I have any success with this.

Cheers!

- Rob

0 Kudos
robpieke
Beginner
809 Views
Success! All CPU cores go to 100% and I get the same results as from my GPU.

Looks like it was as simple as libintelocl.so expecting a newer version of libstdc++
0 Kudos
Evgeny_F_Intel
Employee
809 Views
Hi Rob,

We support only gcc 4.3.x and up, supporting RH6 and SUSE11.1, older/other OS's currently are not supported.

I suggest youtotry upgradeto CentOS 6.0, although it's not officially supported.

Thanks,
Evgeny
0 Kudos
robpieke
Beginner
809 Views
Thanks Evgeny.

Unfortunately upgrading the OS isn't an option for me at the moment, so I'll have to fight my way forward in "unsupported mode".

Fortunately, as mentioned, switching to the gcc4.3 version of libstdc++ is doing the trick.

Cheers!

- Rob
0 Kudos
Reply