From 1565fd9ab2e2166290e53bb7c8f41b3b26d0fbd0 Mon Sep 17 00:00:00 2001 From: Aganlengzi Date: Thu, 17 Mar 2022 21:12:57 +0800 Subject: [PATCH] [NPU] fix no allocator error --- paddle/fluid/memory/allocation/allocator_facade.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/paddle/fluid/memory/allocation/allocator_facade.cc b/paddle/fluid/memory/allocation/allocator_facade.cc index 61e292a922f..4a44448dc84 100644 --- a/paddle/fluid/memory/allocation/allocator_facade.cc +++ b/paddle/fluid/memory/allocation/allocator_facade.cc @@ -219,6 +219,12 @@ class AllocatorFacadePrivate { } InitNaiveBestFitCUDAPinnedAllocator(); #endif +#ifdef PADDLE_WITH_ASCEND_CL + for (int dev_id = 0; dev_id < platform::GetNPUDeviceCount(); ++dev_id) { + InitNaiveBestFitNPUAllocator(platform::NPUPlace(dev_id)); + } + InitNaiveBestFitNPUPinnedAllocator(); +#endif #ifdef PADDLE_WITH_XPU for (int dev_id = 0; dev_id < platform::GetXPUDeviceCount(); ++dev_id) { InitNaiveBestFitXPUAllocator(platform::XPUPlace(dev_id)); -- GitLab