Commit 4894c068 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

removed fpe handling (speedup of 50% for ensmean ...).

parent 4bc54ea7
2017-04-14 Uwe Schulzweida
* removed fpe handling (speedup of 50% for ensmean ...)
2017-04-13 Uwe Schulzweida 2017-04-13 Uwe Schulzweida
* Using CDI library version 1.8.1 * Using CDI library version 1.8.1
......
...@@ -45,8 +45,8 @@ int array_minmaxsum_val(size_t len, const double *array, double *rmin, double *r ...@@ -45,8 +45,8 @@ int array_minmaxsum_val(size_t len, const double *array, double *rmin, double *r
int array_minmaxmean_val(size_t len, const double *array, double *rmin, double *rmax, double *rmean) int array_minmaxmean_val(size_t len, const double *array, double *rmin, double *rmax, double *rmean)
{ {
int excepts = FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW; // int excepts = FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW;
feclearexcept(FE_ALL_EXCEPT); // feclearexcept(FE_ALL_EXCEPT); // expensive !!!!
double min = DBL_MAX; double min = DBL_MAX;
double max = -DBL_MAX; double max = -DBL_MAX;
...@@ -67,14 +67,15 @@ int array_minmaxmean_val(size_t len, const double *array, double *rmin, double * ...@@ -67,14 +67,15 @@ int array_minmaxmean_val(size_t len, const double *array, double *rmin, double *
if ( rmax ) *rmax = max; if ( rmax ) *rmax = max;
if ( rmean ) *rmean = mean; if ( rmean ) *rmean = mean;
return fetestexcept(excepts); // return fetestexcept(excepts);
return 0;
} }
int array_mean_val_weighted(size_t len, const double *restrict array, const double *restrict w, double missval, double *rmean) int array_mean_val_weighted(size_t len, const double *restrict array, const double *restrict w, double missval, double *rmean)
{ {
int excepts = FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW; // int excepts = FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW;
feclearexcept(FE_ALL_EXCEPT); // feclearexcept(FE_ALL_EXCEPT); // expensive !!!!
double rsum = 0, rsumw = 0; double rsum = 0, rsumw = 0;
...@@ -86,19 +87,21 @@ int array_mean_val_weighted(size_t len, const double *restrict array, const doub ...@@ -86,19 +87,21 @@ int array_mean_val_weighted(size_t len, const double *restrict array, const doub
*rmean = DBL_IS_EQUAL(rsumw, 0.) ? missval : rsum/rsumw; *rmean = DBL_IS_EQUAL(rsumw, 0.) ? missval : rsum/rsumw;
return fetestexcept(excepts); // return fetestexcept(excepts);
return 0;
} }
int array_add_array(size_t len, double *restrict array1, const double *restrict array2) int array_add_array(size_t len, double *restrict array1, const double *restrict array2)
{ {
int excepts = FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW; // int excepts = FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW;
feclearexcept(FE_ALL_EXCEPT); // feclearexcept(FE_ALL_EXCEPT); // expensive !!!!
//#if defined(_OPENMP) //#if defined(_OPENMP)
//#pragma omp parallel for default(none) shared(array1,array2) //#pragma omp parallel for default(none) shared(array1,array2)
//#endif //#endif
for ( size_t i = 0; i < len; i++ ) array1[i] += array2[i]; for ( size_t i = 0; i < len; i++ ) array1[i] += array2[i];
return fetestexcept(excepts); // return fetestexcept(excepts);
return 0;
} }
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