OpenCL on Nvidia Tesla: No Platforms Found

I have access to a system running Debian 7 with two Nvidia Tesla cards installed. I would like to benchmark using OpenCL. However, OpenCL cannot find compatible platforms. Do I need additional libraries or special drivers for working with OpenCL?

Here is an example of code that shows that no platforms were found:

#include <stdio.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif

int main() {

    int i, j;
    char* info;
    size_t infoSize;
    cl_uint platformCount;
    cl_platform_id *platforms;
    const char* attributeNames[5] = { "Name", "Vendor",
        "Version", "Profile", "Extensions" };
    const cl_platform_info attributeTypes[5] = { CL_PLATFORM_NAME, CL_PLATFORM_VENDOR,
        CL_PLATFORM_VERSION, CL_PLATFORM_PROFILE, CL_PLATFORM_EXTENSIONS };
    const int attributeCount = sizeof(attributeNames) / sizeof(char*);

    // get platform count
    clGetPlatformIDs(5, NULL, &platformCount);

    // get all platforms
    platforms = (cl_platform_id*) malloc(sizeof(cl_platform_id) * platformCount);
    clGetPlatformIDs(platformCount, platforms, NULL);

    printf("Platform count: %d\n",platformCount);

    // for each platform print all attributes
    for (i = 0; i < platformCount; i++) {

        printf("n %d. Platform n", i+1);

        for (j = 0; j < attributeCount; j++) {

            // get platform attribute value size
            clGetPlatformInfo(platforms[i], attributeTypes[j], 0, NULL, &infoSize);
            info = (char*) malloc(infoSize);

            // get platform attribute value
            clGetPlatformInfo(platforms[i], attributeTypes[j], infoSize, info, NULL);

            printf("  %d.%d %-11s: %sn", i+1, j+1, attributeNames[j], info);
            free(info);

        }

        printf("n");

    }

    free(platforms);
    return 0;

}

And the command I used to compile the code:

gcc platforms.c -lOpenCL

If I run the code, the output will be as follows:

Platform count: 0
+4
source share
1 answer

, 64- ICD. ICD 64 32 , 64 , 32- ICD .

ICD ICD, clGetPlatformIDs -1001 :

Returned by clGetPlatformIDs when no platforms are found

    CL_PLATFORM_NOT_FOUND_KHR            -1001

nVIDIA , , 64 , 32- OpenCL- . ICD - , .

" " (32/64 ), .

+2

Source: https://habr.com/ru/post/1606917/


All Articles