How to convert single-GPU code to double-GPU ?

Hi,

I am very new to CUDA programming. I have an opensource code, DualSPHysics, which can run only on single-GPU. DualSPHysics is written in C++ and the CPU version can run only on single-node (OpenMP) and the GPU version only on single-GPU (CUDA). But, the node I use for computing has two GPU cards (K20’s).

I want to convert this DualSPHysics code to run on the two GPU’s. Please enlighten me on what should I do to make this happen.

Thank you very much,

Best regards,
Sunil

Hello,

You can run 1 program with 2 cards, by using cudasetdevice and manually divide the work between the gpus using streams.

Cristian

Hi Cristian,

Thank you very much for your reply.

Can you please point me to some online material which explains with examples how I can “manually divide the work between the gpus using streams” ?

Best Regards,
Sunil

Hello,

I would suggest to read the book CUDA by Example https://developer.nvidia.com/content/cuda-example-introduction-general-purpose-gpu-programming-0

There are also good articles about streams on the nvidia Parallel for all blog. http://devblogs.nvidia.com/parallelforall/?s=streams&submit=Search

The basic ideea is to divide the work in 2 equal parts (if the cards are identical) have them perform the calcuations, then collect the data. The biggest problem is the communication between the cards.

Maybe this will help:

http://users.wfu.edu/choss/CUDA/docs/Lecture%2013.pdf