Skip to content

Commit 536bf7d

Browse files
committed
fix poolAllocator unordered_map bug on Mac OS X
* using map to replace unordered_map on Mac
1 parent 9795e01 commit 536bf7d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

paddle/math/PoolAllocator.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ limitations under the License. */
1919
#include <mutex>
2020
#include <vector>
2121
#include <unordered_map>
22+
#include <map>
2223
#include "Allocator.h"
2324

2425
namespace paddle {
@@ -52,7 +53,11 @@ class PoolAllocator {
5253
void printAll();
5354
std::unique_ptr<Allocator> allocator_;
5455
std::mutex mutex_;
56+
#if defined(__APPLE__) || defined(__OSX__)
57+
std::map<size_t, std::vector<void*>> pool_;
58+
#else
5559
std::unordered_map<size_t, std::vector<void*>> pool_;
60+
#endif
5661
size_t sizeLimit_;
5762
size_t poolMemorySize_;
5863
std::string name_;

0 commit comments

Comments
 (0)