From 1d4d4e73abb3beab4cda00f72e719189eb93f03f Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Mon, 22 Oct 2018 18:00:48 +0800 Subject: [PATCH] Remove place hash test=develop --- .../memory/allocation/allocator_facade.cc | 3 +- paddle/fluid/platform/place.h | 60 ------------------- 2 files changed, 1 insertion(+), 62 deletions(-) diff --git a/paddle/fluid/memory/allocation/allocator_facade.cc b/paddle/fluid/memory/allocation/allocator_facade.cc index f82668bffee..4170e294301 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 745a79014a7..a095d4929ec 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 -- GitLab