Using OpenCL and embree simultaneously

237 views Asked by At

I want to use the intel library embree in combination with OpenCL but it doesn't work for me. To show you the problem I created a small code to get all OpenCL devices:

#include <stdio.h>
#include <stdlib.h>
#include <CL/cl.h>

int main() { 
    int i, j;
    char* value;
    size_t valueSize;
    cl_uint platformCount;
    cl_platform_id* platforms;
    cl_uint deviceCount;
    cl_device_id* devices;
    cl_uint maxComputeUnits;

    // get all platforms
    clGetPlatformIDs(0, NULL, &platformCount);
    platforms = (cl_platform_id*) malloc(sizeof(cl_platform_id) * platformCount);
    clGetPlatformIDs(platformCount, platforms, NULL);
    printf("Found PLatform :%i\n",platformCount);
    for (i = 0; i < platformCount; i++) {

        // get all devices
        clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, 0, NULL, &deviceCount);
        devices = (cl_device_id*) malloc(sizeof(cl_device_id) * deviceCount);
        clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, deviceCount, devices, NULL);

        // for each device print critical attributes
        for (j = 0; j < deviceCount; j++) {

            // print device name
            clGetDeviceInfo(devices[j], CL_DEVICE_NAME, 0, NULL, &valueSize);
            value = (char*) malloc(valueSize);
            clGetDeviceInfo(devices[j], CL_DEVICE_NAME, valueSize, value, NULL);
            printf("%i.%i Device: %sn\n", i+1,j+1, value);
            free(value);
        } 
        free(devices); 
    } 
    free(platforms);
    return 0;
}

If i compile this code with:

g++ --std=c++11 -march=native -o test test.c -lOpenCL

I get the following output:

Found PLatform :2
1.1 Device: GeForce GTX 670n
2.1 Device: Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHzn

If I compile the same code with:

g++ --std=c++11 -march=native -o test test.c -lOpenCL -l:libembree.so.2

I cant find my CPU anymore as an available OpenCL device, as I get the following ouput:

Found PLatform :1
1.1 Device: GeForce GTX 670n

Can anyone help me to get my CPU again as an OpenCL device?

1

There are 1 answers

0
Chris On BEST ANSWER

I found the solution for this problem:

The program was linked against a symlink and not the real library path. By linking against the real library path the problem is solved, using LD_LIBRARY_PATH.