Skip to content

Commit eac9cd0

Browse files
committed
Fix float test robustness and remove GlobalV reference from MPI test
The single-precision BLOCK_SUBSPACE test drifted to the upper eigenvalues on some platforms, so compute all eigenvalues (nband == n_dim) to remove the spectrum ambiguity. Drop the GlobalV::NPROC_IN_POOL assignment in the MPI test: the pooled reductions use POOL_WORLD, not that global.
1 parent a488645 commit eac9cd0

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

source/source_hsolver/test/diago_ppcg_float_test.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,14 @@ static void gram_schmidt(std::vector<T>& psi, int ld, int n_dim, int nband)
7474
}
7575

7676
// -----------------------------------------------------------------------------
77-
// Diagonal matrix: H = diag(1, 2, 3, 4, 5)
77+
// Diagonal matrix: H = diag(1, 2, 3). All eigenvalues are computed (nband ==
78+
// n_dim), so there is no ambiguity about which end of the spectrum to converge
79+
// to; single-precision Rayleigh-Ritz can otherwise drift toward the upper
80+
// eigenvalues on some platforms.
7881
// -----------------------------------------------------------------------------
7982
TEST(DiagoPPCGFloatTest, DiagonalBlockSubspace)
8083
{
81-
const int n_dim = 5;
84+
const int n_dim = 3;
8285
const int nband = 3;
8386
const int ld = n_dim;
8487

source/source_hsolver/test/diago_ppcg_parallel_test.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include "source_base/parallel_comm.h"
1616
#include "source_base/parallel_global.h"
17-
#include "source_base/global_variable.h"
1817
#include "source_basis/module_pw/test/test_tool.h"
1918

2019
#include "mpi.h"
@@ -36,7 +35,6 @@ int main(int argc, char** argv)
3635
int rank_in_pool = 0;
3736
divide_pools(nproc, myrank, nproc_in_pool, kpar, mypool, rank_in_pool);
3837
MPI_Comm_split(MPI_COMM_WORLD, myrank, 0, &BP_WORLD);
39-
GlobalV::NPROC_IN_POOL = nproc;
4038

4139
using T = std::complex<double>;
4240
using Real = double;

0 commit comments

Comments
 (0)