未验证 提交 3b7c9ffc 编写于 作者: W Weilong Wu 提交者: GitHub

fix issue accur in Mac OS m1 env (#50995)

* fix issue accur in Mac OS m1 env

* use __arm64__ directive to distinguish m1 chip
上级 c3d1e7e5
......@@ -494,8 +494,15 @@ class AllocatorFacadePrivate {
const AllocatorMap& GetAllocatorMap() { return allocators_; }
void InitNaiveBestFitCPUAllocator() {
// It is more efficient to use CPUAllocator directly.
#if defined(__APPLE__) && defined(__arm64__)
// NOTE(wuweilong): It is more efficient to use CPUAllocator directly,
// but it wll cause some problem in Mac OS m1 chip, so we use
// NaiveBestFitAllocator instead.
allocators_[platform::CPUPlace()] =
std::make_shared<NaiveBestFitAllocator>(platform::CPUPlace());
#else
allocators_[platform::CPUPlace()] = std::make_shared<CPUAllocator>();
#endif
}
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册