CUDA error for simpleIPC example (Windows and Ubuntu WSL)

Hi,

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?

Thank you

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.

IPC support on WSL requires a specific driver version or newer.

Hi @Robert_Crovella , thank you for the info. But the code example has a case for calling the child

  if (argc == 1) {
    parentProcess(argv[0]);
  } else {
    childProcess(atoi(argv[1]));
  }

If the example was intended to not call any child process, this case just shouldn’t exist right?

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:

static void parentProcess(char *app) {
                                ^^^

and uses that when it launches the child process:

 if (spawnProcess(&process, app, args)) {
                            ^^^

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:

  if (argc == 1) {
    parentProcess(argv[0]);
  } else {
    childProcess(atoi(argv[1]));
                      ^^^^

There is no intended usage except for you to launch the app from the command line, with no arguments:

./simpleIPC

any other usage is unintended and broken.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.