i"m using DGXA100 and I made two processes (P0, P1).
My work step is like below.
Make two parameters (par0 on GPU0, par1 on GPU1) In P0.
Write custom data on par0.
CudaMemcpy(par0 → par1)
Read par1 in P1 to use custom data.
In this work, i have some idea like below but it make errors.
Using shared memory : P0 send pointer of par1 to P1. and P1 read par1 with the pointer ===> I think this will make an error : “segmentation fault(core dumped)”
To share device memory pointers and events across processes, an application must use the Inter Process Communication API, which is described in detail in the reference manual. The IPC API is only supported for 64-bit processes on Linux and for devices of compute capability 2.0 and higher. Note that the IPC API is not supported for cudaMallocManaged allocations.
Using this API, an application can get the IPC handle for a given device memory pointer using cudaIpcGetMemHandle(), pass it to another process using standard IPC mechanisms (for example, interprocess shared memory or files), and use cudaIpcOpenMemHandle() to retrieve a device pointer from the IPC handle that is a valid pointer within this other process. Event handles can be shared using similar entry points.
i did execute file(simpleIPC) with the command “make”
and i do not have any idea to test this. can you check below?
lignex1-HP-ZCentral-4R-Workstation:~/Desktop/User/docker/cuda-samples/Samples/0_Introduction/simpleIPC$ ./simpleIPC
Process 0: Starting on device 0…
Step 0 done
Process 0: verifying…
Process 0 complete!
lignex1@lignex1-HP-ZCentral-4R-Workstation:~/Desktop/User/docker/cuda-samples/Samples/0_Introduction/simpleIPC$ ./simpleIPC 0
Process 0: Starting on device 0…
CUDA error at simpleIPC.cu:123 code=400(cudaErrorInvalidResourceHandle) “cudaIpcOpenMemHandle(&ptr, *(cudaIpcMemHandle_t *)&shm->memHandle[i], cudaIpcMemLazyEnablePeerAccess)”
when i used command “./simpleIPC” it does not make error.
but when i used “./simpleIPC 0” it makes error
the program itself is not intended to be launched by the user with a command-line parameter. It launches a separate process and passes a command line parameter to that separate process when it does so.
Do you know if my work is possible with the example simpleIPC ?
Make parameter0(30~40GB) on GPU0 In Process0.
Send pointer of parameter0 to Process1 from Process1.
Read parameter0 in Process1 via received pointer.
I want to share large data on GPU memory between processes or containers(docker).
I can not find code where memory malloc on GPU and where i can send pointer in simpleIPC. I think 270 line “checkCudaErrors(cudaMalloc(&ptr, DATA_SIZE));” here i am looking for…
If your are able to exchange data between the processes, it should work.
The sample code uses linux shared memory to communicate the IPC handles.
Line 270 allocates the buffer. (It is the only cudaMalloc call in the code)