#ifndef UCT_CUDA_IPC_MD_H
#define UCT_CUDA_IPC_MD_H
#include <uct/base/uct_md.h>
#include <uct/cuda/base/cuda_md.h>
#include <uct/cuda/base/cuda_iface.h>
#include <ucs/type/spinlock.h>
#include <ucs/config/types.h>
typedef struct uct_cuda_ipc_md {
struct uct_md super;
CUuuid* uuid_map;
ucs_ternary_auto_value_t *peer_accessible_cache;
int uuid_map_size;
int uuid_map_capacity;
} uct_cuda_ipc_md_t;
typedef struct uct_cuda_ipc_component {
uct_component_t super;
uct_cuda_ipc_md_t* md;
} uct_cuda_ipc_component_t;
extern uct_cuda_ipc_component_t uct_cuda_ipc_component;
typedef struct uct_cuda_ipc_md_config {
uct_md_config_t super;
} uct_cuda_ipc_md_config_t;
typedef struct uct_cuda_ipc_key {
CUipcMemHandle ph;
pid_t pid;
CUdeviceptr d_bptr;
size_t b_len;
int dev_num;
CUuuid uuid;
} uct_cuda_ipc_key_t;
#define UCT_CUDA_IPC_GET_DEVICE(_cu_device) \
do { \
if (UCS_OK != \
UCT_CUDADRV_FUNC_LOG_ERR(cuCtxGetDevice(&_cu_device))) { \
return UCS_ERR_IO_ERROR; \
} \
} while(0);
#define UCT_CUDA_IPC_DEVICE_GET_COUNT(_num_device) \
do { \
if (UCS_OK != \
UCT_CUDADRV_FUNC_LOG_ERR(cuDeviceGetCount(&_num_device))) { \
return UCS_ERR_IO_ERROR; \
} \
} while(0);
#endif