Skip to content

Commit 96264cd

Browse files
committed
Fix a few CI tests for single precision
The tolerance needs to be adjusted for single precision.
1 parent af55290 commit 96264cd

File tree

6 files changed

+96
-88
lines changed

6 files changed

+96
-88
lines changed

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+
if constexpr (std::is_same_v<Real,float>) {
170+
reltol = std::max(reltol, 1.e-5F);
171+
}
169172

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

Tests/LinearSolvers/Nodal_Projection_EB/main.cpp

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

251251
// Define the relative tolerance
252-
Real reltol = 1.e-8;
252+
Real reltol;
253+
if constexpr (std::is_same_v<Real,double>) {
254+
reltol = 1.e-8;
255+
} else {
256+
reltol = 2.e-4;
257+
}
253258

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

0 commit comments

Comments
 (0)