Skip to content

Commit ff9c283

Browse files
committed
make test/finufft*dmany* exit code insensitive to one-mode errors (just consistency chk vs ntrans=1); fixes random CI fails and fixes #594
1 parent 3b64523 commit ff9c283

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

test/finufft1dmany_test.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const char *help[] = {
1010
"Usage: finufft1dmany_test ntrans Nmodes Nsrc [tol [debug [spread_thread "
1111
"[maxbatchsize [spreadsort [upsampfac [errfail]]]]]]]",
1212
"\teg:\tfinufft1dmany_test 100 1e3 1e4 1e-6 1 0 0 2 0.0 1e-5",
13-
"\tnotes:\tif errfail present, exit code 1 if any error > errfail",
13+
"\tnotes:\tif errfail present, exit code 1 if consistency error > errfail",
1414
NULL};
1515
// Malleo 2019 based on Shih 2018. Tidied, extra args, Barnett 5/25/20 onwards
1616

@@ -83,7 +83,6 @@ int main(int argc, char *argv[]) {
8383
Ft += c[j + i * M] * exp(J * (nt1 * x[j])); // crude direct
8484
BIGINT it = N / 2 + nt1; // index in complex F as 1d array
8585
err = abs(Ft - F[it + i * N]) / infnorm(N, F + i * N);
86-
errmax = max(err, errmax);
8786
printf("\tone mode: rel err in F[%lld] of trans#%d is %.3g\n", (long long)nt1, i, err);
8887

8988
// compare the result with FINUFFT1D1
@@ -143,8 +142,7 @@ int main(int argc, char *argv[]) {
143142
// #pragma omp parallel for schedule(static,TEST_RANDCHUNK) reduction(cmplxadd:ct)
144143
for (BIGINT m1 = -k0; m1 <= (N - 1) / 2; ++m1)
145144
ct += F[i * N + m++] * exp(IMA * ((FLT)(isign * m1)) * x[jt]); // crude direct
146-
err = abs(ct - c[jt + i * M]) / infnorm(M, c + i * M);
147-
errmax = max(err, errmax);
145+
err = abs(ct - c[jt + i * M]) / infnorm(M, c + i * M);
148146
printf("\tone targ: rel err in c[%lld] of trans#%d is %.3g\n", (long long)jt, i, err);
149147

150148
// check against single calls to FINUFFT1D2...
@@ -209,8 +207,7 @@ int main(int argc, char *argv[]) {
209207
// #pragma omp parallel for schedule(static,TEST_RANDCHUNK) reduction(cmplxadd:Ft)
210208
for (BIGINT j = 0; j < M; ++j)
211209
Ft += c[j + i * M] * exp(IMA * (FLT)isign * s[kt] * x[j]);
212-
err = abs(Ft - F[kt + i * N]) / infnorm(N, F + i * N);
213-
errmax = max(err, errmax);
210+
err = abs(Ft - F[kt + i * N]) / infnorm(N, F + i * N);
214211
printf("\tone targ: rel err in F[%lld] of trans#%d is %.3g\n", (long long)kt, i, err);
215212

216213
// compare the result with single calls to FINUFFT1D3...

test/finufft2dmany_test.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const char *help[] = {
1010
"Usage: finufft2dmany_test ntrans Nmodes1 Nmodes2 Nsrc [tol [debug [spread_thread "
1111
"[maxbatchsize [spreadsort [upsampfac [errfail]]]]]]]",
1212
"\teg:\tfinufft2dmany_test 100 1e2 1e2 1e5 1e-6 1 0 0 2 0.0 1e-5",
13-
"\tnotes:\tif errfail present, exit code 1 if any error > errfail",
13+
"\tnotes:\tif errfail present, exit code 1 if consistency error > errfail",
1414
NULL};
1515
// Melody Shih Jun 2018; Barnett removed many_seq 7/27/18. Extra args 5/21/20.
1616

@@ -89,7 +89,6 @@ int main(int argc, char *argv[]) {
8989
Ft += c[j + i * M] * exp(J * (nt1 * x[j] + nt2 * y[j])); // crude direct
9090
BIGINT it = N1 / 2 + nt1 + N1 * (N2 / 2 + nt2); // index in complex F as 1d array
9191
err = abs(Ft - F[it + i * N]) / infnorm(N, F + i * N);
92-
errmax = max(err, errmax);
9392
printf("\tone mode: rel err in F[%lld,%lld] of trans#%d is %.3g\n", (long long)nt1,
9493
(long long)nt2, i, err);
9594

@@ -153,8 +152,7 @@ int main(int argc, char *argv[]) {
153152
for (BIGINT m2 = -(N2 / 2); m2 <= (N2 - 1) / 2; ++m2) // loop in correct order over F
154153
for (BIGINT m1 = -(N1 / 2); m1 <= (N1 - 1) / 2; ++m1)
155154
ct += F[i * N + m++] * exp(J * (m1 * x[jt] + m2 * y[jt])); // crude direct
156-
err = abs(ct - c[jt + i * M]) / infnorm(M, c + i * M);
157-
errmax = max(err, errmax);
155+
err = abs(ct - c[jt + i * M]) / infnorm(M, c + i * M);
158156
printf("\tone targ: rel err in c[%lld] of trans#%d is %.3g\n", (long long)jt, i, err);
159157

160158
// compare the result with single calls to FINUFFT2D2...
@@ -226,8 +224,7 @@ int main(int argc, char *argv[]) {
226224
Ft = CPX(0, 0);
227225
for (BIGINT j = 0; j < M; ++j)
228226
Ft += c[i * M + j] * exp(J * (s_freq[kt] * x[j] + t_freq[kt] * y[j]));
229-
err = abs(Ft - F[kt + i * N]) / infnorm(N, F + i * N);
230-
errmax = max(err, errmax);
227+
err = abs(Ft - F[kt + i * N]) / infnorm(N, F + i * N);
231228
printf("\tone targ: rel err in F[%lld] of trans#%d is %.3g\n", (long long)kt, i, err);
232229

233230
// compare the result with FINUFFT2D3...

test/finufft3dmany_test.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const char *help[] = {
1010
"Usage: finufft3dmany_test ntrans Nmodes1 Nmodes2 Nmodes3 Nsrc [tol [debug "
1111
"[spread_thread [maxbatchsize [spreadsort [upsampfac [errfail]]]]]]]",
1212
"\teg:\tfinufft3dmany_test 100 50 50 50 1e5 1e-3 1 0 0 2 0.0 1e-2",
13-
"\tnotes:\tif errfail present, exit code 1 if any error > errfail",
13+
"\tnotes:\tif errfail present, exit code 1 if consistency error > errfail",
1414
NULL};
1515
// Malleo 2019 based on Shih 2018. Tidied, extra args, Barnett 5/25/20.
1616

@@ -97,8 +97,7 @@ int main(int argc, char *argv[]) {
9797
// complex
9898
// F as 1d
9999
// array
100-
err = abs(Ft - F[it + i * N]) / infnorm(N, F + i * N);
101-
errmax = max(err, errmax);
100+
err = abs(Ft - F[it + i * N]) / infnorm(N, F + i * N);
102101
printf("\tone mode: rel err in F[%lld,%lld,%lld] of trans#%d is %.3g\n", (long long)nt1,
103102
(long long)nt2, (long long)nt3, i, err);
104103

@@ -167,8 +166,7 @@ int main(int argc, char *argv[]) {
167166
}
168167
}
169168
}
170-
err = abs(ct - c[jt + i * M]) / infnorm(M, c + i * M);
171-
errmax = max(err, errmax);
169+
err = abs(ct - c[jt + i * M]) / infnorm(M, c + i * M);
172170
printf("\tone targ: rel err in c[%lld] of trans#%d is %.3g\n", (long long)jt, i, err);
173171

174172
finufft_fft_forget_wisdom();
@@ -246,8 +244,7 @@ int main(int argc, char *argv[]) {
246244
for (BIGINT j = 0; j < M; ++j)
247245
Ft += c[i * M + j] *
248246
exp(J * (s_freq[kt] * x[j] + t_freq[kt] * y[j] + u_freq[kt] * z[j]));
249-
err = abs(Ft - F[kt + i * N]) / infnorm(N, F + i * N);
250-
errmax = max(err, errmax);
247+
err = abs(Ft - F[kt + i * N]) / infnorm(N, F + i * N);
251248
printf("\t one targ: rel err in F[%lld] of trans#%d is %.3g\n", (long long)kt, i, err);
252249

253250
finufft_fft_forget_wisdom();

0 commit comments

Comments
 (0)