diff --git a/mindspore/ccsrc/runtime/device/gpu/gpu_device_manager.cc b/mindspore/ccsrc/runtime/device/gpu/gpu_device_manager.cc index 233dffe5b72..b95ea082c8d 100644 --- a/mindspore/ccsrc/runtime/device/gpu/gpu_device_manager.cc +++ b/mindspore/ccsrc/runtime/device/gpu/gpu_device_manager.cc @@ -25,6 +25,9 @@ namespace device { namespace gpu { void GPUDeviceManager::InitDevice() { CHECK_OP_RET_WITH_EXCEPT(CudaDriver::SetDevice(SizeToInt(cur_dev_id_)), "Failed to set current device id"); + if (dev_alive_) { + return; + } CHECK_OP_RET_WITH_EXCEPT(CreateStream(&default_stream_), "Failed to create CUDA stream."); CHECK_CUDNN_RET_WITH_EXCEPT_NOTRACE(cudnnCreate(&cudnn_handle_), "Failed to create cuDNN handle"); CHECK_CUDNN_RET_WITH_EXCEPT_NOTRACE(cudnnSetStream(cudnn_handle_, reinterpret_cast(default_stream())), diff --git a/tests/st/dump/test_data_dump.py b/tests/st/dump/test_data_dump.py index 1da98e73942..43234ef226a 100644 --- a/tests/st/dump/test_data_dump.py +++ b/tests/st/dump/test_data_dump.py @@ -90,6 +90,9 @@ def run_e2e_dump(): if context.get_context("device_target") == "Ascend": assert len(os.listdir(dump_file_path)) == 5 output_name = "Add.Add-op1.0.0.*.output.0.DefaultFormat.npy" + elif context.get_context("device_target") == "CPU": + assert len(os.listdir(dump_file_path)) == 5 + output_name = "Add.Add-op3.0.0.*.output.0.DefaultFormat.npy" else: assert len(os.listdir(dump_file_path)) == 3 output_name = "Add.Add-op3.0.0.*.output.0.DefaultFormat.npy"