Skip to content

Commit

Permalink
mpl/cuda: Add device id to handle conversion API
Browse files Browse the repository at this point in the history
The libfabric memory registration API requires a CUdevice handle as
input. Add MPL_gpu_device_id_to_handle to support this
functionality. HIP and ZE do not need to implement this API since it
is only used within MPL_HAVE_CUDA preprocessor blocks.
  • Loading branch information
raffenet committed Oct 2, 2024
1 parent 4b810d7 commit 12834e5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mpl/include/mpl_gpu_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ typedef cudaIpcMemHandle_t MPL_gpu_ipc_mem_handle_t;
typedef struct cudaPointerAttributes MPL_gpu_device_attr;
typedef int MPL_gpu_request;
typedef cudaStream_t MPL_gpu_stream_t;
typedef CUdevice MPL_gpu_device_handle_t;

/* Note: event variable need be allocated on a gpu registered host buffer for it to work */
typedef volatile int MPL_gpu_event_t;
Expand All @@ -22,4 +23,6 @@ typedef volatile int MPL_gpu_event_t;

#define MPL_GPU_DEV_AFFINITY_ENV "CUDA_VISIBLE_DEVICES"

#define MPL_gpu_device_id_to_handle(...) cuDeviceGet(__VA_ARGS__)

#endif /* ifndef MPL_GPU_CUDA_H_INCLUDED */

0 comments on commit 12834e5

Please sign in to comment.