Opencl / cpu. Check if OpenCL is available

I am working on a hybrid OpenCL application that at runtime should decide whether to use or not use the GPU implementation.

Is there a cross platform (i.e. for intel, nvidia, and ati) for the dermis, regardless of whether the computer running the application supports opencl framework support without application crashes? At first, I only develop the Windows platform.

#include <CL/cl.h>
#include <iostream>

int main() 
{
    std::cout << "Start cross paltform testing" << std::endl;
    cl_platform_id platform[1];
    clGetPlatformIDs(1, platform, 0);
    std::cout << "End cross paltform testing" << std::endl;
    return 0;
}

I am currently receiving an error message:

The application was unable to start correctly (0xc000007b)...

if I try to run it in the situation described above.

NB: , nvidia . oclDeviceQuery SDK nvidia GPU . "opencl.dll" Windows/System . , .

.

+3
1

OpenCL.dll , @talonmies ( , ) . .

, ​​ - ,

int main() 
{
    std::cout << "Start cross paltform testing" << std::endl;
    int num_platforms;
    cl_platform_id *platform;
    clGetPlatformIDs(0, NULL, &num_platforms);
    std::cout << "End cross paltform testing: " << num_platforms << " found" << std::endl;
    // Get platform IDs (not necessary right now, for future use)
    platform = new cl_platform_id[num_platforms];
    clGetPlatformIDs(num_platforms, platform, NULL);
    // ........
    delete platform;
    return 0;
}

, , OpenCL ​​

+3
source

All Articles