mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-10-25 22:28:17 +08:00
Merge branch 'master' into cuda_a_dev
This commit is contained in:
@@ -102,13 +102,23 @@ static void childProcess(int id)
|
||||
int threads = 128;
|
||||
cudaDeviceProp prop;
|
||||
std::vector<void *> ptrs;
|
||||
pid_t pid;
|
||||
char pidString[20] = {0};
|
||||
char lshmName[40] = {0};
|
||||
|
||||
std::vector<char> verification_buffer(DATA_SIZE);
|
||||
|
||||
pid = getppid();
|
||||
snprintf(pidString, sizeof(pidString), "%d", pid);
|
||||
strcat(lshmName, shmName);
|
||||
strcat(lshmName, pidString);
|
||||
|
||||
printf("CP: lshmName = %s\n", lshmName);
|
||||
|
||||
ipcHandle *ipcChildHandle = NULL;
|
||||
checkIpcErrors(ipcOpenSocket(ipcChildHandle));
|
||||
|
||||
if (sharedMemoryOpen(shmName, sizeof(shmStruct), &info) != 0) {
|
||||
if (sharedMemoryOpen(lshmName, sizeof(shmStruct), &info) != 0) {
|
||||
printf("Failed to create shared memory slab\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -245,6 +255,16 @@ static void parentProcess(char *app)
|
||||
std::vector<void *> ptrs;
|
||||
std::vector<Process> processes;
|
||||
cudaMemAllocationHandleType handleType = cudaMemHandleTypeNone;
|
||||
pid_t pid;
|
||||
char pidString[20] = {0};
|
||||
char lshmName[40] = {0};
|
||||
|
||||
pid = getpid();
|
||||
snprintf(pidString, sizeof(pidString), "%d", pid);
|
||||
strcat(lshmName, shmName);
|
||||
strcat(lshmName, pidString);
|
||||
|
||||
printf("PP: lshmName = %s\n", lshmName);
|
||||
|
||||
checkCudaErrors(cudaGetDeviceCount(&devCount));
|
||||
std::vector<CUdevice> devices(devCount);
|
||||
@@ -252,7 +272,7 @@ static void parentProcess(char *app)
|
||||
cuDeviceGet(&devices[i], i);
|
||||
}
|
||||
|
||||
if (sharedMemoryCreate(shmName, sizeof(*shm), &info) != 0) {
|
||||
if (sharedMemoryCreate(lshmName, sizeof(*shm), &info) != 0) {
|
||||
printf("Failed to create shared memory slab\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user