Skip to content

Commit 5bdcef8

Browse files
committed
fall back WARNING_QUIT to exit(1) with error message
1 parent 1c616e7 commit 5bdcef8

File tree

7 files changed

+8
-4
lines changed

7 files changed

+8
-4
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AddTest(
22
TARGET Module_Device_UTs
33
LIBS parameter ${math_libs} base device
4-
SOURCES memory_test.cpp device_test.cpp ../../tool_quit.cpp
4+
SOURCES memory_test.cpp device_test.cpp
55
)

source/module_base/parallel_global.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "module_base/parallel_common.h"
1616
#include "module_base/parallel_reduce.h"
1717
#include "module_parameter/parameter.h"
18-
#include "module_base/tool_quit.h"
18+
// #include "module_base/tool_quit.h"
1919
#include "version.h"
2020

2121
#include <iostream>
@@ -156,7 +156,11 @@ void Parallel_Global::read_mpi_parameters(int argc,
156156
// the user may take their own risk by set the OMP_NUM_THREADS env var.
157157
if (std::getenv("OMP_NUM_THREADS") == nullptr)
158158
{
159-
ModuleBase::WARNING_QUIT("Parallel_Global::read_mpi_parameters", "OMP_NUM_THREADS setting is invalid. Please set it to a proper value.");
159+
// usage of WARNING_QUIT need module_base/tool_quit.cpp
160+
// lead to undefined error in unit_test building
161+
// ModuleBase::WARNING_QUIT( "Parallel_Global::read_mpi_parameters","OMP_NUM_THREADS setting is invalid. Please set it to a proper value.");
162+
std::cerr << "ERROR: OMP_NUM_THREADS setting is invalid. Please set it to a proper value." << std::endl;
163+
exit(1);
160164
}
161165
}
162166
else if (current_thread_num * process_num < max_thread_num && local_rank == 0)

source/module_cell/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ AddTest(
7979
TARGET cell_ParaKpoints
8080
LIBS parameter MPI::MPI_CXX
8181
SOURCES parallel_kpoints_test.cpp ../../module_base/global_variable.cpp ../../module_base/parallel_global.cpp
82-
../../module_base/parallel_common.cpp ../../module_base/parallel_comm.cpp ../parallel_kpoints.cpp ../../module_base/tool_quit.cpp
82+
../../module_base/parallel_common.cpp ../../module_base/parallel_comm.cpp ../parallel_kpoints.cpp
8383
)
8484

8585
find_program(BASH bash)
126 KB
Binary file not shown.
120 KB
Binary file not shown.

tests/integrate/tools/sum_ENV_H2

126 KB
Binary file not shown.
120 KB
Binary file not shown.

0 commit comments

Comments
 (0)