MemoryType

Memory type enumeration. The header file is include/ge/ge_api_types.h in the CANN component directory.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
enum class MemoryType : std::int64_t {
  /*
   * call aclrtMalloc with aclrtMemMallocPolicy::ACL_MEM_MALLOC_HUGE_FIRST,
   * ACL_MEM_MALLOC_HUGE_ONLY, ACL_MEM_MALLOC_NORMAL_ONLY
   */
  MEMORY_TYPE_DEFAULT,
  /*
   * call aclrtMalloc with aclrtMemMallocPolicy::ACL_MEM_MALLOC_HUGE_FIRST_P2P,
   * ACL_MEM_MALLOC_HUGE_ONLY_P2P, ACL_MEM_MALLOC_NORMAL_ONLY_P2P
   */
  MEMORY_TYPE_P2P
};

The enumerations are described as follows:

  • MEMORY_TYPE_DEFAULT: default type of device memory, which can be obtained by calling the aclrtMalloc API. When allocating memory, pass one of the three enumerated values of aclrtMemMallocPolicy, which are ACL_MEM_MALLOC_HUGE_FIRST, ACL_MEM_MALLOC_HUGE_ONLY, and ACL_MEM_MALLOC_NORMAL_ONLY.
  • MEMORY_TYPE_P2P: type of inter-device memory in memory reuse scenarios, which can be obtained by calling aclrtMalloc. When allocating memory, pass one of the three enumerated values of aclrtMemMallocPolicy, which are ACL_MEM_MALLOC_HUGE_FIRST_P2P, ACL_MEM_MALLOC_HUGE_ONLY_P2P, and ACL_MEM_MALLOC_NORMAL_ONLY_P2P.