2

I am trying to understand interprocess communication in CUDA. I would like some help with being able to understand this concept and trying to apply this to a project I am doing.

I have a image acquisition system that provides N number of input images. Each raw input image is first processed and then, stored in a single variable called 'Result'. There are four functions which do the processing of the image, Aprocess, Bprocess, Cprocess and Dprocess. Each time a new image is acquired by the system, the four functions mentioned above are called to do the processing. The final image 'Result' is stored in Dprocess.

What I would like to do is: Create a new process, 'process2', where I can hand off one (final) image stored in 'Result', each time that image is obtained, and put it in a buffer called 'Images'. I would like to do this for 10 images. 'process2' should wait for a new image to be passed to it and not terminate because the first process has to keep calling the four functions and get a final processed image.

What I have come across so far: cudaIpcGetMemHandle, cudaIpcOpenMemHandle and cudaIpcCloseMemHandle

Question: How do I use the above function names to achieve IPC?

Eagle
  • 1,187
  • 5
  • 22
  • 40
  • And what is your question, exactly? – talonmies Nov 06 '13 at 18:01
  • Oh, sorry about that. I had not finished writing it before I posted my question. – Eagle Nov 06 '13 at 18:08
  • 1
    @Tejas Are you sure you actually need multiple OS processes? Unless you intend for some of the downstream processes to run as services, with multiple instances of upstream processes (e.g. client apps), the same result can be achieved with multiple threads in a single process. Alternatively, unless you're CPU limited (unlikely when using CUDA effectively), a single-threaded process should be equally suitable. – MooseBoys Nov 06 '13 at 18:26
  • 1
    `the same result can be achieved with multiple threads in a single process` Could you please elaborate what you mean by that? – Eagle Nov 06 '13 at 22:31

1 Answers1

4

Question: How do I use the above function names to achieve IPC?

The CUDA simpleIPC sample code demonstrates that.

There is also a brief mention of how to use CUDA IPC API in the programming guide.

Finally, the API itself is documented in the runtime API reference manual

Note that this functionality requires cc 2.0 or higher, and a 64-bit Linux OS.

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
  • I am not using 64-bit Linux OS and I am limited to using only the 64-bit Windows OS. Is there any other way that I can go about implementing this? – Eagle Nov 06 '13 at 22:22
  • 1
    I imagine there are many ways to handle things concurrently in a computer. I was responding to your question about the cudaIPC API. As indicated in the comments, you might consider a multithreaded program instead. [Windows multithreading](http://stackoverflow.com/questions/8446757/how-can-i-create-a-multithread-in-c-for-windows) for example. – Robert Crovella Nov 06 '13 at 23:22