Commit 28d6cf00 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

EOF: data race , wrong result with multiple OpenMP threads (bug fix)

parent 3f760564
Pipeline #5675 passed with stages
in 14 minutes and 54 seconds
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
* Version 1.9.10 release * Version 1.9.10 release
2021-01-11 Uwe Schulzweida
* EOF: data race , wrong result with multiple OpenMP threads (bug fix)
2021-01-05 Uwe Schulzweida 2021-01-05 Uwe Schulzweida
* Added option --ignore_time_bounds to ignore time bounds for time range statistics * Added option --ignore_time_bounds to ignore time bounds for time range statistics
......
...@@ -8,6 +8,7 @@ Version 1.9.10 (29 January 2021): ...@@ -8,6 +8,7 @@ Version 1.9.10 (29 January 2021):
New features: New features:
* Added option --ignore_time_bounds to ignore time bounds for time range statistics * Added option --ignore_time_bounds to ignore time bounds for time range statistics
Fixed bugs: Fixed bugs:
* EOF: fix wrong result with multiple OpenMP threads (data race)
* timselmean: failed with variables on different grids [Bug #9978] * timselmean: failed with variables on different grids [Bug #9978]
* Ymonarith: failed with variables on different grids * Ymonarith: failed with variables on different grids
* Detrend: wrong result with parameter equal=false [Bug #9961] * Detrend: wrong result with parameter equal=false [Bug #9961]
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include "datetime.h" #include "datetime.h"
#include "eof_mode.h" #include "eof_mode.h"
// NO MISSING VALUE SUPPORT ADDED SO FAR // No missing value support added so far!
static void static void
scale_eigvec_grid(Varray<double> &out, int tsID, size_t npack, const std::vector<size_t> &pack, const Varray<double> &weight, scale_eigvec_grid(Varray<double> &out, int tsID, size_t npack, const std::vector<size_t> &pack, const Varray<double> &weight,
...@@ -169,9 +169,9 @@ EOFs(void *process) ...@@ -169,9 +169,9 @@ EOFs(void *process)
for (int index = 1; index < ngrids; index++) for (int index = 1; index < ngrids; index++)
if (vlistGrid(vlistID1, 0) != vlistGrid(vlistID1, index)) cdoAbort("Too many different grids!"); if (vlistGrid(vlistID1, 0) != vlistGrid(vlistID1, index)) cdoAbort("Too many different grids!");
/* eigenvalues */ // eigenvalues
/* COUNT NUMBER OF TIMESTEPS if EOF_ or EOF_TIME */ // Count number of timesteps if EOF_ or EOF_TIME
if (operfunc == EOF_ || operfunc == EOF_TIME) if (operfunc == EOF_ || operfunc == EOF_TIME)
{ {
if (Options::cdoVerbose) cdoPrint("Counting timesteps in ifile"); if (Options::cdoVerbose) cdoPrint("Counting timesteps in ifile");
...@@ -471,13 +471,13 @@ EOFs(void *process) ...@@ -471,13 +471,13 @@ EOFs(void *process)
eofdata[varID][levelID].eig_val.resize(nts); eofdata[varID][levelID].eig_val.resize(nts);
#ifdef _OPENMP
#pragma omp parallel for default(shared) schedule(dynamic)
#endif
for (int j1 = 0; j1 < nts; j1++) for (int j1 = 0; j1 < nts; j1++)
{ {
const auto &df1p = data[j1]; const auto &df1p = data[j1];
for (int j2 = 0; j2 < j1; j2++) covar[j1][j2] = covar[j2][j1]; for (int j2 = 0; j2 < j1; j2++) covar[j1][j2] = covar[j2][j1];
#ifdef _OPENMP
#pragma omp parallel for default(shared) schedule(dynamic)
#endif
for (int j2 = j1; j2 < nts; j2++) for (int j2 = j1; j2 < nts; j2++)
{ {
const auto &df2p = data[j2]; const auto &df2p = data[j2];
...@@ -492,7 +492,7 @@ EOFs(void *process) ...@@ -492,7 +492,7 @@ EOFs(void *process)
if (Options::Timer) timer_stop(timer_cov); if (Options::Timer) timer_stop(timer_cov);
// SOLVE THE EIGEN PROBLEM // Solve the eigen problem
if (Options::Timer) timer_start(timer_eig); if (Options::Timer) timer_start(timer_eig);
auto &eig_val = eofdata[varID][levelID].eig_val; auto &eig_val = eofdata[varID][levelID].eig_val;
......
...@@ -334,7 +334,7 @@ cdo_usage() ...@@ -334,7 +334,7 @@ cdo_usage()
fprintf(stderr, " Use option --operators for a list of all operators.\n"); fprintf(stderr, " Use option --operators for a list of all operators.\n");
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fprintf(stderr, " CDO version %s, Copyright (C) 2003-2020 Uwe Schulzweida\n", VERSION); fprintf(stderr, " CDO version %s, Copyright (C) 2003-2021 Uwe Schulzweida\n", VERSION);
fprintf(stderr, " This is free software and comes with ABSOLUTELY NO WARRANTY\n"); fprintf(stderr, " This is free software and comes with ABSOLUTELY NO WARRANTY\n");
fprintf(stderr, " Report bugs to <https://mpimet.mpg.de/cdo>\n"); fprintf(stderr, " Report bugs to <https://mpimet.mpg.de/cdo>\n");
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment