1 /** 2 * Copyright 2020 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /* runtime基础数据类型声明 */ 18 19 /* HCCL基础数据类型声明 */ 20 #include "hccl/hcom.h" 21 #include "hccl/hccl.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /* 集合通信域初始化 */ 28 HcclResult hcom_init(const char *rank_table, const char *identify) { return HCCL_SUCCESS; } 29 30 /* 解析ranktable for python */ 31 HcclResult hcom_rank_info_init(const char *rank_table, const char *identify, u32 device_id) { return HCCL_SUCCESS; } 32 33 /* 集合通信域销毁 */ 34 HcclResult hcom_destroy(void) { return HCCL_SUCCESS; } 35 36 /* 绑定model */ 37 HcclResult hcom_bind_model(rtModel_t model, rtStream_t stream) { return HCCL_SUCCESS; } 38 39 /* 绑解定model */ 40 HcclResult hcom_unbind_model(rtModel_t model) { return HCCL_SUCCESS; } 41 42 /* allgather功能实现 */ 43 HcclResult hcom_all_gather(const char *tag, void *inputPtr, void *outputPtr, u64 inputCount, HcclDataType dataType, 44 const char *group, rtStream_t stream) { 45 return HCCL_SUCCESS; 46 } 47 48 /* allreduce功能实现 */ 49 HcclResult hcom_all_reduce(const char *tag, void *inputPtr, void *outputPtr, u64 count, HcclDataType dataType, 50 HcclReduceOp op, const char *group, rtStream_t stream) { 51 return HCCL_SUCCESS; 52 } 53 54 /* broadcas功能实现 */ 55 HcclResult hcom_broadcast(const char *tag, void *ptr, u64 count, HcclDataType dataType, u32 root, const char *group, 56 rtStream_t stream) { 57 return HCCL_SUCCESS; 58 } 59 /* reduce_scatter功能实现 */ 60 HcclResult hcom_reduce_scatter(const char *tag, void *inputPtr, void *outputPtr, u64 count, HcclDataType dataType, 61 HcclReduceOp op, const char *group, rtStream_t stream) { 62 return HCCL_SUCCESS; 63 } 64 65 /* 获取group内的rank个数 */ 66 HcclResult HcomGetRankSize(const char *group, u32 *rankSize) { return HCCL_SUCCESS; } 67 68 /* python获取上云场景内的rank个数 */ 69 HcclResult hcom_python_get_rank_size(u32 *rankSize) { return HCCL_SUCCESS; } 70 71 /* 获取本rank的id */ 72 HcclResult HcomGetRankId(const char *group, u32 *rankId) { return HCCL_SUCCESS; } 73 74 /* 获取本rank的id */ 75 HcclResult hcom_python_get_rank_id(u32 *rankId) { return HCCL_SUCCESS; } 76 77 /* 获取本rank的id */ 78 HcclResult HcomGetWorldRankFromGroupRank(const char *group, u32 groupRank, u32 *worldRank) { 79 return HCCL_SUCCESS; 80 } 81 82 /* 获取通信域的rank个数 */ 83 HcclResult HcomGetGroupRankFromWorldRank(u32 worldRank, const char *group, u32 *groupRank) { 84 return HCCL_SUCCESS; 85 } 86 87 /* 创建group */ 88 HcclResult HcomCreateGroup(const char *group, u32 rankNum, u32 *rankIds) { return HCCL_SUCCESS; } 89 90 /* 销毁group */ 91 HcclResult HcomDestroyGroup(const char *group) { return HCCL_SUCCESS; } 92 93 /* 发送消息 */ 94 HcclResult hcom_send(const char *tag, void *inputPtr, u64 count, HcclDataType dataType, u32 destRank, u32 srTag, 95 const char *group, rtStream_t stream) { 96 return HCCL_SUCCESS; 97 } 98 99 /* 接收消息 */ 100 HcclResult hcom_receive(const char *tag, void *outputPtr, u64 count, HcclDataType dataType, u32 srcRank, u32 srTag, 101 const char *group, rtStream_t stream) { 102 return HCCL_SUCCESS; 103 } 104 105 /* 获取梯度参数切分方案 */ 106 HcclResult hcom_get_split_strategy(const char *group, const struct model_feature *feature, u32 maxSegmentNum, 107 u32 *segmentNum, u32 *segmentIdx, GradSplitForceMode force, 108 OriginalGraphShapeType shapeType) { 109 return HCCL_SUCCESS; 110 } 111 112 /* 连通性检测 */ 113 HcclResult hcom_connectivity_detection(s32 *result) { return HCCL_SUCCESS; } 114 115 HcclResult hcom_set_split_strategy_by_index(const char *group, u32 segmentNum, const u32 *IdxList) { 116 return HCCL_SUCCESS; 117 } 118 HcclResult hcom_set_split_strategy_by_size(const char *group, u32 segmentNum, const float *sizeList) { 119 return HCCL_SUCCESS; 120 } 121 122 HcclResult HcclCommInitClusterInfo(const char *clusterInfo, uint32_t rank, HcclComm *comm) { 123 return HCCL_SUCCESS; 124 } 125 126 HcclResult HcclGetRootInfo(HcclRootInfo *rootInfo) { 127 return HCCL_SUCCESS; 128 } 129 130 HcclResult HcclCommInitRootInfo(uint32_t nRanks, const HcclRootInfo *rootInfo, uint32_t rank, HcclComm *comm) { 131 return HCCL_SUCCESS; 132 } 133 134 /** 135 * @brief Get the rank size of this comm. 136 * 137 * @param comm A pointer identifying the communication resource based on. 138 * @param rankSize A pointer identifying the rank size. 139 * @return HcclResult 140 */ 141 HcclResult HcclGetRankSize(HcclComm comm, uint32_t *rankSize) { return HCCL_SUCCESS; } 142 143 /** 144 * @brief Get the rank id of this comm. 145 * 146 * @param comm A pointer identifying the communication resource based on. 147 * @param rankSize A pointer identifying the rank id. 148 * @return HcclResult 149 */ 150 HcclResult HcclGetRankId(HcclComm comm, uint32_t *rank) { return HCCL_SUCCESS; } 151 152 HcclResult HcclAllReduce(void *sendBuf, void *recvBuf, uint64_t count, HcclDataType dataType, HcclReduceOp op, 153 HcclComm comm, aclrtStream stream) { 154 return HCCL_SUCCESS; 155 } 156 157 HcclResult HcclBroadcast(void *buf, uint64_t count, HcclDataType dataType, uint32_t root, HcclComm comm, 158 aclrtStream stream) { 159 return HCCL_SUCCESS; 160 } 161 162 HcclResult HcclReduceScatter(void *sendBuf, void *recvBuf, uint64_t recvCount, HcclDataType dataType, 163 HcclReduceOp op, HcclComm comm, aclrtStream stream) { 164 return HCCL_SUCCESS; 165 } 166 167 HcclResult HcclAllGather(void *sendBuf, void *recvBuf, uint64_t sendCount, HcclDataType dataType, HcclComm comm, 168 aclrtStream stream) { 169 return HCCL_SUCCESS; 170 } 171 172 HcclResult HcclCommDestroy(HcclComm comm) { 173 return HCCL_SUCCESS; 174 } 175 176 #ifdef __cplusplus 177 } 178 #endif 179