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.

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. #ifndef __HCCL_BASE_H__
  17. #define __HCCL_BASE_H__
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. typedef signed char s8;
  22. typedef signed short s16;
  23. typedef signed int s32;
  24. typedef signed long long s64;
  25. typedef unsigned char u8;
  26. typedef unsigned short u16;
  27. typedef unsigned int u32;
  28. typedef unsigned long long u64;
  29. typedef enum tagHcclResult {
  30. HCCL_SUCCESS = 0, /**< success */
  31. HCCL_E_PARA = 1, /**< parameter error */
  32. HCCL_E_PTR = 2, /**< empty pointer */
  33. HCCL_E_MEMORY = 3, /**< memory error */
  34. HCCL_E_INTERNAL = 4, /**< internal error */
  35. HCCL_E_NOT_SUPPORT = 5, /**< not support feature */
  36. HCCL_E_NOT_FOUND = 6, /**< not found specific resource */
  37. HCCL_E_UNAVAIL = 7, /**< resource unavailable */
  38. HCCL_E_SYSCALL = 8, /**< call system interface error */
  39. HCCL_E_TIMEOUT = 9, /**< timeout */
  40. HCCL_E_OPEN_FILE_FAILURE = 10, /**< open file fail */
  41. HCCL_E_TCP_CONNECT = 11, /**< tcp connect fail */
  42. HCCL_E_ROCE_CONNECT = 12, /**< roce connect fail */
  43. HCCL_E_TCP_TRANSFER = 13, /**< tcp transfer fail */
  44. HCCL_E_ROCE_TRANSFER = 14, /**< roce transfer fail */
  45. HCCL_E_RUNTIME = 15, /**< call runtime api fail */
  46. HCCL_E_DRV = 16, /**< call driver api fail */
  47. HCCL_E_PROFILING = 17, /**< call profiling api fail */
  48. HCCL_E_CCE = 18, /**< call cce api fail */
  49. HCCL_E_NETWORK = 19, /**< call network api fail */
  50. HCCL_E_RESERVED /**< reserved */
  51. } hcclResult_t;
  52. /* handle to communicator */
  53. typedef void *hcclComm_t;
  54. typedef enum tagHcclRedOp {
  55. HCCL_REP_OP_SUM = 0, /**< sum */
  56. HCCL_REP_OP_PROD = 1, /**< prod */
  57. HCCL_REP_OP_MAX = 2, /**< max */
  58. HCCL_REP_OP_MIN = 3, /**< min */
  59. HCCL_REP_OP_RESERVED /**< reserved */
  60. } hcclRedOp_t;
  61. typedef enum tagHcclDataType {
  62. HCCL_DATA_TYPE_INT8 = 0, /**< int8 */
  63. HCCL_DATA_TYPE_INT = 1, /**< int32 */
  64. HCCL_DATA_TYPE_HALF = 2, /**< fp16 */
  65. HCCL_DATA_TYPE_FLOAT = 3, /**< fp32 */
  66. HCCL_DATA_TYPE_RESERVED /**< reserved */
  67. } hcclDataType_t;
  68. const s32 HCCL_TAG_ANY = -1;
  69. const u32 BASE_UNIQUE_ID_BYTES = 27;
  70. #define HCCL_UNIQUE_ID_BYTES (BASE_UNIQUE_ID_BYTES + 5 + 16 + 128)
  71. typedef struct {
  72. char internal[HCCL_UNIQUE_ID_BYTES];
  73. } hcclUniqueId;
  74. const u32 HCCL_MAX_SEGMENT_NUM = 8;
  75. struct model_feature {
  76. const char *model_name;
  77. u32 gradient_num;
  78. float *gradient_size;
  79. float *gradient_time;
  80. };
  81. /**
  82. * @brief stream handle.
  83. */
  84. typedef void *rtStream_t;
  85. /**
  86. * @brief model handle.
  87. */
  88. typedef void *rtModel_t;
  89. #ifdef __cplusplus
  90. }
  91. #endif
  92. #endif // __HCCL_BASE_H__

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

Contributors (1)