diff --git a/paddle/fluid/memory/allocation/allocator_facade.cc b/paddle/fluid/memory/allocation/allocator_facade.cc index f82668bffee4095eaacee8e3517b64f1e1414896..4170e294301d655918744fc31029e0e439dbdf06 100644 --- a/paddle/fluid/memory/allocation/allocator_facade.cc +++ b/paddle/fluid/memory/allocation/allocator_facade.cc @@ -193,8 +193,7 @@ class CUDAPinnedManagedAllocator : public ChunkedManagedAllocator { class AllocatorFacadePrivate { public: - std::unordered_map> - allocators_; + std::map> allocators_; ~AllocatorFacadePrivate() = default; diff --git a/paddle/fluid/platform/place.h b/paddle/fluid/platform/place.h index 745a79014a7aa9fe16e4e8d637d944e971422f97..a095d4929ec2130b4af48d32bf016d9fe108b418 100644 --- a/paddle/fluid/platform/place.h +++ b/paddle/fluid/platform/place.h @@ -131,65 +131,5 @@ typename Visitor::result_type VisitPlace(const Place &place, return boost::apply_visitor(PlaceVisitorWrapper(visitor), place); } -struct PlaceHashVisitor : public boost::static_visitor { - template - inline size_t operator()(const Place &place) const { - return place.hash(); - } -}; - } // namespace platform } // namespace paddle - -namespace std { - -template <> -struct hash<::paddle::platform::CPUPlace> { - using argument_type = ::paddle::platform::CPUPlace; - using result_type = size_t; - - constexpr inline result_type operator()(const argument_type &place) const { - return static_cast(-1); - } -}; - -template <> -struct hash<::paddle::platform::CUDAPlace> { - using argument_type = ::paddle::platform::CUDAPlace; - using result_type = size_t; - - inline result_type operator()(const argument_type &place) const { - return static_cast(place.device); - } -}; - -template <> -struct hash<::paddle::platform::CUDAPinnedPlace> { - using argument_type = ::paddle::platform::CUDAPinnedPlace; - using result_type = size_t; - - constexpr inline result_type operator()(const argument_type &place) const { - return static_cast(-2); - } -}; - -namespace { // NOLINT -struct PlaceHashVisitor : public boost::static_visitor { - template - inline size_t operator()(const Place &place) const { - return std::hash()(place); - } -}; -} - -template <> -struct hash<::paddle::platform::Place> { - using argument_type = ::paddle::platform::Place; - using result_type = size_t; - - inline result_type operator()(const argument_type &place) const { - return boost::apply_visitor(PlaceHashVisitor(), place); - } -}; - -} // namespace std