Running with AMD's OpenCL SDK on NVIDIA's device

Hello,

I tried the first sample from the book “OpenCL in action” by Matthew Scarpino.
The code finds the devices installed and runs a matrix multiplication (4x4 * 4x1)

The device I have is NVIDIA’s “GeForce 9400 GT”. I know it from: clGetDeviceInfo
The platform I have is: NVIDIA corperation. I know it from clGetPlatformInfo

But currently I’m using AMD’s SDK.

And it works !

  1. How it is possible ?

  2. Will I get better performance if I used NVIDIA’s SDK ?

Thanks,
Zvika

Hi Zvika,

  1. The OpenCL implementation for NVIDIA’s GPUs is packaged with their driver. Therefore, if you have the driver installed (which I assume you do), then you will be able to run OpenCL applications on NVIDIA devices. The SDK just contains the headers required to build an OpenCL application, which are the same as the headers available on the main Khronos website. Which SDK you have installed has no impact on which OpenCL devices your application can use.

  2. No: as per the above, you are still using NVIDIA’s OpenCL implementation, the SDK doesn’t make a difference.

Hope that helps,

James

[QUOTE=jprice;29810]Hi Zvika,

  1. The OpenCL implementation for NVIDIA’s GPUs is packaged with their driver. Therefore, if you have the driver installed (which I assume you do), then you will be able to run OpenCL applications on NVIDIA devices. The SDK just contains the headers required to build an OpenCL application, which are the same as the headers available on the main Khronos website. Which SDK you have installed has no impact on which OpenCL devices your application can use.

  2. No: as per the above, you are still using NVIDIA’s OpenCL implementation, the SDK doesn’t make a difference.

Hope that helps,

James[/QUOTE]

Hi James,

Your help is highly appreciated.

Thanks,
Zvika

Hi James,

Would it also be possible to use AMD’s SDK to compile OpenCL 1.2 code and run it on Nvidia chips? I am about to buy a laptop with GeForce GT 620m and I understand that OpenCL 1.2 is not supported for this card through Nvidia’s drivers. May be through LLVM?

Thanks in advance,
Nikki

Hi Nikki,

At present, the intermediate representations used by these vendors are not compatible. AMD’s compiler will generate AMD IL, where as NVIDIA’s implementation generates and consumes PTX. Even if you hand write PTX that uses OpenCL 1.2 features, NVIDIA’s OpenCL implementation may still reject the program (I’ve unsuccessfully tried this with printf, for example).

So I’m afraid there really is no way to use features from the OpenCL 1.2 C language that aren’t present in OpenCL 1.1 when targeting NVIDIA devices, unless NVIDIA release an implementation for 1.2.

James

Thanks a lot for your explanation James!

What would you suggest I do? I am a newbie to these technologies and I am planning to learn both CUDA and OpenCL. But as I see it, I think OpenCL is the future. So in the long term I want to focus more on OpenCL. What kind of GPU/CPU/APU do you think I should buy so that I can continue to learn OpenCL 2.0 eventually. As I am planning to use this Laptop for many years to come. I am on a shoestring budget :frowning:

Thanks again,
Nikki

Hi Nikki,

If you just want to be able to develop/run OpenCL code (and aren’t too concerned about performance), then almost anything will do since OpenCL will run perfectly well on the CPU. If your laptop has an integrated GPU (like an Intel HDx000, or an AMD APU), then even better - you’ll have full OpenCL support on that as well. With the exception of NVIDIA, every device vendor is already fully behind OpenCL, and so you can be almost certain that you’ll get OpenCL 2.0 implementations from them at some point in the not-too-distant future. My own opinion is that NVIDIA will come around at some point too, it’s just more a question of when.

Of course, if you want to use it for CUDA as well, you’ll need something with an NVIDIA GPU. NVIDIA’s OpenCL implementation is still fairly good (considering it’s now several years old), so if you’re happy to stick with OpenCL 1.1 and hope for an update then this may work for you (and you’ll still have the CPU in the meantime).

I’m afraid there isn’t really a specific recommendation in there, but that’s as close to an unbiased opinion that I can manage!

Hope that helps,

James

Thanks for the quick reply James!!
Yes, at the moment I am not concerned too much about performance. I just want to learn these technologies.
Hey, if I can run OpenCL on the CPU/APU that’s great news!! I think I will look for a laptop with HDx000/APU plus an NVIDIA GPU. That solves my problem!! You’ve been a big help!!

Thanks again,
Nikki