Skip to content

Commit 551925d

Browse files
authored
Fix a few CI tests for single precision (#4785)
The tolerance needs to be adjusted for single precision.
1 parent e5be0d7 commit 551925d

File tree

7 files changed

+98
-87
lines changed

7 files changed

+98
-87
lines changed

Tests/Algebra/GMRES/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ int main (int argc, char* argv[])
113113
amrex::Axpy(xvec, Real(-1.0), exact);
114114
auto error = xvec.norminf();
115115
amrex::Print() << " Max norm error: " << error << "\n";
116+
#ifdef AMREX_USE_FLOAT
117+
AMREX_ALWAYS_ASSERT(error < eps);
118+
#else
116119
AMREX_ALWAYS_ASSERT(error*10 < eps);
120+
#endif
117121
}
118122
amrex::Finalize();
119123
}

Tests/CommType/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ int main(int argc, char* argv[])
1212
int ret_code = EXIT_SUCCESS;
1313

1414
{
15-
int ncells = 128;
15+
int ncells = 64;
1616
BoxArray ba(Box(IntVect(0), IntVect(ncells-1)));
17-
ba.maxSize(32);
17+
ba.maxSize(16);
1818
ba.convert(IntVect(1));
1919
DistributionMapping dm(ba);
2020

Tests/FFT/Batch/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ int main (int argc, char* argv[])
106106
auto error = mf2.norminf(0, batch_size, IntVect(0));
107107
amrex::Print() << " Expected to be close to zero: " << error << "\n";
108108
#ifdef AMREX_USE_FLOAT
109-
auto eps = 1.e-6f;
109+
auto eps = 3.e-6F;
110110
#else
111111
auto eps = 1.e-13;
112112
#endif
@@ -133,7 +133,7 @@ int main (int argc, char* argv[])
133133
auto error = errmf.norminf(0, batch_size, IntVect(0));
134134
amrex::Print() << " Expected to be close to zero: " << error << "\n";
135135
#ifdef AMREX_USE_FLOAT
136-
auto eps = 0.5e-6f;
136+
auto eps = 3.e-6F;
137137
#else
138138
auto eps = 1.e-15;
139139
#endif
@@ -156,7 +156,7 @@ int main (int argc, char* argv[])
156156
auto error = mf2.norminf(0, batch_size, IntVect(0));
157157
amrex::Print() << " Expected to be close to zero: " << error << "\n";
158158
#ifdef AMREX_USE_FLOAT
159-
auto eps = 1.e-6f;
159+
auto eps = 3.e-6F;
160160
#else
161161
auto eps = 1.e-13;
162162
#endif

Tests/FFT/RawPtr/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int main (int argc, char* argv[])
6969
});
7070
amrex::Print() << " Expected to be close to zero: " << error << "\n";
7171
#ifdef AMREX_USE_FLOAT
72-
auto eps = 1.e-6f;
72+
auto eps = 3.e-6F;
7373
#else
7474
auto eps = 1.e-13;
7575
#endif
@@ -124,7 +124,7 @@ int main (int argc, char* argv[])
124124
});
125125
amrex::Print() << " Expected to be close to zero: " << error << "\n";
126126
#ifdef AMREX_USE_FLOAT
127-
auto eps = 1.e-6f;
127+
auto eps = 3.e-6F;
128128
#else
129129
auto eps = 1.e-13;
130130
#endif

Tests/LinearSolvers/NodalPoisson/MyTest.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ MyTest::readParameters ()
166166
pp.query("max_iter", max_iter);
167167
pp.query("max_fmg_iter", max_fmg_iter);
168168
pp.query("reltol", reltol);
169+
#ifdef AMREX_USE_FLOAT
170+
reltol = std::max(reltol, 1.e-5F);
171+
#endif
169172

170173
pp.query("gpu_regtest", gpu_regtest);
171174

Tests/LinearSolvers/Nodal_Projection_EB/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,11 @@ int main (int argc, char* argv[])
249249
// nodal_solver.setBottomSolver(MLMG::BottomSolver::hypre);
250250

251251
// Define the relative tolerance
252+
#ifdef AMREX_USE_FLOAT
253+
Real reltol = 2.e-4;
254+
#else
252255
Real reltol = 1.e-8;
256+
#endif
253257

254258
// Define the absolute tolerance; note that this argument is optional
255259
Real abstol = 1.e-15;

Tests/Parser/main.cpp

Lines changed: 80 additions & 80 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)