Because this is the computer I am using it has AMD, NVIDEA, and Intel platforms. How can I know which is the right platform to use on a users computer? What I have now is a loop that tries to create a platform, device, context, and queue for every platform. If it fails at any point it tries the next platform.
readKernel();
numPlatforms = getNumPlatforms(); TEST
platforms = getPlatforms(); TEST
for(int i = 0; i < numPlatforms; i++)
{
numDevices = getNumDevices(platforms[i]); TEST_AND_CONTINUE
devices = getDevices(platforms[i], numDevices); TEST_AND_CONTINUE
context = createContext(platforms[i], devices); TEST_AND_CONTINUE
queue = getCommandQueue(context, devices[0]); TEST_AND_CONTINUE
// all setup. can post info here -> getDeviceInfo(devices[0]);
break;
}
program = createProgram(context, source); TEST
buildProgram(program); TEST
kernel = buildKernel(program, appName); TEST
Is that a good way to do it or is there a better way?