Skip to content

Commit 2391a68

Browse files
committed
Fix MPI bug
1 parent 0a40350 commit 2391a68

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

source/module_base/test/math_chebyshev_test.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ class MathChebyshevTest : public testing::Test
107107

108108
TEST_F(MathChebyshevTest, calcoef_real)
109109
{
110+
#ifdef __MPI
111+
#undef __MPI
112+
#endif
110113
auto fun_x6 = [&](double x) { return fun.x6(x); };
111114
auto fun_x7 = [&](double x) { return fun.x7(x); };
112115
p_chetest = new ModuleBase::Chebyshev<double>(10);
@@ -130,6 +133,9 @@ TEST_F(MathChebyshevTest, calcoef_real)
130133

131134
TEST_F(MathChebyshevTest, calcoef_pair)
132135
{
136+
#ifdef __MPI
137+
#undef __MPI
138+
#endif
133139
auto fun_x6 = [&](double x) { return fun.x6(x); };
134140
auto fun_x7 = [&](double x) { return fun.x7(x); };
135141
p_chetest = new ModuleBase::Chebyshev<double>(10);
@@ -148,6 +154,9 @@ TEST_F(MathChebyshevTest, calcoef_pair)
148154

149155
TEST_F(MathChebyshevTest, calcoef_complex)
150156
{
157+
#ifdef __MPI
158+
#undef __MPI
159+
#endif
151160
auto fun_expi = [&](std::complex<double> x) { return fun.expi(x); };
152161
const int norder = 100;
153162
const double PI = 3.14159265358979323846;
@@ -169,6 +178,9 @@ TEST_F(MathChebyshevTest, calcoef_complex)
169178

170179
TEST_F(MathChebyshevTest, calfinalvec_real)
171180
{
181+
#ifdef __MPI
182+
#undef __MPI
183+
#endif
172184
const int norder = 100;
173185
const double E = 2.718281828459046;
174186
p_chetest = new ModuleBase::Chebyshev<double>(norder);
@@ -203,6 +215,9 @@ TEST_F(MathChebyshevTest, calfinalvec_real)
203215

204216
TEST_F(MathChebyshevTest, calfinalvec_complex)
205217
{
218+
#ifdef __MPI
219+
#undef __MPI
220+
#endif
206221
const int norder = 100;
207222
const double E = 2.718281828459046;
208223
p_chetest = new ModuleBase::Chebyshev<double>(norder);
@@ -237,6 +252,9 @@ TEST_F(MathChebyshevTest, calfinalvec_complex)
237252

238253
TEST_F(MathChebyshevTest, calpolyvec_complex)
239254
{
255+
#ifdef __MPI
256+
#undef __MPI
257+
#endif
240258
const int norder = 100;
241259
const double E = 2.718281828459046;
242260
p_chetest = new ModuleBase::Chebyshev<double>(norder);
@@ -284,6 +302,9 @@ TEST_F(MathChebyshevTest, calpolyvec_complex)
284302

285303
TEST_F(MathChebyshevTest, tracepolyA)
286304
{
305+
#ifdef __MPI
306+
#undef __MPI
307+
#endif
287308
const int norder = 100;
288309
p_chetest = new ModuleBase::Chebyshev<double>(norder);
289310

@@ -384,6 +405,9 @@ TEST_F(MathChebyshevTest, checkconverge)
384405

385406
TEST_F(MathChebyshevTest, recurs)
386407
{
408+
#ifdef __MPI
409+
#undef __MPI
410+
#endif
387411
testing::internal::CaptureStdout();
388412
EXPECT_EXIT(ModuleBase::Chebyshev<double> noneche(0), ::testing::ExitedWithCode(1), "");
389413
std::string output = testing::internal::GetCapturedStdout();
@@ -399,6 +423,9 @@ TEST_F(MathChebyshevTest, recurs)
399423
#ifdef __ENABLE_FLOAT_FFTW
400424
TEST_F(MathChebyshevTest, calcoef_real_float)
401425
{
426+
#ifdef __MPI
427+
#undef __MPI
428+
#endif
402429
auto fun_x6f = [&](float x) { return fun.x6(x); };
403430
auto fun_x7f = [&](float x) { return fun.x7(x); };
404431
p_fchetest = new ModuleBase::Chebyshev<float>(10);
@@ -421,6 +448,9 @@ TEST_F(MathChebyshevTest, calcoef_real_float)
421448

422449
TEST_F(MathChebyshevTest, calcoef_pair_float)
423450
{
451+
#ifdef __MPI
452+
#undef __MPI
453+
#endif
424454
auto fun_x6f = [&](float x) { return fun.x6(x); };
425455
auto fun_x7f = [&](float x) { return fun.x7(x); };
426456
p_fchetest = new ModuleBase::Chebyshev<float>(10);
@@ -439,6 +469,9 @@ TEST_F(MathChebyshevTest, calcoef_pair_float)
439469

440470
TEST_F(MathChebyshevTest, calcoef_complex_float)
441471
{
472+
#ifdef __MPI
473+
#undef __MPI
474+
#endif
442475
auto fun_expif = [&](std::complex<float> x) { return fun.expi(x); };
443476
const int norder = 100;
444477
const float PI = 3.14159265358979323846;
@@ -460,6 +493,9 @@ TEST_F(MathChebyshevTest, calcoef_complex_float)
460493

461494
TEST_F(MathChebyshevTest, calfinalvec_real_float)
462495
{
496+
#ifdef __MPI
497+
#undef __MPI
498+
#endif
463499
const int norder = 100;
464500
const float E = 2.718281828459046;
465501
p_fchetest = new ModuleBase::Chebyshev<float>(norder);
@@ -494,6 +530,9 @@ TEST_F(MathChebyshevTest, calfinalvec_real_float)
494530

495531
TEST_F(MathChebyshevTest, calfinalvec_complex_float)
496532
{
533+
#ifdef __MPI
534+
#undef __MPI
535+
#endif
497536
const int norder = 100;
498537
const float E = 2.718281828459046;
499538
p_fchetest = new ModuleBase::Chebyshev<float>(norder);
@@ -528,6 +567,9 @@ TEST_F(MathChebyshevTest, calfinalvec_complex_float)
528567

529568
TEST_F(MathChebyshevTest, calpolyvec_float)
530569
{
570+
#ifdef __MPI
571+
#undef __MPI
572+
#endif
531573
const int norder = 100;
532574
const float E = 2.718281828459046;
533575
p_fchetest = new ModuleBase::Chebyshev<float>(norder);
@@ -575,6 +617,9 @@ TEST_F(MathChebyshevTest, calpolyvec_float)
575617

576618
TEST_F(MathChebyshevTest, tracepolyA_float)
577619
{
620+
#ifdef __MPI
621+
#undef __MPI
622+
#endif
578623
const int norder = 100;
579624
p_fchetest = new ModuleBase::Chebyshev<float>(norder);
580625

@@ -624,6 +669,9 @@ TEST_F(MathChebyshevTest, tracepolyA_float)
624669

625670
TEST_F(MathChebyshevTest, checkconverge_float)
626671
{
672+
#ifdef __MPI
673+
#undef __MPI
674+
#endif
627675
const int norder = 100;
628676
p_fchetest = new ModuleBase::Chebyshev<float>(norder);
629677

source/module_base/test/opt_CG_test.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifdef __MPI
2+
#undef __MPI
3+
#endif
14
#include "gtest/gtest.h"
25
#include "../opt_CG.h"
36
#include "../opt_DCsrch.h"

source/module_base/test/opt_test_tools.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifdef __MPI
2+
#undef __MPI
3+
#endif
14
#include "./opt_test_tools.h"
25
#include <math.h>
36

0 commit comments

Comments
 (0)