Skip to content

Commit 9ac67b3

Browse files
authored
Tests: Simplify MODULE_HSOLVER test to reduce time consumption (#6980)
* Do not do unit tests on big input to reduce time consumption * Do not do unit tests on big input Si64 to reduce time consumption * Fix typo * Further reduce random test size
1 parent 08ba134 commit 9ac67b3

File tree

8 files changed

+31
-26
lines changed

8 files changed

+31
-26
lines changed

source/source_hsolver/test/diago_bpcg_test.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,11 @@ INSTANTIATE_TEST_SUITE_P(VerifyCG,
201201
DiagoBPCGTest,
202202
::testing::Values(
203203
// nband, npw, sparsity, reorder, eps, maxiter, threshold
204-
DiagoBPCGPrepare(10, 500, 0, true, 1e-5, 300, 5e-2),
205-
DiagoBPCGPrepare(20, 500, 6, true, 1e-5, 300, 5e-2),
206-
DiagoBPCGPrepare(20, 1000, 8, true, 1e-5, 300, 5e-2),
207-
DiagoBPCGPrepare(40, 1000, 8, true, 1e-6, 300, 5e-2)));
204+
DiagoBPCGPrepare(10, 500, 0, true, 1e-5, 300, 5e-2)
205+
// DiagoBPCGPrepare(20, 500, 6, true, 1e-5, 300, 5e-2)
206+
// DiagoBPCGPrepare(20, 1000, 8, true, 1e-5, 300, 5e-2),
207+
// DiagoBPCGPrepare(40, 1000, 8, true, 1e-6, 300, 5e-2)
208+
));
208209
//DiagoBPCGPrepare(40, 2000, 8, true, 1e-5, 500, 1e-2)));
209210
// the last one is passed but time-consumming.
210211

@@ -251,7 +252,7 @@ TEST(DiagoBPCGTest, readH)
251252
// read Hamilt matrix from file data-H
252253
std::vector<std::complex<double>> hm;
253254
std::ifstream ifs;
254-
std::string filename = "H-KPoints-Si64.dat";
255+
std::string filename = "H-KPoints-Si2.dat";
255256
ifs.open(filename);
256257
// open file and check status
257258
if (!ifs.is_open())

source/source_hsolver/test/diago_cg_float_test.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,11 @@ INSTANTIATE_TEST_SUITE_P(VerifyCG,
239239
DiagoCGFloatTest,
240240
::testing::Values(
241241
// nband, npw, sparsity, reorder, eps, maxiter, threshold
242-
DiagoCGPrepare(10, 200, 0, true, 1e-6, 300, 1e-0),
243-
DiagoCGPrepare(10, 200, 6, true, 1e-6, 300, 1e-0),
244-
DiagoCGPrepare(10, 400, 8, true, 1e-6, 300, 1e-0),
245-
DiagoCGPrepare(10, 600, 8, true, 1e-6, 300, 1e-0)));
242+
DiagoCGPrepare(10, 200, 0, true, 1e-6, 300, 1e-0)
243+
// DiagoCGPrepare(10, 200, 6, true, 1e-6, 300, 1e-0)
244+
// DiagoCGPrepare(10, 400, 8, true, 1e-6, 300, 1e-0),
245+
// DiagoCGPrepare(10, 600, 8, true, 1e-6, 300, 1e-0)
246+
));
246247
//DiagoCGPrepare(40, 2000, 8, true, 1e-5, 500, 1e-2)));
247248
// the last one is passed but time-consumming.
248249

@@ -312,7 +313,7 @@ TEST(DiagoCGFloatTest, readH)
312313
// read Hamilt matrix from file data-H
313314
std::vector<std::complex<float>> hm;
314315
std::ifstream ifs;
315-
std::string filename = "H-KPoints-Si64.dat";
316+
std::string filename = "H-KPoints-Si2.dat";
316317
// open file and check status
317318
ifs.open(filename);
318319
if (!ifs.is_open())

source/source_hsolver/test/diago_cg_real_test.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,11 @@ INSTANTIATE_TEST_SUITE_P(VerifyCG,
240240
DiagoCGTest,
241241
::testing::Values(
242242
// nband, npw, sparsity, reorder, eps, maxiter, threshold
243-
DiagoCGPrepare(10, 500, 0, true, 1e-5, 300, 1e-3),
244-
DiagoCGPrepare(20, 500, 6, true, 1e-5, 300, 1e-3),
245-
DiagoCGPrepare(20, 1000, 8, true, 1e-5, 300, 1e-3),
246-
DiagoCGPrepare(40, 1000, 8, true, 1e-6, 300, 1e-3)));
243+
DiagoCGPrepare(10, 500, 0, true, 1e-5, 300, 1e-3)
244+
// DiagoCGPrepare(20, 500, 6, true, 1e-5, 300, 1e-3)
245+
// DiagoCGPrepare(20, 1000, 8, true, 1e-5, 300, 1e-3),
246+
// DiagoCGPrepare(40, 1000, 8, true, 1e-6, 300, 1e-3)
247+
));
247248
//DiagoCGPrepare(40, 2000, 8, true, 1e-5, 500, 1e-2)));
248249
// the last one is passed but time-consumming.
249250

