Pregunta

In my computer with Windows 7 OS I have three versions of OpenCL SDKS's from this vendors:

  • Intel
  • NVIDIA
  • AMD.

I build my application with each of them. As the output I have three different binaries. For example: my_app_intel_x86, my_app_amd_x86, my_app_nvidia_x86

This binaries are different on this:

  1. They use different SDK's in likange process
  2. They try to find different OpenCL platform name in runtime

Can I use only one SDK and check platform on running time?

¿Fue útil?

Solución

SDK's give debuggings tools, a platform, and possibly extensions, the OpenCL API remains the same regardless. You can link to any SDK you want, and it'll produce an executable compatible with any OpenCL runtimes you can find. Remember those are SDK's, meant for the developer - the end-user will probably only have his graphics driver (OpenCL-enabled) which doesn't care what SDK you used to build the software.

Ideally you should use a default platform for your program, but let the user override it (you can select various platforms at runtime!). You can also use heuristics to figure out which device is the fastest, e.g.:

  • iterate over each available platform
  • for each platform, iterate over each device
  • benchmark this device somehow in a relevant way
  • select the fastest one

Also, if you are using specific extensions, make sure to only accept devices which support them...

Can I use only one SDK and check platform on running time?

Yes, you absolutely can and should do that, but I am worried about what you mean by "check platform" - as I stated above, the SDK bears absolutely no influence on the platforms you can run your built program on. I can build my code with the AMD SDK, and run the executable on a system with an nVidia graphics card or an Intel processor just fine (the only difference is that I may not have access to AMD-specific extensions which will be provided by my SDK, but the extensions will be recognized by an AMD driver, so you don't even need the SDK installed to run the code - but you will to build it though).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top