Skip to content

Commit 0f6459d

Browse files
committed
Fix: skip MPI test for lapack UT
1 parent f96f14e commit 0f6459d

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

source/source_hsolver/test/diago_lcao_test.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,15 @@ TEST_P(DiagoGammaOnlyTest, LCAO)
302302
std::stringstream out_info;
303303
DiagoPrepare<double> dp = GetParam();
304304
ASSERT_TRUE(dp.produce_HS());
305+
306+
// Skip lapack tests in multi-process environment
307+
// LAPACK is a serial solver and cannot work with distributed matrices
308+
if (dp.ks_solver == "lapack" && dp.dsize > 1)
309+
{
310+
GTEST_SKIP() << "Skipping lapack test with " << dp.dsize
311+
<< " MPI processes (lapack only supports single process)";
312+
}
313+
305314
dp.diago();
306315

307316
if (dp.myrank == 0)
@@ -336,6 +345,15 @@ TEST_P(DiagoKPointsTest, LCAO)
336345
std::stringstream out_info;
337346
DiagoPrepare<std::complex<double>> dp = GetParam();
338347
ASSERT_TRUE(dp.produce_HS());
348+
349+
// Skip lapack tests in multi-process environment
350+
// LAPACK is a serial solver and cannot work with distributed matrices
351+
if (dp.ks_solver == "lapack" && dp.dsize > 1)
352+
{
353+
GTEST_SKIP() << "Skipping lapack test with " << dp.dsize
354+
<< " MPI processes (lapack only supports single process)";
355+
}
356+
339357
dp.diago();
340358

341359
if (dp.myrank == 0)
@@ -378,9 +396,6 @@ int main(int argc, char** argv)
378396
std::cout << "ERROR:some tests are not passed" << std::endl;
379397
return result;
380398
}
381-
else
382-
{
383-
MPI_Finalize();
384-
return 0;
385-
}
399+
MPI_Finalize();
400+
return 0;
386401
}

0 commit comments

Comments
 (0)