Skip to content

Commit a8c7ba6

Browse files
committed
add non-mpi version
1 parent ce3943e commit a8c7ba6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

source/source_base/module_device/output_device.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ int get_device_num(std::string device_flag)
106106

107107
void output_device_info(std::ostream &output)
108108
{
109+
#ifdef __MPI
109110
int world_rank, world_size;
110111
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
111112
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
@@ -146,6 +147,23 @@ void output_device_info(std::ostream &output)
146147
#endif
147148
}
148149
return;
150+
#else
151+
int cpu_sockets = get_device_num("cpu");
152+
std::string cpu_name = get_device_name("cpu");
153+
output << " RUNNING WITH DEVICE : " << "CPU" << " / "
154+
<< cpu_name << " (x" << cpu_sockets << ")" << std::endl;
155+
#if defined(__CUDA) || defined(__ROCM)
156+
if(PARAM.inp.device == "gpu")
157+
{
158+
int gpu_count = get_device_num("gpu");
159+
if(gpu_count > 0)
160+
{
161+
std::string gpu_name = get_device_name("gpu");
162+
output << " " << "GPU" << " / "
163+
<< gpu_name << " (x" << gpu_count << ")" << std::endl;
164+
}
165+
}
166+
#endif
149167
}
150168

151169
#if defined(__CUDA)

0 commit comments

Comments
 (0)