Commit c13ec7d8 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

remaplib: fix data race in calculation of bin_addr (OpenMP)

parent a5c89205
2011-01-15 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* remaplib: fix data race in calculation of bin_addr (OpenMP)
2011-01-12 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2011-01-12 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* detrend: integer overflow; wrong result for nts > 46340 (bug fix) [report: Torsten Seifert] * detrend: integer overflow; wrong result for nts > 46340 (bug fix) [report: Torsten Seifert]
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
Name: cdo Name: cdo
#BuildRequires: #BuildRequires:
Version: 1.4.8rc1 Version: 1.4.8rc2
Release: 1 Release: 1
Summary: Climate Data Operators Summary: Climate Data Operators
License: GNU GENERAL PUBLIC LICENSE Version 2, June 1991 License: GNU GENERAL PUBLIC LICENSE Version 2, June 1991
......
...@@ -1158,8 +1158,13 @@ void remapGridInit(int map_type, int lextrapolate, int gridID1, int gridID2, rem ...@@ -1158,8 +1158,13 @@ void remapGridInit(int map_type, int lextrapolate, int gridID1, int gridID2, rem
if ( rg->grid1_bound_box[nele4 ] <= rg->bin_lats[n*2+1] && if ( rg->grid1_bound_box[nele4 ] <= rg->bin_lats[n*2+1] &&
rg->grid1_bound_box[nele4+1] >= rg->bin_lats[n*2 ] ) rg->grid1_bound_box[nele4+1] >= rg->bin_lats[n*2 ] )
{ {
rg->bin_addr1[n*2 ] = MIN(nele, rg->bin_addr1[n*2 ]); #if defined (_OPENMP)
rg->bin_addr1[n*2+1] = MAX(nele, rg->bin_addr1[n*2+1]); #pragma omp critical
#endif
{
rg->bin_addr1[n*2 ] = MIN(nele, rg->bin_addr1[n*2 ]);
rg->bin_addr1[n*2+1] = MAX(nele, rg->bin_addr1[n*2+1]);
}
} }
} }
...@@ -1175,8 +1180,13 @@ void remapGridInit(int map_type, int lextrapolate, int gridID1, int gridID2, rem ...@@ -1175,8 +1180,13 @@ void remapGridInit(int map_type, int lextrapolate, int gridID1, int gridID2, rem
if ( rg->grid2_bound_box[nele4 ] <= rg->bin_lats[n*2+1] && if ( rg->grid2_bound_box[nele4 ] <= rg->bin_lats[n*2+1] &&
rg->grid2_bound_box[nele4+1] >= rg->bin_lats[n*2 ] ) rg->grid2_bound_box[nele4+1] >= rg->bin_lats[n*2 ] )
{ {
rg->bin_addr2[n*2 ] = MIN(nele, rg->bin_addr2[n*2 ]); #if defined (_OPENMP)
rg->bin_addr2[n*2+1] = MAX(nele, rg->bin_addr2[n*2+1]); #pragma omp critical
#endif
{
rg->bin_addr2[n*2 ] = MIN(nele, rg->bin_addr2[n*2 ]);
rg->bin_addr2[n*2+1] = MAX(nele, rg->bin_addr2[n*2+1]);
}
} }
} }
...@@ -2040,7 +2050,7 @@ void remap_bilin(remapgrid_t *rg, remapvars_t *rv) ...@@ -2040,7 +2050,7 @@ void remap_bilin(remapgrid_t *rg, remapvars_t *rv)
#endif #endif
for ( dst_add = 0; dst_add < rg->grid2_size; dst_add++ ) for ( dst_add = 0; dst_add < rg->grid2_size; dst_add++ )
{ {
if ( ompNumThreads == 1 && cdoTimer ) progressStatus(0, 1, (dst_add+1.)/rg->grid2_size); if ( ompNumThreads == 1 ) progressStatus(0, 1, (dst_add+1.)/rg->grid2_size);
if ( ! rg->grid2_mask[dst_add] ) continue; if ( ! rg->grid2_mask[dst_add] ) continue;
...@@ -2273,7 +2283,7 @@ void remap_bicub(remapgrid_t *rg, remapvars_t *rv) ...@@ -2273,7 +2283,7 @@ void remap_bicub(remapgrid_t *rg, remapvars_t *rv)
#endif #endif
for ( dst_add = 0; dst_add < rg->grid2_size; dst_add++ ) for ( dst_add = 0; dst_add < rg->grid2_size; dst_add++ )
{ {
if ( ompNumThreads == 1 && cdoTimer ) progressStatus(0, 1, (dst_add+1.)/rg->grid2_size); if ( ompNumThreads == 1 ) progressStatus(0, 1, (dst_add+1.)/rg->grid2_size);
if ( ! rg->grid2_mask[dst_add] ) continue; if ( ! rg->grid2_mask[dst_add] ) continue;
...@@ -2699,7 +2709,7 @@ void remap_distwgt(remapgrid_t *rg, remapvars_t *rv) ...@@ -2699,7 +2709,7 @@ void remap_distwgt(remapgrid_t *rg, remapvars_t *rv)
#endif #endif
for ( dst_add = 0; dst_add < grid2_size; dst_add++ ) for ( dst_add = 0; dst_add < grid2_size; dst_add++ )
{ {
if ( ompNumThreads == 1 && cdoTimer ) progressStatus(0, 1, (dst_add+1.)/grid2_size); if ( ompNumThreads == 1 ) progressStatus(0, 1, (dst_add+1.)/grid2_size);
if ( ! rg->grid2_mask[dst_add] ) continue; if ( ! rg->grid2_mask[dst_add] ) continue;
...@@ -2928,7 +2938,7 @@ void remap_distwgt1(remapgrid_t *rg, remapvars_t *rv) ...@@ -2928,7 +2938,7 @@ void remap_distwgt1(remapgrid_t *rg, remapvars_t *rv)
#endif #endif
for ( dst_add = 0; dst_add < grid2_size; dst_add++ ) for ( dst_add = 0; dst_add < grid2_size; dst_add++ )
{ {
if ( ompNumThreads == 1 && cdoTimer ) progressStatus(0, 1, (dst_add+1.)/grid2_size); if ( ompNumThreads == 1 ) progressStatus(0, 1, (dst_add+1.)/grid2_size);
if ( ! rg->grid2_mask[dst_add] ) continue; if ( ! rg->grid2_mask[dst_add] ) continue;
...@@ -4428,7 +4438,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv) ...@@ -4428,7 +4438,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
srch_add = srch_add2[ompthID]; srch_add = srch_add2[ompthID];
#endif #endif
if ( ompNumThreads == 1 && cdoTimer ) progressStatus(0, 0.5, (grid1_add+1.)/grid1_size); if ( ompNumThreads == 1 ) progressStatus(0, 0.5, (grid1_add+1.)/grid1_size);
/* restrict searches first using search bins */ /* restrict searches first using search bins */
...@@ -4700,7 +4710,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv) ...@@ -4700,7 +4710,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
srch_add = srch_add2[ompthID]; srch_add = srch_add2[ompthID];
#endif #endif
if ( ompNumThreads == 1 && cdoTimer ) progressStatus(0.5, 0.5, (grid2_add+1.)/grid2_size); if ( ompNumThreads == 1 ) progressStatus(0.5, 0.5, (grid2_add+1.)/grid2_size);
/* restrict searches first using search bins */ /* restrict searches first using search bins */
......
Supports Markdown
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