Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename platform::GetDeviceCount into platform::GetCUDADeviceCount #4595

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion paddle/memory/memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ BuddyAllocator* GetGPUBuddyAllocator(int gpu_id) {

// GPU buddy allocator initialization
std::call_once(gpu_allocator_flag, [&]() {
int gpu_num = platform::GetDeviceCount();
int gpu_num = platform::GetCUDADeviceCount();
allocators.reserve(gpu_num);
for (int gpu = 0; gpu < gpu_num; gpu++) {
platform::SetDeviceId(gpu);
Expand Down
4 changes: 2 additions & 2 deletions paddle/platform/device_context_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TEST(Device, Init) {
using paddle::platform::CUDADeviceContext;
using paddle::platform::GPUPlace;

int count = paddle::platform::GetDeviceCount();
int count = paddle::platform::GetCUDADeviceCount();
for (int i = 0; i < count; i++) {
DeviceContext* device_context = new CUDADeviceContext(GPUPlace(i));
Eigen::GpuDevice* gpu_device =
Expand All @@ -34,7 +34,7 @@ TEST(Device, CUDADeviceContext) {
using paddle::platform::CUDADeviceContext;
using paddle::platform::GPUPlace;

int count = paddle::platform::GetDeviceCount();
int count = paddle::platform::GetCUDADeviceCount();
for (int i = 0; i < count; i++) {
CUDADeviceContext* device_context = new CUDADeviceContext(GPUPlace(i));
Eigen::GpuDevice* gpu_device = device_context->eigen_device();
Expand Down
4 changes: 2 additions & 2 deletions paddle/platform/gpu_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ DEFINE_double(fraction_of_gpu_memory_to_use, 0.95,
namespace paddle {
namespace platform {

int GetDeviceCount() {
int GetCUDADeviceCount() {
int count;
PADDLE_ENFORCE(
cudaGetDeviceCount(&count),
"cudaGetDeviceCount failed in paddle::platform::GetDeviceCount");
"cudaGetDeviceCount failed in paddle::platform::GetCUDADeviceCount");
return count;
}

Expand Down
2 changes: 1 addition & 1 deletion paddle/platform/gpu_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const std::string kEnvFractionGpuMemoryToUse =
"PADDLE_FRACTION_GPU_MEMORY_TO_USE";

//! Get the total number of GPU devices in system.
int GetDeviceCount();
int GetCUDADeviceCount();

//! Get the current GPU device id in system.
int GetCurrentDeviceId();
Expand Down