mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2025-07-01 20:20:29 +08:00
Bug 5207005: Append pid in shmName for Linux only as this is for MIG scenario
This commit is contained in:
parent
ac700327a2
commit
e77d6eb5ab
@ -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);
|
||||
|
||||
|
@ -310,12 +310,16 @@ static void childProcess(int devId, int id, char **argv)
|
||||
ipcHandle *ipcChildHandle = NULL;
|
||||
int blocks = 0;
|
||||
int threads = 128;
|
||||
pid_t pid;
|
||||
char pidString[20] = {0};
|
||||
char lshmName[40] = {0};
|
||||
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);
|
||||
|
||||
@ -431,16 +435,20 @@ static void parentProcess(char *app)
|
||||
volatile shmStruct *shm = NULL;
|
||||
sharedMemoryInfo info;
|
||||
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);
|
||||
|
||||
printf("PP: lshmName = %s\n", lshmName);
|
||||
|
||||
checkCudaErrors(cuDeviceGetCount(&devCount));
|
||||
std::vector<CUdevice> devices(devCount);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user