未验证 提交 9a001c09 编写于 作者: F From00 提交者: GitHub

Remove macro for GetGpuBasePtr (#39279)

上级 45f9c9eb
......@@ -244,17 +244,20 @@ class RecordedGpuMallocHelper {
#endif
}
#ifdef PADDLE_WITH_TESTING
void *GetBasePtr(void *ptr) {
#ifdef PADDLE_WITH_TESTING
auto it = gpu_ptrs.upper_bound(ptr);
if (it == gpu_ptrs.begin()) {
return nullptr;
}
return *(--it);
}
#else
PADDLE_THROW(platform::errors::Unimplemented(
"The RecordedGpuMallocHelper::GetBasePtr is only implemented with "
"testing, should not use for release."));
return nullptr;
#endif
}
bool GetMemInfo(size_t *avail, size_t *total, size_t *actual_avail,
size_t *actual_total) {
......@@ -375,11 +378,9 @@ void EmptyCache(void) {
}
}
#ifdef PADDLE_WITH_TESTING
void *GetGpuBasePtr(void *ptr, int dev_id) {
return RecordedGpuMallocHelper::Instance(dev_id)->GetBasePtr(ptr);
}
#endif
} // namespace platform
} // namespace paddle
......@@ -145,10 +145,9 @@ bool IsGpuMallocRecorded(int dev_id);
//! Empty idle cached memory held by the allocator.
void EmptyCache(void);
//! Get the primitive pointer return from cudaMalloc, just for testing
#ifdef PADDLE_WITH_TESTING
//! Get the primitive pointer return from cudaMalloc, just implemented with
//! testing, do not use for release
void *GetGpuBasePtr(void *ptr, int dev_id);
#endif
} // namespace platform
} // namespace paddle
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册