From f2edee750ab9b044e9b744b9c9fe683457e703c1 Mon Sep 17 00:00:00 2001 From: ZPaC Date: Tue, 9 Mar 2021 09:09:17 +0800 Subject: [PATCH] Add device id log --- mindspore/ccsrc/backend/session/gpu_session.cc | 2 +- mindspore/ccsrc/runtime/device/gpu/cuda_driver.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mindspore/ccsrc/backend/session/gpu_session.cc b/mindspore/ccsrc/backend/session/gpu_session.cc index 45f94f51f6..fd3453749a 100644 --- a/mindspore/ccsrc/backend/session/gpu_session.cc +++ b/mindspore/ccsrc/backend/session/gpu_session.cc @@ -95,7 +95,7 @@ void GPUSession::Init(uint32_t device_id) { } bool ret = device::gpu::CudaDriver::set_current_device(UintToInt(device_id)); if (!ret) { - MS_LOG(EXCEPTION) << "GPUSession failed to set current device id."; + MS_LOG(EXCEPTION) << "GPUSession failed to set current device id:" << device_id; } auto ms_context = MsContext::GetInstance(); MS_EXCEPTION_IF_NULL(ms_context); diff --git a/mindspore/ccsrc/runtime/device/gpu/cuda_driver.cc b/mindspore/ccsrc/runtime/device/gpu/cuda_driver.cc index 6c077391e9..d0e7b668d8 100644 --- a/mindspore/ccsrc/runtime/device/gpu/cuda_driver.cc +++ b/mindspore/ccsrc/runtime/device/gpu/cuda_driver.cc @@ -241,7 +241,8 @@ int CudaDriver::device_count() { bool CudaDriver::set_current_device(int index) { auto ret = cudaSetDevice(index); if (ret != cudaSuccess) { - MS_LOG(ERROR) << "cudaSetDevice failed, ret[" << static_cast(ret) << "], " << cudaGetErrorString(ret); + MS_LOG(ERROR) << "cudaSetDevice " << index << " failed, ret[" << static_cast(ret) << "], " + << cudaGetErrorString(ret); return false; } return true;