Nvidia MPS and inter-kernel communication

Hello, I am using Nvidia MPS that I need to run two CUDA file at the same time.

One of the CUDA file is to receive packet from NIC and do some computing, the other CUDA file I add in MPS is that I want to do other computing from No.1 CUDA file packet.

So here comes the question. How No.2 CUDA file can get the packet of No.1 CUDA file? And how to communicate between two file? (MPS or CUDA function?)

P.S. if my question is too wired, here is a simple example.
Here is a packet, content is that A=5, B=3.
I want to do:
No.1 CUDA file needs to receive the packet and do A+B
No.2 CUDA file needs to do A*B (so the problem is that how No.2 CUDA file get the packet from No.1)

Thanks.

study the cuda IPC functionality and sample code

https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#interprocess-communication

https://docs.nvidia.com/cuda/cuda-samples/index.html#simpleipc

You’ll need a way to communicate the memory handle from one process to the other. The simplIPC code demonstrates a method using ordinary host IPC (shared memory) to do this.