@@ -289,7 +290,7 @@ TEST(DiagoCGTest, readH)
289290
// read Hamilt matrix from file data-H
290291
std::vector<double> hm;
291292
std::ifstream ifs;
292-
std::string filename = "H-GammaOnly-Si64.dat";
293+
std::string filename = "H-GammaOnly-Si2.dat";
293294
ifs.open(filename);
294295
// open file and check status
295296
if (!ifs.is_open())

source/source_hsolver/test/diago_cg_test.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,11 @@ INSTANTIATE_TEST_SUITE_P(VerifyCG,
234234
DiagoCGTest,
235235
::testing::Values(
236236
// nband, npw, sparsity, reorder, eps, maxiter, threshold
237-
DiagoCGPrepare(10, 500, 0, true, 1e-5, 300, 1e-3),
238-
DiagoCGPrepare(20, 500, 6, true, 1e-5, 300, 1e-3),
239-
DiagoCGPrepare(20, 1000, 8, true, 1e-5, 300, 1e-3),
240-
DiagoCGPrepare(40, 1000, 8, true, 1e-6, 300, 1e-3)));
237+
DiagoCGPrepare(10, 500, 0, true, 1e-5, 300, 1e-3)
238+
// DiagoCGPrepare(20, 500, 6, true, 1e-5, 300, 1e-3)
239+
// DiagoCGPrepare(20, 1000, 8, true, 1e-5, 300, 1e-3),
240+
// DiagoCGPrepare(40, 1000, 8, true, 1e-6, 300, 1e-3)
241+
));
241242
//DiagoCGPrepare(40, 2000, 8, true, 1e-5, 500, 1e-2)));
242243
// the last one is passed but time-consumming.
243244

@@ -307,7 +308,7 @@ TEST(DiagoCGTest, readH)
307308
// read Hamilt matrix from file data-H
308309
std::vector<std::complex<double>> hm;
309310
std::ifstream ifs;
310-
std::string filename = "H-KPoints-Si64.dat";
311+
std::string filename = "H-KPoints-Si2.dat";
311312
ifs.open(filename);
312313
// open file and check status
313314
if (!ifs.is_open())

source/source_hsolver/test/diago_david_float_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ TEST(DiagoDavRealSystemTest,dataH)
197197
{
198198
std::vector<std::complex<float>> hmatrix;
199199
std::ifstream ifs;
200-
std::string filename = "H-KPoints-Si64.dat";
200+
std::string filename = "H-KPoints-Si2.dat";
201201
ifs.open(filename);
202202
// open file and check status
203203
if (!ifs.is_open())

source/source_hsolver/test/diago_david_real_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ TEST(DiagoDavRealSystemTest, dataH)
195195
{
196196
std::vector<double> hmatrix;
197197
std::ifstream ifs;
198-
std::string filename = "H-GammaOnly-Si64.dat";
198+
std::string filename = "H-GammaOnly-Si2.dat";
199199
ifs.open(filename);
200200
// open file and check status
201201
if (!ifs.is_open())

source/source_hsolver/test/diago_david_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ TEST(DiagoDavRealSystemTest, dataH)
201201
{
202202
std::vector<std::complex<double>> hmatrix;
203203
std::ifstream ifs;
204-
std::string filename = "H-KPoints-Si64.dat";
204+
std::string filename = "H-KPoints-Si2.dat";
205205
ifs.open(filename);
206206
// open file and check status
207207
if (!ifs.is_open())

source/source_hsolver/test/diago_lcao_test.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,10 @@ INSTANTIATE_TEST_SUITE_P(
333333
DiagoPrepare<double>(0, 0, 32, 0, "genelpa", "H-GammaOnly-Si64.dat", "S-GammaOnly-Si64.dat"),
334334
#endif
335335
DiagoPrepare<double>(0, 0, 1, 0, "scalapack_gvx", "H-GammaOnly-Si2.dat", "S-GammaOnly-Si2.dat"),
336-
DiagoPrepare<double>(0, 0, 32, 0, "scalapack_gvx", "H-GammaOnly-Si64.dat", "S-GammaOnly-Si64.dat"),
337-
DiagoPrepare<double>(0, 0, 1, 0, "lapack", "H-GammaOnly-Si2.dat", "S-GammaOnly-Si2.dat"),
338-
DiagoPrepare<double>(0, 0, 32, 0, "lapack", "H-GammaOnly-Si64.dat", "S-GammaOnly-Si64.dat")));
336+
// DiagoPrepare<double>(0, 0, 32, 0, "scalapack_gvx", "H-GammaOnly-Si64.dat", "S-GammaOnly-Si64.dat"),
337+
DiagoPrepare<double>(0, 0, 1, 0, "lapack", "H-GammaOnly-Si2.dat", "S-GammaOnly-Si2.dat")
338+
// DiagoPrepare<double>(0, 0, 32, 0, "lapack", "H-GammaOnly-Si64.dat", "S-GammaOnly-Si64.dat")
339+
));
339340

340341
class DiagoKPointsTest : public ::testing::TestWithParam<DiagoPrepare<std::complex<double>>>
341342
{

0 commit comments

Comments
 (0)