I am trying to run the simpleIPC examples from the cuda samples on my GTX 1080 on ubuntu 22.04 WSL and on windows 10.
If I run the simpleIPC with an argument (./simepleIPC 1) on WSL I get the error : code=709(cudaErrorContextIsDestroyed) "cudaStreamWaitEvent(stream, events[id], 0)"error.
On windows I get “Failed to create shared memory slab” error.
I have cuda 11.8 setup and could verify that the simple examples compile and run. From my understanding, if I want 2 or more processes to have a shared GPU memory IPC is the way to go for CUDA.
When I run the simpleIPC without passing any parameters it works as the parent process is called. If I pass it with an argument it fails.
Is my understanding of the example wrong? or how is this supposed to be run?
The sample is intended to be run without any command line arguments. The parent process calls the child process automatically. It’s not expected that you call the child process directly, and that won’t work.
The code calls itself to create the child process. That case needs to exist. It is for use by the code, not by you.
When you call the app with no arguments from the command line, the app launches the parent process, and the argument passed to the parent process is the name of the application:
int main(int argc, char **argv) {
#if defined(__arm__) || defined(__aarch64__)
printf("Not supported on ARM\n");
return EXIT_WAIVED;
#else
if (argc == 1) {
parentProcess(argv[0]);
^^^^^^^
The parent process takes the name of an application as its argument:
That spawnProcess command adds additional command line argument(s) when it invokes the app to launch the child process. As a result of these additional command line argument(s) this second invocation of the app runs as the child process: