From 37cb6f32b23025445374fc4da824eab0f4598eac Mon Sep 17 00:00:00 2001 From: Qi Li Date: Fri, 25 Feb 2022 15:07:16 +0800 Subject: [PATCH] [ROCm] fix Managed Memory Alloc on HIP, test=develop (#39896) * [ROCm] fix Managed Memory Alloc on HIP, test=develop * update, test=develop --- paddle/fluid/memory/allocation/allocator_facade.cc | 3 ++- paddle/fluid/memory/cuda_managed_memory_test.cu | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/memory/allocation/allocator_facade.cc b/paddle/fluid/memory/allocation/allocator_facade.cc index 9b2aaa9308e..4d0e4852851 100644 --- a/paddle/fluid/memory/allocation/allocator_facade.cc +++ b/paddle/fluid/memory/allocation/allocator_facade.cc @@ -493,7 +493,8 @@ class AllocatorFacadePrivate { "support allocating managed memory.\n" "If you don't actually need to use managed memory, please disable " "it with command `export FLAGS_use_cuda_managed_memory=false`.\n" - "Or you must use the gpu device that supports managed memory.")); + "Or you must use the gpu device that supports managed memory.", + p.device)); } return std::make_shared(p); } diff --git a/paddle/fluid/memory/cuda_managed_memory_test.cu b/paddle/fluid/memory/cuda_managed_memory_test.cu index 4243c5fa90f..f8c9ff82f57 100644 --- a/paddle/fluid/memory/cuda_managed_memory_test.cu +++ b/paddle/fluid/memory/cuda_managed_memory_test.cu @@ -128,6 +128,9 @@ TEST(ManagedMemoryTest, OversubscribeGPUMemoryTest) { } TEST(ManagedMemoryTest, OOMExceptionTest) { + if (!platform::IsGPUManagedMemorySupported(0)) { + return; + } EXPECT_THROW(Alloc(platform::CUDAPlace(0), size_t(1) << 60), memory::allocation::BadAlloc); } -- GitLab