From 83c9fb328170c42bf2056d33021c55b2dc668ada Mon Sep 17 00:00:00 2001 From: Uwe Schulzweida <uwe.schulzweida@mpimet.mpg.de> Date: Fri, 27 Jun 2014 12:11:48 +0000 Subject: [PATCH] cgribexlib update --- configure | 20 +++++++------- configure.ac | 2 +- src/cgribexlib.c | 69 +++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 74 insertions(+), 17 deletions(-) diff --git a/configure b/configure index 6c33d4053..ffea8d681 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for cdi 1.6.4rc4. +# Generated by GNU Autoconf 2.68 for cdi 1.6.4. # # Report bugs to <http://code.zmaw.de/projects/cdi>. # @@ -570,8 +570,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cdi' PACKAGE_TARNAME='cdi' -PACKAGE_VERSION='1.6.4rc4' -PACKAGE_STRING='cdi 1.6.4rc4' +PACKAGE_VERSION='1.6.4' +PACKAGE_STRING='cdi 1.6.4' PACKAGE_BUGREPORT='http://code.zmaw.de/projects/cdi' PACKAGE_URL='' @@ -1442,7 +1442,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures cdi 1.6.4rc4 to adapt to many kinds of systems. +\`configure' configures cdi 1.6.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1512,7 +1512,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of cdi 1.6.4rc4:";; + short | recursive ) echo "Configuration of cdi 1.6.4:";; esac cat <<\_ACEOF @@ -1699,7 +1699,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -cdi configure 1.6.4rc4 +cdi configure 1.6.4 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2460,7 +2460,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by cdi $as_me 1.6.4rc4, which was +It was created by cdi $as_me 1.6.4, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -3405,7 +3405,7 @@ fi # Define the identity of the package. PACKAGE='cdi' - VERSION='1.6.4rc4' + VERSION='1.6.4' cat >>confdefs.h <<_ACEOF @@ -28417,7 +28417,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by cdi $as_me 1.6.4rc4, which was +This file was extended by cdi $as_me 1.6.4, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -28483,7 +28483,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -cdi config.status 1.6.4rc4 +cdi config.status 1.6.4 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index fbd297c23..86b5c9ccf 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ # autoconf 2.68 # libtool 2.4.2 -AC_INIT([cdi], [1.6.4rc4], [http://code.zmaw.de/projects/cdi]) +AC_INIT([cdi], [1.6.4], [http://code.zmaw.de/projects/cdi]) echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}" diff --git a/src/cgribexlib.c b/src/cgribexlib.c index ae06fe140..6e968f88f 100644 --- a/src/cgribexlib.c +++ b/src/cgribexlib.c @@ -1,5 +1,5 @@ -/* Automatically generated by m214003 at 2014-05-28, do not edit */ +/* Automatically generated by m214003 at 2014-06-27, do not edit */ /* CGRIBEXLIB_VERSION="1.6.4" */ @@ -640,14 +640,16 @@ gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL minmax_val.c orig : fmin: -500000 fmax: 499999 time: 4.84s sse2 : fmin: -500000 fmax: 499999 time: 4.82s -gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL minmax_val.c +gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL -fopenmp -DOMP_SIMD minmax_val.c result on thunder5 (gcc 4.7.2): orig : fmin: -500000 fmax: 499999 time: 3.10s + simd : fmin: -500000 fmax: 499999 time: 3.23s # omp simd in gcc 4.9 avx : fmin: -500000 fmax: 499999 time: 2.84s -icc -g -Wall -O3 -march=native -std=c99 -vec-report=1 -DTEST_MINMAXVAL minmax_val.c - result on thunder5 (icc 13.1.2): +icc -g -Wall -O3 -march=native -std=c99 -vec-report=1 -DTEST_MINMAXVAL -openmp -DOMP_SIMD minmax_val.c + result on thunder5 (icc 14.0.2): orig : fmin: -500000 fmax: 499999 time: 2.83s + simd : fmin: -500000 fmax: 499999 time: 2.83s avx : fmin: -500000 fmax: 499999 time: 2.92s xlc_r -g -O3 -qhot -q64 -qarch=auto -qtune=auto -qreport -DTEST_MINMAXVAL minmax_val.c @@ -978,6 +980,43 @@ void minmax_val_orig(const double *restrict data, long idatasize, double *fmin, #pragma GCC pop_options #endif +// TEST +#if defined(OMP_SIMD) + +//#pragma omp declare reduction(xmin : double : omp_out = omp:in > omp_out ? omp_out : omp_in) +// initializer( omp_priv = { largenumber }) +//#pragma omp declare reduction(xmax : double : omp_out = omp:in < omp_out ? omp_out : omp_in) +// initializer( omp_priv = { -largenumber }) + +#if defined(GNUC_PUSH_POP) +#pragma GCC push_options +#pragma GCC optimize ("O3", "fast-math") +#endif +static +void minmax_val_simd(const double *restrict data, long idatasize, double *fmin, double *fmax) +{ + size_t i; + size_t datasize = idatasize; + double dmin = *fmin, dmax = *fmax; + +#if defined(_OPENMP) + //#pragma omp simd reduction(xmin:dmin) reduction(xmax:dmax) +#pragma omp simd +#endif + for ( i = 0; i < datasize; ++i ) + { + dmin = dmin < data[i] ? dmin : data[i]; + dmax = dmax > data[i] ? dmax : data[i]; + } + + *fmin = dmin; + *fmax = dmax; +} +#if defined(GNUC_PUSH_POP) +#pragma GCC pop_options +#endif +#endif + static void minmax_val(const double *restrict data, long idatasize, double *fmin, double *fmax) { @@ -1083,6 +1122,10 @@ int main(void) double fmin, fmax; double t_begin, t_end; +#if defined(_OPENMP) + printf("_OPENMP=%d\n", _OPENMP); +#endif + #if defined(__ICC) printf("icc\n"); #elif defined(__clang__) @@ -1093,7 +1136,10 @@ int main(void) data = (double*) malloc(datasize*sizeof(double)); - for ( long i = datasize-1; i >= 0; i-- ) data[i] = (double) (-datasize/2 + i); + // for ( long i = datasize-1; i >= 0; i-- ) data[i] = (double) (-datasize/2 + i); + for ( long i = 0; i < datasize/2; i++ ) data[i] = (double) (i); + for ( long i = datasize/2; i < datasize; i++ ) data[i] = (double) (-datasize + i); + // for ( long i = 0; i < datasize; i++ ) printf("%d %g\n", i, data[i]); t_begin = dtime(); for ( int i = 0; i < NRUN; ++i ) @@ -1113,6 +1159,17 @@ int main(void) t_end = dtime(); printf("orig : fmin: %ld fmax: %ld time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin); +#if defined(OMP_SIMD) + t_begin = dtime(); + for ( int i = 0; i < NRUN; ++i ) + { + fmin = fmax = data[0]; + minmax_val_simd(data, datasize, &fmin, &fmax); + } + t_end = dtime(); + printf("simd : fmin: %ld fmax: %ld time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin); +#endif + #if defined(_ENABLE_AVX) t_begin = dtime(); for ( int i = 0; i < NRUN; ++i ) @@ -10842,7 +10899,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu return (gribLen); } -static const char grb_libvers[] = "1.6.4" " of ""May 28 2014"" ""11:22:51"; +static const char grb_libvers[] = "1.6.4" " of ""Jun 27 2014"" ""14:00:04"; const char * cgribexLibraryVersion(void) { -- GitLab