Interprocessor sharing of device memory

Is there a way in OpenACC to share device memory pointers between two different processes in Windows?

One process is creating buffers of data, and I have an API using CreateFileMapping/OpenFileMapping/MapViewOfFile for sharing data. But these buffers are quite large and would rather copy them directly into device memory in process1 so process2 can work with them. There is no data to return.

I saw the cudaIpcGetMemHandle/cudaIpcOpenMemHandle, but these are listed as only being supported for linux.

Hi GaryT58,

This is actually what the “acc_map_data” API is designed for. The idea being that you call “acc_deviceptr” from on process to get the device address, pass the address to another process (via Sockets, shared memory, or MPI), and then associate or “map” this address to a host pointer in the second process.

Also since you’d just be passing an address around, I doubt there’d be any OS specific issues.

I unfortunately don’t have an example of this since I haven’t tried it myself, but in theory it shouldn’t be difficult.

  • Mat

Hi mcklog,

Unfortunately that will not work. I have tried the following already:

In process1:
pass the device address via mapped memory to process 2

In process 2:
try using this passed device address in acc_memcpy_to_device and it fails.

The device memory pointer is local to a process, just like host memory pointers. I verified this by performing a acc_malloc in each process, and they have the same device address even though they point to different areas on the GPU.

Reading the CUDA docs, the cudaIpcGetMemHandle will actually return the memory handle associated with the device address which can be passed to another process to use the cudaIpcOpenMemHandle with the handle. However, it is listed as being only supported under Linux.

I was hoping I was missing something.