1515#include < errno.h>
1616#include < fcntl.h>
1717#include < nccl.h>
18+ #if defined(PADDLE_WITH_FLAGCX)
19+ #include " runtime_flagcx.h" // NOLINT
20+ #endif
1821#include < semaphore.h>
1922#include < sys/types.h>
2023#include < sys/wait.h>
@@ -1023,6 +1026,9 @@ void InitPlugin(CustomRuntimeParams *params) {
10231026 0 ,
10241027 sizeof (C_DeviceInterface));
10251028
1029+ #if defined(PADDLE_WITH_FLAGCX)
1030+ flagcxHandleInit (&flagcx_handler);
1031+ #endif
10261032 params->interface ->get_compute_capability = GetComputeCapability;
10271033 params->interface ->get_runtime_version = GetRuntimeVersion;
10281034 params->interface ->get_driver_version = GetDriverVersion;
@@ -1073,6 +1079,22 @@ void InitPlugin(CustomRuntimeParams *params) {
10731079 params->interface ->init_eigen_device = InitEigenDevice;
10741080 params->interface ->destroy_eigen_device = DestroyEigenDevice;
10751081
1082+ #if defined(PADDLE_WITH_FLAGCX)
1083+ params->interface ->xccl_all_gather = XcclFlagcxAllGather;
1084+ params->interface ->xccl_all_reduce = XcclFlagcxAllReduce;
1085+ params->interface ->xccl_broadcast = XcclFlagcxBroadcast;
1086+ params->interface ->xccl_comm_init_rank = XcclFlagcxCommInitRank;
1087+ params->interface ->xccl_destroy_comm = XcclFlagcxDestroyComm;
1088+ params->interface ->xccl_get_unique_id = XcclFlagcxGetUniqueId;
1089+ params->interface ->xccl_get_unique_id_size = XcclFlagcxGetUniqueIdSize;
1090+ params->interface ->xccl_group_end = XcclFlagcxGroupEnd;
1091+ params->interface ->xccl_group_start = XcclFlagcxGroupStart;
1092+ params->interface ->xccl_recv = XcclFlagcxRecv;
1093+ params->interface ->xccl_reduce = XcclFlagcxReduce;
1094+ params->interface ->xccl_reduce_scatter = XcclFlagcxReduceScatter;
1095+ params->interface ->xccl_send = XcclFlagcxSend;
1096+ params->interface ->xccl_all_to_all = XcclFlagcxAllToAll;
1097+ #else
10761098 params->interface ->xccl_all_gather = XcclAllGather;
10771099 params->interface ->xccl_all_reduce = XcclAllReduce;
10781100 params->interface ->xccl_broadcast = XcclBroadcast;
@@ -1086,6 +1108,7 @@ void InitPlugin(CustomRuntimeParams *params) {
10861108 params->interface ->xccl_reduce = XcclReduce;
10871109 params->interface ->xccl_reduce_scatter = XcclReduceScatter;
10881110 params->interface ->xccl_send = XcclSend;
1111+ #endif
10891112
10901113 params->interface ->profiler_collect_trace_data = nullptr ;
10911114 params->interface ->profiler_initialize = nullptr ;
0 commit comments