cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Studer
Journeyman III

OpenCL programming on CPU and GPU with Nvidia cards on Ubuntu 10.10 ?

Hi,

I have a bi Xeon machine with Ubuntu 10.10 and a Nvidia GTX 480 graphic card on it and I'd like to use OpenCL on the CPU and the GPU.

I installed the latest Nvidia driver (nvidia-current) with apt-get and I downloaded and installed the latest CUDA Toolkit (3.2) from the Nvidia page.

BUT this allows me only to run OpenCL code on the Nvidia GPU and NOT on the CPU.

I then read some articles on the internet saying that the ATI SDK is able to run OpenCL code on the CPU.

I installed the latest version of ATI drivers then tried to compile the SDK.

I was then able to run code on the CPU but not on the GPU anymore.


Is there any way to run OpenCL code both on the Nvidia GPU and the Xeon CPU ?

0 Likes
7 Replies
dmeiser
Elite

If you have both the CUDA SDK and the OpenCL stream sdk installed you should be able to see two platforms when you query the platforms in opencl. You should be able to use both platforms at the same time. What does clGetPlatformIDs return?

 

Cheers,

Dominic

0 Likes
nou
Exemplar

what is output from CLInfo from SDK examples? maybe now you get two platforms one with Xeon CPU and second with nVidia GPU and you use just first one.

0 Likes

I don't think you will be able to use NV GPU as a device from ATI Stream SDK.

clInfo should report both the platforms but creating context will give error.

NV hardware requires CUDA back-end to generate ISAs but Stream SDK will generate AMD-IL which is used to generate ISA in ATI GPUs.

0 Likes

you can't use INTEL CPU + NVIDIA GPU in one single platform simply because they will not be detected in the same platform (at least it is how it is for me when I try using AMD CPU + NVIDIA GPU, albeit I'd wish to have all devices on one single platform). You will probably have to use both platforms to be able to use all devices. It's kind what I'm doing by now, read both platform infos and create one context for each platform with the respective devices. I'm using AMD SDK to get both platforms working and compile code, despite I did install the NVIDIA SKD (i think it is necessary anyways, because the hardware need the dev drivers to recognize opencl api, but don't take my word for this, I've never tried it without instaling nvidia SDK). As of now, I have 2 platforms, then 2 contexts (one for each platform) and 2 devices, one per context (CPU in one, GPU in the other). I do also have one CommandQueu per device. I think you will be able to have 2 devices in one context (both CPUs) and one in the other (GPU). To share data, what i'm doing is blocking reads (CL_TRUE for the blocking_read flag of clEnqueueReadBuffer) from buffer objects in GPU using GPU commandqueu (if I use CPU commandqueu I get an access violation error) and I create my buffers for CPU kernels using the CL_MEM_USE_HOST_PTR flag pointing to the RAM pointer just created for the clEnqueueReadBuffer operation (I don't use any synch whatsoever like clFinish or clWaitEvent since clEnqueueReadBuffer is a blocking operation and I have the commandqueu executing in order, as by default).

Hope it helps.

0 Likes

laobrasuca

Thanks for sharing your experience in that much detail.

you are able to use NV GPU + AMD CPU in same program using different contexts. But AFAIK, i think NV GPU requires NV SDK's implementation of OpenCL APIs so the code can be correctly mapped to CUDA-back-end. And AMD CPU requires AMD's implementation for mapping it to AMD-IL. So how is this mapping possible without any conflicts.

Please correct me if i am wrong somewhere.

0 Likes

I'm not very expert on how things are done underneath the keyboard, but the few acknowledge I have on this let me presume that  that AMD compiler don't speak NVIDIA device's language, reason why I agree with you to say that both SDK are needed. However, since both AMD/INTEL CPUs share the same x86/x64 set of instructions (till a given level) it could occur that one wouldn't necessarily need the intel SDK to use it as an OpenCL device (can you (un)confirm?).

As things are buy now, you guys have the best platform for parallel computing (with general devices), from the hardware perspective, as you have both CPU and GPU. A little 4P Interlagos + 4 HD6990 in a single machine is (well, will be) the king of TFLOP/watt/dollar, just need the drivers to ensure that everything runs fine. Still, I'd like to ask, will we see someday all different vendor's devices in one single opencl platform, or it is just impossible as per OpenCL specifications?

0 Likes

now to use AMD+nVidia GPU it should install drivers alone. SDKs are necesery only for OpenCL application developing. and currently for CPU only device.

AMD implementation is compatible with intel CPU because it have compatible instruction set. on the other hand intels's alpha OpenCL need SSE4.1 which currently do not support any AMD CPU. so it is not (most likely) possible run Intel OpenCL on AMD CPU.

Hve different vendors dwevice under one platform is theoreticaly possible. i can even imagine have multiple devices from multiple PC connected via ethernet as one platform.

0 Likes