33#include " gpu_runtime.h"
44
55#include " source_base/tool_quit.h"
6- #include " source_io/module_parameter/parameter.h"
76
87#include < base/macros/macros.h>
98#include < cstring>
@@ -92,7 +91,7 @@ int get_device_num(std::string device_flag)
9291 return 0 ;
9392}
9493
95- void output_device_info (std::ostream &output)
94+ void output_device_info (std::ostream &output, const std::string& device )
9695{
9796#ifdef __MPI
9897 int world_rank, world_size;
@@ -105,7 +104,7 @@ void output_device_info(std::ostream &output)
105104 // Get local hardware info
106105 int local_gpu_count = 0 ;
107106 #if defined(__CUDA) || defined(__ROCM)
108- if (PARAM . inp . device == " gpu" && local_rank == 0 )
107+ if (device == " gpu" && local_rank == 0 )
109108 {
110109 local_gpu_count = get_device_num (" gpu" );
111110 }
@@ -129,7 +128,7 @@ void output_device_info(std::ostream &output)
129128 std::string cpu_name = get_device_name (" cpu" );
130129 std::string gpu_name;
131130 #if defined(__CUDA) || defined(__ROCM)
132- if (PARAM . inp . device == " gpu" && total_gpus > 0 )
131+ if (device == " gpu" && total_gpus > 0 )
133132 {
134133 gpu_name = get_device_name (" gpu" );
135134 }
@@ -139,7 +138,7 @@ void output_device_info(std::ostream &output)
139138 output << " RUNNING WITH DEVICE : " << " CPU" << " / "
140139 << cpu_name << " (x" << total_cpus << " )" << std::endl;
141140 #if defined(__CUDA) || defined(__ROCM)
142- if (PARAM . inp . device == " gpu" && total_gpus > 0 )
141+ if (device == " gpu" && total_gpus > 0 )
143142 {
144143 output << " " << " GPU" << " / "
145144 << gpu_name << " (x" << total_gpus << " )" << std::endl;
@@ -152,7 +151,7 @@ void output_device_info(std::ostream &output)
152151 output << " RUNNING WITH DEVICE : " << " CPU" << " / "
153152 << cpu_name << " (x" << cpu_sockets << " )" << std::endl;
154153 #if defined(__CUDA) || defined(__ROCM)
155- if (PARAM . inp . device == " gpu" )
154+ if (device == " gpu" )
156155 {
157156 int gpu_count = get_device_num (" gpu" );
158157 if (gpu_count > 0 )
0 commit comments