Thursday, October 8, 2009

OpenCL is for Everyone!

Last night I had a terrible nightmare, where all the apple/mac bloggers says "This app cannot be use used with older macs because it uses OpenCL, so you need the newest NVidia…"

..Fortunately, was just a nightmare. Everyone can use OpenCL, old macs (as my macbook) cannot use GPU, and cannot run faster, but OpenCL code can run on every machine.

You (as developer) need just to keep in mind to get Device in this way. So, if you haven't the latest NVidia you can still use, as always, CPU.


err = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, 1, &device_id, NULL);
if (err != CL_SUCCESS)
  err = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_CPU, 1, &device_id, NULL);

No comments:

Post a Comment