TECHNOLOGY

Define an IPC event protocol between GPU worker processes

In this article
THE QUICK TAKE

Bind IPC event records and waits to explicit data generations, preserving exporter lifetime and a separate timing method.

A producer and consumer run in different GPU worker processes. They share a memory allocation, but the consumer sometimes reads the previous result because mapping memory did not establish when the new production completed. Use an explicit IPC event protocol with application-level generation ownership. A shared handle establishes access to a synchronization object, not the identity of the request being acknowledged.

Export a suitable event

The runtime requires an exportable event to be created with cudaEventInterprocess and cudaEventDisableTiming. Check creation, export and import statuses for the actual device and runtime environment. Transfer the portable IPC handle through an appropriate host control channel; a process-local cudaEvent_t value is not a portable cross-process reference.

Bind readiness to production

Record the event after the producer’s relevant writes in the intended stream. The consumer must wait on the record corresponding to its input generation before reading. An application control message should identify that generation and establish when its event record has been submitted. Passing a handle early does not make an unrecorded event represent a future production milestone.

Review reuse explicitly

CUDA event recording and stream waits have documented state-capture semantics. Re-recording a reusable event does not turn every existing waiter into a wait for an arbitrarily newer result. Define who may record, when the consumer acknowledges completion and when storage can be reused. Application sequence identifiers make that protocol reviewable; the opaque event handle is not a substitute for a request sequence.

Coordinate teardown

The event exporter must not destroy the original event while importers can still operate on it. Imported event resources also need the documented destruction path. Keep this coordination separate from the shared allocation’s mapping lifetime: an event can remain valid while the data is reused too early, or data can remain mapped after its synchronization object becomes invalid.

Measure a defined boundary

The required timing-disabled event supports synchronization rather than elapsed-time calculation. Use a separate justified timing method for handoff latency, preserving producer submission, completion and consumer readiness as different milestones. Test repeated generations with distinguishable outputs and delayed consumers. Acceptance proves the intended handoff protocol under those conditions, not a transport speed, universal IPC platform support or safe teardown after an unacknowledged worker failure.

Primary references

CUDA Runtime Device Management.

CUDA Runtime Event Management.

CUDA Interprocess Communication.

Related reading: CUDA IPC memory: sharing a handle requires a shared lifetime; CUDA event dependencies: connecting producer and consumer streams.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles