Permalink
Browse files

Fix openmp bug in example-f.f90

  • Loading branch information...
dmalhotra committed Nov 19, 2018
1 parent b0903d9 commit b4d6fc8cd5e9f7d9106069484af0ac53e73ee0fd
Showing with 6 additions and 5 deletions.
  1. +1 −1 Makefile.am
  2. +4 −3 examples/src/example-c.c
  3. +1 −1 examples/src/example-f.f90
@@ -1,5 +1,5 @@
ACLOCAL_AMFLAGS = -I m4 $(ACLOCAL_FLAGS)
AUTOMAKE_OPTIONS = subdir-objects
AUTOMAKE_OPTIONS = subdir-objects foreign
@SET_MAKE@
include MakeVariables.in
@@ -62,12 +62,13 @@ void test_FMM(void* ctx) { // Compare FMM and direct evaluation results
BiotSavart(&src_X[0], &src_V[0], Ns, &trg_X[0], &trg_V0[0], Nt);
printf("Direct evaluation time : %f\n", tt + omp_get_wtime());
double max_err = 0;
double max_err = 0, max_val = 0;
for (long i = 0; i < Nt * kdim[1]; i++) { // Compute error
double err = fabs(trg_V[i] - trg_V0[i]);
double val = fabs(trg_V0[i]), err = fabs(trg_V[i] - trg_V0[i]);
if (val > max_val) max_val = val;
if (err > max_err) max_err = err;
}
printf("Max-error : %f\n", max_err);
printf("Max relative error : %e\n", max_err / max_val);
free(src_X);
free(src_V);
@@ -38,7 +38,7 @@ subroutine BiotSavart(Xs, Vs, Ns, Xt, Vt, Nt)
real*8 :: oofp, X(3), rinv, rinv3
oofp = 1/(16*atan(1.0))
!$omp parallel do
!$omp parallel do private(s,X,rinv,rinv3)
do t = 0, Nt-1
Vt(t*3+1) = 0
Vt(t*3+2) = 0

0 comments on commit b4d6fc8

Please sign in to comment.