mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-11-18 01:48:16 +08:00
Add and update samples for cuda 10.2 support
This commit is contained in:
@@ -33,13 +33,26 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
#include <strsafe.h>
|
||||
#include <sddl.h>
|
||||
#include <aclapi.h>
|
||||
#include <winternl.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <memory.h>
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
#include <vector>
|
||||
|
||||
typedef struct sharedMemoryInfo_st {
|
||||
void *addr;
|
||||
@@ -68,4 +81,40 @@ int spawnProcess(Process *process, const char *app, char * const *args);
|
||||
|
||||
int waitProcess(Process *process);
|
||||
|
||||
#define checkIpcErrors(ipcFuncResult) \
|
||||
if (ipcFuncResult == -1) { fprintf(stderr, "Failure at %u %s\n", __LINE__, __FILE__); exit(EXIT_FAILURE); }
|
||||
|
||||
#if defined(__linux__)
|
||||
struct ipcHandle_st {
|
||||
int socket;
|
||||
char *socketName;
|
||||
};
|
||||
typedef int ShareableHandle;
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
|
||||
struct ipcHandle_st {
|
||||
std::vector<HANDLE> hMailslot; // 1 Handle in case of child and `num children` Handles for parent.
|
||||
};
|
||||
typedef HANDLE ShareableHandle;
|
||||
#endif
|
||||
|
||||
typedef struct ipcHandle_st ipcHandle;
|
||||
|
||||
int
|
||||
ipcCreateSocket(ipcHandle *&handle, const char *name, const std::vector<Process>& processes);
|
||||
|
||||
int
|
||||
ipcOpenSocket(ipcHandle *&handle);
|
||||
|
||||
int
|
||||
ipcCloseSocket(ipcHandle *handle);
|
||||
|
||||
int
|
||||
ipcRecvShareableHandles(ipcHandle *handle, std::vector<ShareableHandle>& shareableHandles);
|
||||
|
||||
int
|
||||
ipcSendShareableHandles(ipcHandle *handle, const std::vector<ShareableHandle>& shareableHandles, const std::vector<Process>& processes);
|
||||
|
||||
int
|
||||
ipcCloseShareableHandle(ShareableHandle shHandle);
|
||||
|
||||
#endif // HELPER_MULTIPROCESS_H
|
||||
|
||||
Reference in New Issue
Block a user