You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

hccl_stub.cc 5.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. /* runtime基础数据类型声明 */
  17. /* HCCL基础数据类型声明 */
  18. #include "hccl/hcom.h"
  19. #include "hccl/hccl.h"
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /* 集合通信域初始化 */
  24. HcclResult hcom_init(const char *rank_table, const char *identify) { return HCCL_SUCCESS; }
  25. /* 解析ranktable for python */
  26. HcclResult hcom_rank_info_init(const char *rank_table, const char *identify, u32 device_id) { return HCCL_SUCCESS; }
  27. /* 集合通信域销毁 */
  28. HcclResult hcom_destroy(void) { return HCCL_SUCCESS; }
  29. /* 绑定model */
  30. HcclResult hcom_bind_model(rtModel_t model, rtStream_t stream) { return HCCL_SUCCESS; }
  31. /* 绑解定model */
  32. HcclResult hcom_unbind_model(rtModel_t model) { return HCCL_SUCCESS; }
  33. /* allgather功能实现 */
  34. HcclResult hcom_all_gather(const char *tag, void *inputPtr, void *outputPtr, u64 inputCount, HcclDataType dataType,
  35. const char *group, rtStream_t stream) {
  36. return HCCL_SUCCESS;
  37. }
  38. /* allreduce功能实现 */
  39. HcclResult hcom_all_reduce(const char *tag, void *inputPtr, void *outputPtr, u64 count, HcclDataType dataType,
  40. HcclReduceOp op, const char *group, rtStream_t stream) {
  41. return HCCL_SUCCESS;
  42. }
  43. /* broadcas功能实现 */
  44. HcclResult hcom_broadcast(const char *tag, void *ptr, u64 count, HcclDataType dataType, u32 root, const char *group,
  45. rtStream_t stream) {
  46. return HCCL_SUCCESS;
  47. }
  48. /* reduce_scatter功能实现 */
  49. HcclResult hcom_reduce_scatter(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. /* 获取group内的rank个数 */
  54. HcclResult HcomGetRankSize(const char *group, u32 *rankSize) { return HCCL_SUCCESS; }
  55. /* python获取上云场景内的rank个数 */
  56. HcclResult hcom_python_get_rank_size(u32 *rankSize) { return HCCL_SUCCESS; }
  57. /* 获取本rank的id */
  58. HcclResult HcomGetRankId(const char *group, u32 *rankId) { return HCCL_SUCCESS; }
  59. /* 获取本rank的id */
  60. HcclResult hcom_python_get_rank_id(u32 *rankId) { return HCCL_SUCCESS; }
  61. /* 获取本rank的id */
  62. HcclResult HcomGetWorldRankFromGroupRank(const char *group, u32 groupRank, u32 *worldRank) {
  63. return HCCL_SUCCESS;
  64. }
  65. /* 获取通信域的rank个数 */
  66. HcclResult HcomGetGroupRankFromWorldRank(u32 worldRank, const char *group, u32 *groupRank) {
  67. return HCCL_SUCCESS;
  68. }
  69. /* 创建group */
  70. HcclResult HcomCreateGroup(const char *group, u32 rankNum, u32 *rankIds) { return HCCL_SUCCESS; }
  71. /* 销毁group */
  72. HcclResult HcomDestroyGroup(const char *group) { return HCCL_SUCCESS; }
  73. /* 发送消息 */
  74. HcclResult hcom_send(const char *tag, void *inputPtr, u64 count, HcclDataType dataType, u32 destRank, u32 srTag,
  75. const char *group, rtStream_t stream) {
  76. return HCCL_SUCCESS;
  77. }
  78. /* 接收消息 */
  79. HcclResult hcom_receive(const char *tag, void *outputPtr, u64 count, HcclDataType dataType, u32 srcRank, u32 srTag,
  80. const char *group, rtStream_t stream) {
  81. return HCCL_SUCCESS;
  82. }
  83. /* 获取梯度参数切分方案 */
  84. HcclResult hcom_get_split_strategy(const char *group, const struct model_feature *feature, u32 maxSegmentNum,
  85. u32 *segmentNum, u32 *segmentIdx, GradSplitForceMode force,
  86. OriginalGraphShapeType shapeType) {
  87. return HCCL_SUCCESS;
  88. }
  89. /* 连通性检测 */
  90. HcclResult hcom_connectivity_detection(s32 *result) { return HCCL_SUCCESS; }
  91. HcclResult hcom_set_split_strategy_by_index(const char *group, u32 segmentNum, const u32 *IdxList) {
  92. return HCCL_SUCCESS;
  93. }
  94. HcclResult hcom_set_split_strategy_by_size(const char *group, u32 segmentNum, const float *sizeList) {
  95. return HCCL_SUCCESS;
  96. }
  97. HcclResult HcclCommInitClusterInfo(const char *clusterInfo, uint32_t rank, HcclComm *comm) {
  98. return HCCL_SUCCESS;
  99. }
  100. HcclResult HcclGetRootInfo(HcclRootInfo *rootInfo) {
  101. return HCCL_SUCCESS;
  102. }
  103. HcclResult HcclCommInitRootInfo(uint32_t nRanks, const HcclRootInfo *rootInfo, uint32_t rank, HcclComm *comm) {
  104. return HCCL_SUCCESS;
  105. }
  106. HcclResult HcclAllReduce(void *sendBuf, void *recvBuf, uint64_t count, HcclDataType dataType, HcclReduceOp op,
  107. HcclComm comm, aclrtStream stream) {
  108. return HCCL_SUCCESS;
  109. }
  110. HcclResult HcclBroadcast(void *buf, uint64_t count, HcclDataType dataType, uint32_t root, HcclComm comm,
  111. aclrtStream stream) {
  112. return HCCL_SUCCESS;
  113. }
  114. HcclResult HcclReduceScatter(void *sendBuf, void *recvBuf, uint64_t recvCount, HcclDataType dataType,
  115. HcclReduceOp op, HcclComm comm, aclrtStream stream) {
  116. return HCCL_SUCCESS;
  117. }
  118. HcclResult HcclAllGather(void *sendBuf, void *recvBuf, uint64_t sendCount, HcclDataType dataType, HcclComm comm,
  119. aclrtStream stream) {
  120. return HCCL_SUCCESS;
  121. }
  122. HcclResult HcclCommDestroy(HcclComm comm) {
  123. return HCCL_SUCCESS;
  124. }
  125. #ifdef __cplusplus
  126. }
  127. #endif