Skip to content

Commit

Permalink
Initial add of UCT plugin: support older APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
tvegas1 committed Apr 25, 2024
1 parent 4fded67 commit a14b09d
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/p2p_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ extern ncclNet_v7_t ucxRmaPlugin_v7;
extern ncclNet_v6_t ucxRmaPlugin_v6;
extern ncclNet_v5_t ucxRmaPlugin_v5;
extern ncclNet_v8_t ucxUctPlugin_v8;
extern ncclNet_v7_t ucxUctPlugin_v7;
extern ncclNet_v6_t ucxUctPlugin_v6;
extern ncclNet_v5_t ucxUctPlugin_v5;
#endif

extern ncclNet_v8_t ibPlugin_v8;
Expand Down Expand Up @@ -110,6 +113,9 @@ static void pluginSetup()
break;
case NCCL_P2P_UCX_UCT:
ncclNetPlugin_v8 = ucxUctPlugin_v8;
ncclNetPlugin_v7 = ucxUctPlugin_v7;
ncclNetPlugin_v6 = ucxUctPlugin_v6;
ncclNetPlugin_v5 = ucxUctPlugin_v5;
break;
#endif
default:
Expand Down
121 changes: 121 additions & 0 deletions src/ucx_uct_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,66 @@ static ncclResult_t nccl_uct_close(void *close_comm) {
return ncclSuccess;
}

ncclResult_t nccl_uct_get_properties_v7(int dev,
ncclNetProperties_v7_t *props_v7) {
ncclNetProperties_t props;
ncclResult_t ret = nccl_uct_get_properties(dev, &props);
if (ret != ncclSuccess) {
return ret;
}

props_v7->name = props.name;
props_v7->pciPath = props.pciPath;
props_v7->guid = props.guid;
props_v7->ptrSupport = props.ptrSupport;
props_v7->speed = props.speed;
props_v7->latency = props.latency;
props_v7->port = props.port;
props_v7->maxComms = props.maxComms;
props_v7->maxRecvs = props.maxRecvs;
props_v7->netDeviceType = props.netDeviceType;
props_v7->netDeviceVersion = props.netDeviceVersion;

return ncclSuccess;
}

static ncclResult_t nccl_uct_reg_mr_v7(void *comm, void *data, int size,
int type, void **mhandle) {
return nccl_uct_reg_mr(comm, data, (size_t)size, type, mhandle);
}

static ncclResult_t
nccl_uct_get_properties_v6(int dev, ncclNetProperties_v6_t *props_v6) {
ncclNetProperties_t props;
ncclResult_t ret = nccl_uct_get_properties(dev, &props);
if (ret != ncclSuccess) {
return ret;
}

props_v6->name = props.name;
props_v6->pciPath = props.pciPath;
props_v6->guid = props.guid;
props_v6->ptrSupport = props.ptrSupport;
props_v6->speed = props.speed;
props_v6->latency = props.latency;
props_v6->port = props.port;
props_v6->maxComms = props.maxComms;
props_v6->maxRecvs = props.maxRecvs;

return ncclSuccess;
}

static ncclResult_t nccl_uct_connect_v6(int dev, void *handle,
void **send_comm) {
ncclNetDeviceHandle_v7_t *dev_handle = NULL;
return nccl_uct_connect(dev, handle, send_comm, &dev_handle);
}

static ncclResult_t nccl_uct_accept_v6(void *listen_comm, void **recv_comm) {
ncclNetDeviceHandle_v7_t *dev_handle = NULL;
return nccl_uct_accept(listen_comm, recv_comm, &dev_handle);
}

ncclNet_v8_t ucxUctPlugin_v8 = {
.name = "UCX-UCT",
.init = nccl_uct_init,
Expand All @@ -1490,3 +1550,64 @@ ncclNet_v8_t ucxUctPlugin_v8 = {
.getDeviceMr = NULL,
.irecvConsumed = NULL
};

ncclNet_v7_t ucxUctPlugin_v7 = {
.name = "UCX-UCT",
.init = nccl_uct_init,
.devices = nccl_uct_devices,
.getProperties = nccl_uct_get_properties_v7,
.listen = nccl_uct_listen,
.connect = nccl_uct_connect,
.accept = nccl_uct_accept,
.regMr = nccl_uct_reg_mr_v7,
.regMrDmaBuf = nccl_uct_reg_mr_dmabuf,
.deregMr = nccl_uct_dereg_mr,
.isend = nccl_uct_isend,
.irecv = nccl_uct_irecv,
.iflush = nccl_uct_iflush,
.test = nccl_uct_test,
.closeSend = nccl_uct_close,
.closeRecv = nccl_uct_close,
.closeListen = nccl_uct_close_listen,
.getDeviceMr = NULL,
.irecvConsumed = NULL
};

ncclNet_v6_t ucxUctPlugin_v6 = {
.name = "UCX-UCT",
.init = nccl_uct_init,
.devices = nccl_uct_devices,
.getProperties = nccl_uct_get_properties_v6,
.listen = nccl_uct_listen,
.connect = nccl_uct_connect_v6,
.accept = nccl_uct_accept_v6,
.regMr = nccl_uct_reg_mr_v7,
.regMrDmaBuf = nccl_uct_reg_mr_dmabuf,
.deregMr = nccl_uct_dereg_mr,
.isend = nccl_uct_isend,
.irecv = nccl_uct_irecv,
.iflush = nccl_uct_iflush,
.test = nccl_uct_test,
.closeSend = nccl_uct_close,
.closeRecv = nccl_uct_close,
.closeListen = nccl_uct_close_listen
};

ncclNet_v5_t ucxUctPlugin_v5 = {
.name = "UCX-UCT",
.init = nccl_uct_init,
.devices = nccl_uct_devices,
.getProperties = nccl_uct_get_properties_v6,
.listen = nccl_uct_listen,
.connect = nccl_uct_connect_v6,
.accept = nccl_uct_accept_v6,
.regMr = nccl_uct_reg_mr_v7,
.deregMr = nccl_uct_dereg_mr,
.isend = nccl_uct_isend,
.irecv = nccl_uct_irecv,
.iflush = nccl_uct_iflush,
.test = nccl_uct_test,
.closeSend = nccl_uct_close,
.closeRecv = nccl_uct_close,
.closeListen = nccl_uct_close_listen
};

0 comments on commit a14b09d

Please sign in to comment.