diff --git a/ge/graph/manager/host_mem_allocator.h b/ge/graph/manager/host_mem_allocator.h index 2138da63..b9dbdc4c 100644 --- a/ge/graph/manager/host_mem_allocator.h +++ b/ge/graph/manager/host_mem_allocator.h @@ -18,7 +18,7 @@ #define GE_GRAPH_MANAGER_HOST_MEM_ALLOCATOR_H_ #include -#include +#include #include "framework/common/ge_inner_error_codes.h" #include "graph/aligned_ptr.h" @@ -27,7 +27,7 @@ namespace ge { class HostMemAllocator { public: - explicit HostMemAllocator(rtMemType_t memory_type) : memory_type_(memory_type) {} + explicit HostMemAllocator(rtMemType_t) {} ~HostMemAllocator() = default; HostMemAllocator(const HostMemAllocator &) = delete; @@ -48,8 +48,7 @@ class HostMemAllocator { private: void Clear(); - rtMemType_t memory_type_; - std::unordered_map>> allocated_blocks_; + std::map>> allocated_blocks_; // lock around all operations mutable std::mutex mutex_; }; diff --git a/ge/graph/manager/host_mem_manager.cc b/ge/graph/manager/host_mem_manager.cc index 1de3fcd0..c9a33f5c 100644 --- a/ge/graph/manager/host_mem_manager.cc +++ b/ge/graph/manager/host_mem_manager.cc @@ -44,13 +44,12 @@ Status SharedMemAllocator::Allocate(SharedMemInfo &mem_info) { } mem_info.fd = output_para.fd; #ifndef ONLY_COMPILE_OPEN_SRC - mem_info.host_aligned_ptr = AlignedPtr::BuildFromAllocFunc(mem_info.mem_size, - [&output_para](std::unique_ptr &ptr) { + mem_info.host_aligned_ptr = AlignedPtr::BuildFromAllocFunc([&output_para](std::unique_ptr &ptr) { ptr.reset(reinterpret_cast(output_para.ptr)); }, [](uint8_t *ptr) { ptr = nullptr; - }, 0); + }); #else mem_info.host_address = reinterpret_cast(output_para.ptr); #endif