Bug 5207005: Append pid in shmName for Linux only as this is for MIG scenario

This commit is contained in:
shawnz
2025-04-07 17:17:17 +08:00
parent ac700327a2
commit e77d6eb5ab
2 changed files with 20 additions and 6 deletions

View File

@@ -99,12 +99,15 @@ static void childProcess(int id)
std::vector<void *> ptrs;
std::vector<cudaEvent_t> events;
std::vector<char> verification_buffer(DATA_SIZE);
pid_t pid;
char pidString[20] = {0};
char lshmName[40] = {0};
// Use parent process ID to create a unique shared memory name for Linux multi-process
#ifdef __linux__
pid_t pid;
pid = getppid();
snprintf(pidString, sizeof(pidString), "%d", pid);
#endif
strcat(lshmName, shmName);
strcat(lshmName, pidString);
@@ -205,12 +208,15 @@ static void parentProcess(char *app)
std::vector<void *> ptrs;
std::vector<cudaEvent_t> events;
std::vector<Process> processes;
pid_t pid;
char pidString[20] = {0};
char lshmName[40] = {0};
// Use current process ID to create a unique shared memory name for Linux multi-process
#ifdef __linux__
pid_t pid;
pid = getpid();
snprintf(pidString, sizeof(pidString), "%d", pid);
#endif
strcat(lshmName, shmName);
strcat(lshmName, pidString);