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.

hcom.h 4.4 kB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /**
  2. * Copyright 2019-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. * @file hcom.h
  18. * @brief HCOM API
  19. */
  20. #ifndef HCOM_H_
  21. #define HCOM_H_
  22. #include <hccl/base.h>
  23. #include <hccl/hccl_types.h>
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif // __cplusplus
  27. /**
  28. * @brief Get the rank number in the group.
  29. *
  30. * @param group A string identifying the group name.
  31. * @param rankSize A pointer identifying the rank number.
  32. * @return HcclResult
  33. */
  34. HcclResult hcom_get_rank_size(const char *group, u32 *rankSize);
  35. /**
  36. * @brief Get the rank number of this rank's server within the group.
  37. *
  38. * @param group A string identifying the group name.
  39. * @param localRankSize A pointer identifying the rank number.
  40. * @return HcclResult
  41. */
  42. HcclResult hcom_get_local_rank_size(const char *group, u32 *localRankSize);
  43. /**
  44. * @brief Get the rank id of this rank.
  45. *
  46. * @param group A string identifying the group name.
  47. * @param rankId A pointer identifying the rank id.
  48. * @return HcclResult
  49. */
  50. HcclResult hcom_get_rank_id(const char *group, u32 *rankId);
  51. /**
  52. * @brief Get the local rank id of this rank's server within the group.
  53. *
  54. * @param group A string identifying the group name.
  55. * @param localRankId A pointer identifying the local rank id.
  56. * @return HcclResult
  57. */
  58. HcclResult hcom_get_local_rank_id(const char *group, u32 *localRankId);
  59. /**
  60. * @brief Get the world rank id according to the group rank id.
  61. *
  62. * @param group A string identifying the group name.
  63. * @param groupRank An integer(u32) identifying the group rank id.
  64. * @param worldRank A pointer identifying the world rank id.
  65. * @return HcclResult
  66. */
  67. HcclResult hcom_get_world_rank_from_group_rank(const char *group, u32 groupRank, u32 *worldRank);
  68. /**
  69. * @brief Get the group rank id according to the world rank id.
  70. *
  71. * @param worldRank An integer(u32) identifying the world rank id.
  72. * @param group A string identifying the group name.
  73. * @param groupRank A pointer identifying the group rank id.
  74. * @return HcclResult
  75. */
  76. HcclResult hcom_get_group_rank_from_world_rank(u32 worldRank, const char *group, u32 *groupRank);
  77. /**
  78. * @brief Create group.
  79. *
  80. * @param group A string identifying the group name.
  81. * @param rankNum An integer(u32) identifying the number of ranks in the group.
  82. * @param rankIds A list identifying the ranks in the group.
  83. * @return HcclResult
  84. */
  85. HcclResult hcom_create_group(const char *group, u32 rankNum, u32 *rankIds);
  86. /**
  87. * @brief Destroy group
  88. *
  89. * @param group A string identifying the group name.
  90. * @return HcclResult
  91. */
  92. HcclResult hcom_destroy_group(const char *group);
  93. /**
  94. * @brief Set the gradient split strategy with in the group, according to gradient index.
  95. *
  96. * @param group A string identifying the group name.
  97. * @param segmentNum An integer(u32) identifying the segments number of gradients.
  98. * @param IdxList A list identifying the index of end gradient in each segment.
  99. * @return HcclResult
  100. */
  101. extern HcclResult hcom_set_split_strategy_by_index(const char *group, u32 segmentNum, const u32 *IdxList);
  102. /**
  103. * @brief Set the gradient split strategy with in the group, according to gradient data size.
  104. *
  105. * @param group A string identifying the group name.
  106. * @param segmentNum An integer(u32) identifying the segments number of gradients.
  107. * @param sizeList A list identifying the percent of each segment.
  108. * @return HcclResult
  109. */
  110. extern HcclResult hcom_set_split_strategy_by_size(const char *group, u32 segmentNum, const float *sizeList);
  111. /**
  112. * @brief Register memories and init resources for remote access.
  113. *
  114. * @param addrList memory addresses for remote access.
  115. * @param count number of remote memory addresses.
  116. * @return HcclResult
  117. */
  118. extern HcclResult hcom_remote_access_mem_register(const MemRegisterAddr* addrList, u32 count);
  119. #ifdef __cplusplus
  120. }
  121. #endif // __cplusplus
  122. #endif // HCOM_H_

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示