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

cgribexlib update

parent c2a7b034
/* Automatically generated by m214003 at 2013-07-10, do not edit */ /* Automatically generated by m214003 at 2013-07-11, do not edit */
/* CGRIBEXLIB_VERSION="1.6.2" */ /* CGRIBEXLIB_VERSION="1.6.2" */
...@@ -639,14 +639,6 @@ double intpow2(int x) ...@@ -639,14 +639,6 @@ double intpow2(int x)
//#undef _GET_MACH_COUNTER //#undef _GET_MACH_COUNTER
//#undef _ARCH_PWR6 //#undef _ARCH_PWR6
#if defined(__GNUC__) && (__GNUC__ >= 4)
#elif defined(__ICC) && (__ICC >= 1100)
#elif defined(__clang__)
#define ENABLE_SIMD
#else
#define DISABLE_SIMD
#endif
#if defined _GET_IBM_COUNTER #if defined _GET_IBM_COUNTER
#include <libhpc.h> #include <libhpc.h>
#elif defined _GET_X86_COUNTER #elif defined _GET_X86_COUNTER
...@@ -655,38 +647,45 @@ double intpow2(int x) ...@@ -655,38 +647,45 @@ double intpow2(int x)
#include <mach/mach_time.h> #include <mach/mach_time.h>
#endif #endif
#if defined(__GNUC__) && (__GNUC__ >= 4)
#elif defined(__ICC) && (__ICC >= 1100)
#elif defined(__clang__)
#else
#define DISABLE_SIMD
#endif
#define DISABLE_SIMD #define DISABLE_SIMD
#undef ENABLE_SIMD
#ifdef DISABLE_SIMD #ifdef DISABLE_SIMD
#ifdef ENABLE_AVX # ifdef ENABLE_AVX
#define ENABLE_SIMD # define _ENABLE_AVX
#else # endif
#undef __AVX__ # ifdef ENABLE_SSE2
#endif # define _ENABLE_SSE2
#ifdef ENABLE_SSE2 # endif
#define ENABLE_SIMD
#else
#undef __SSE2__
#endif
#endif #endif
#if defined (ENABLE_SIMD) #ifndef DISABLE_SIMD
# ifdef __AVX__
# define _ENABLE_AVX
# endif
# ifdef __SSE2__
# define _ENABLE_SSE2
# endif
#endif
#if defined __AVX__
#include <float.h> #include <float.h>
#include <stdint.h> #include <stdint.h>
#include <inttypes.h> #include <inttypes.h>
#if defined _ENABLE_AVX
#include <immintrin.h> #include <immintrin.h>
#elif defined __SSE2__ #elif defined _ENABLE_SSE2
#include <float.h>
#include <stdint.h>
#include <inttypes.h>
#include <emmintrin.h> #include <emmintrin.h>
#endif #endif
#if defined __AVX__ #if defined _ENABLE_AVX
static static
void avx_minmax_val(const double *restrict buf, size_t nframes, double *min, double *max) void avx_minmax_val(const double *restrict buf, size_t nframes, double *min, double *max)
...@@ -780,7 +779,7 @@ void avx_minmax_val(const double *restrict buf, size_t nframes, double *min, dou ...@@ -780,7 +779,7 @@ void avx_minmax_val(const double *restrict buf, size_t nframes, double *min, dou
return; return;
} }
#elif defined __SSE2__ #elif defined _ENABLE_SSE2
static static
void sse2_minmax_val(const double *restrict buf, size_t nframes, double *min, double *max) void sse2_minmax_val(const double *restrict buf, size_t nframes, double *min, double *max)
...@@ -857,9 +856,7 @@ void sse2_minmax_val(const double *restrict buf, size_t nframes, double *min, do ...@@ -857,9 +856,7 @@ void sse2_minmax_val(const double *restrict buf, size_t nframes, double *min, do
return; return;
} }
#endif #endif // SIMD
#endif // ENABLE_SIMD
#ifdef _ARCH_PWR6 #ifdef _ARCH_PWR6
static static
...@@ -959,11 +956,11 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl ...@@ -959,11 +956,11 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl
start_minmax = mach_absolute_time(); start_minmax = mach_absolute_time();
#endif #endif
#if defined __AVX__ && defined (ENABLE_SIMD) #if defined _ENABLE_AVX
avx_minmax_val(data, datasize, fmin, fmax); avx_minmax_val(data, datasize, fmin, fmax);
#elif defined __SSE2__ && defined (ENABLE_SIMD) #elif defined _ENABLE_SSE2
sse2_minmax_val(data, datasize, fmin, fmax); sse2_minmax_val(data, datasize, fmin, fmax);
...@@ -1008,28 +1005,37 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl ...@@ -1008,28 +1005,37 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl
#ifdef _GET_MACH_COUNTER #ifdef _GET_MACH_COUNTER
end_minmax = mach_absolute_time(); end_minmax = mach_absolute_time();
#endif #endif
#if defined __AVX__ #if defined _ENABLE_AVX
printf("AVX minmax cycles:: %" PRIu64 "\n", printf("AVX minmax cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
end_minmax-start_minmax);
fprintf (stderr, "AVX min: %lf max: %lf\n", *fmin, *fmax); fprintf (stderr, "AVX min: %lf max: %lf\n", *fmin, *fmax);
#elif defined __SSE2__ #elif defined _ENABLE_SSE2
printf("SSE2 minmax cycles:: %" PRIu64 "\n", printf("SSE2 minmax cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
end_minmax-start_minmax);
fprintf (stderr, "SSE2 min: %lf max: %lf\n", *fmin, *fmax); fprintf (stderr, "SSE2 min: %lf max: %lf\n", *fmin, *fmax);
#else #else
printf("loop minmax cycles:: %" PRIu64 "\n", printf("loop minmax cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
end_minmax-start_minmax);
fprintf (stderr, "loop min: %lf max: %lf\n", *fmin, *fmax); fprintf (stderr, "loop min: %lf max: %lf\n", *fmin, *fmax);
#endif #endif
#endif #endif
return; return;
} }
#undef DISABLE_SIMD
#undef _ENABLE_AVX
#undef _ENABLE_SSE2
//#undef _GET_X86_COUNTER //#undef _GET_X86_COUNTER
//#undef _GET_MACH_COUNTER //#undef _GET_MACH_COUNTER
//#undef _GET_IBM_COUNTER //#undef _GET_IBM_COUNTER
//#undef _ARCH_PWR6 //#undef _ARCH_PWR6
#if defined _GET_IBM_COUNTER
#include <libhpc.h>
#elif defined _GET_X86_COUNTER
#include <x86intrin.h>
#elif defined _GET_MACH_COUNTER
#include <mach/mach_time.h>
#endif
#include <stdint.h> #include <stdint.h>
#if defined(__GNUC__) && (__GNUC__ >= 4) #if defined(__GNUC__) && (__GNUC__ >= 4)
...@@ -1039,32 +1045,33 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl ...@@ -1039,32 +1045,33 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl
#define DISABLE_SIMD #define DISABLE_SIMD
#endif #endif
#if defined _GET_IBM_COUNTER
#include <libhpc.h>
#elif defined _GET_X86_COUNTER
#include <x86intrin.h>
#elif defined _GET_MACH_COUNTER
#include <mach/mach_time.h>
#endif
//#define DISABLE_SIMD //#define DISABLE_SIMD
#ifdef DISABLE_SIMD #ifdef DISABLE_SIMD
#ifndef ENABLE_AVX # ifdef ENABLE_AVX
#undef __AVX__ # define _ENABLE_AVX
#endif # endif
#ifndef ENABLE_SSE4_1 # ifdef ENABLE_SSE4_1
#undef __SSE4_1__ # define _ENABLE_SSE4_1
# endif
#endif #endif
#ifndef DISABLE_SIMD
# ifdef __AVX__
# define _ENABLE_AVX
# endif
# ifdef __SSE4_1__
# define _ENABLE_SSE4_1
# endif
#endif #endif
#if defined __AVX__ #if defined _ENABLE_AVX
#include <immintrin.h> #include <immintrin.h>
#elif defined __SSE4_1__ #elif defined _ENABLE_SSE4_1
#include <smmintrin.h> #include <smmintrin.h>
#endif #endif
#if defined __AVX__ #if defined _ENABLE_AVX
static static
void avx_encode_double_array_2byte(size_t datasize, void avx_encode_double_array_2byte(size_t datasize,
...@@ -1165,7 +1172,7 @@ void avx_encode_double_array_2byte(size_t datasize, ...@@ -1165,7 +1172,7 @@ void avx_encode_double_array_2byte(size_t datasize,
return; return;
} }
#elif defined __SSE4_1__ #elif defined _ENABLE_SSE4_1
static static
void sse41_encode_double_array_2byte(size_t datasize, void sse41_encode_double_array_2byte(size_t datasize,
...@@ -1424,11 +1431,11 @@ void encode_double_array_byte(int numBits, size_t packStart, size_t datasize, ...@@ -1424,11 +1431,11 @@ void encode_double_array_byte(int numBits, size_t packStart, size_t datasize,
start_minmax = mach_absolute_time(); start_minmax = mach_absolute_time();
#endif #endif
#if defined __AVX__ #if defined _ENABLE_AVX
avx_encode_double_array_2byte(datasize, lGrib, data, zref, factor, &z); avx_encode_double_array_2byte(datasize, lGrib, data, zref, factor, &z);
#elif defined __SSE4_1__ #elif defined _ENABLE_SSE4_1
sse41_encode_double_array_2byte(datasize, lGrib, data, zref, factor, &z); sse41_encode_double_array_2byte(datasize, lGrib, data, zref, factor, &z);
...@@ -1444,15 +1451,12 @@ void encode_double_array_byte(int numBits, size_t packStart, size_t datasize, ...@@ -1444,15 +1451,12 @@ void encode_double_array_byte(int numBits, size_t packStart, size_t datasize,
#elif defined _GET_MACH_COUNTER #elif defined _GET_MACH_COUNTER
end_minmax = mach_absolute_time(); end_minmax = mach_absolute_time();
#endif #endif
#if defined __AVX__ #if defined _ENABLE_AVX
printf("AVX encoding cycles:: %" PRIu64 "\n", printf("AVX encoding cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
end_minmax-start_minmax); #elif defined _ENABLE_SSE4_1
#elif defined __SSE4_1__ printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n",
end_minmax-start_minmax);
#else #else
printf("loop encoding cycles:: %" PRIu64 "\n", printf("loop encoding cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
end_minmax-start_minmax);
#endif #endif
#endif #endif
...@@ -1759,6 +1763,10 @@ void encode_double_array_unrolled(int numBits, size_t packStart, size_t datasize ...@@ -1759,6 +1763,10 @@ void encode_double_array_unrolled(int numBits, size_t packStart, size_t datasize
*gz = z; *gz = z;
#undef __UNROLL_DEPTH_2 #undef __UNROLL_DEPTH_2
} }
#undef DISABLE_SIMD
#undef _ENABLE_AVX
#undef _ENABLE_SSE4_1
//#undef _GET_X86_COUNTER //#undef _GET_X86_COUNTER
//#undef _GET_MACH_COUNTER //#undef _GET_MACH_COUNTER
//#undef _GET_IBM_COUNTER //#undef _GET_IBM_COUNTER
...@@ -1775,21 +1783,38 @@ void encode_double_array_unrolled(int numBits, size_t packStart, size_t datasize ...@@ -1775,21 +1783,38 @@ void encode_double_array_unrolled(int numBits, size_t packStart, size_t datasize
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#include <inttypes.h> #include <inttypes.h>
/* #if defined(__GNUC__) && (__GNUC__ >= 4)
#if ((__GNUC__ >= 4) || (__ICC >= 1100) || defined (__clang__)) #elif defined(__ICC) && (__ICC >= 1100)
#define _ENABLE_SIMD #elif defined(__clang__)
#include <immintrin.h> #else
#undef __AVX #define DISABLE_SIMD
#ifdef __AVX__
#define _ENABLE_AVX
#elif __SSE4_1__
#define _ENABLE_SSE4_1
#endif #endif
#define DISABLE_SIMD
#ifdef DISABLE_SIMD
# ifdef ENABLE_AVX
# define _ENABLE_AVX
# endif
# ifdef ENABLE_SSE4_1
# define _ENABLE_SSE4_1
# endif
#endif #endif
*/
#undef _ENABLE_AVX #ifndef DISABLE_SIMD
#undef _ENABLE_SSE4_1 # ifdef __AVX__
# define _ENABLE_AVX
# endif
# ifdef __SSE4_1__
# define _ENABLE_SSE4_1
# endif
#endif
#if defined _ENABLE_AVX
#include <immintrin.h>
#elif defined _ENABLE_SSE4_1
#include <smmintrin.h>
#endif
#if defined _ENABLE_AVX #if defined _ENABLE_AVX
...@@ -2166,14 +2191,11 @@ void decode_double_array_byte(const unsigned char * restrict igrib, long jlend, ...@@ -2166,14 +2191,11 @@ void decode_double_array_byte(const unsigned char * restrict igrib, long jlend,
end_decode = mach_absolute_time(); end_decode = mach_absolute_time();
#endif #endif
#if defined _ENABLE_AVX #if defined _ENABLE_AVX
printf("AVX encoding cycles:: %" PRIu64 "\n", printf("AVX encoding cycles:: %" PRIu64 "\n", end_decode-start_decode);
end_decode-start_decode);
#elif defined _ENABLE_SSE4_1 #elif defined _ENABLE_SSE4_1
printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n", printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n", end_decode-start_decode);
end_decode-start_decode);
#else #else
printf("loop encoding cycles:: %" PRIu64 "\n", printf("loop encoding cycles:: %" PRIu64 "\n", end_decode-start_decode);
end_decode-start_decode);
#endif #endif
#endif #endif
...@@ -2217,6 +2239,10 @@ void decode_double_array_unrolled(const unsigned char * restrict igrib, long jle ...@@ -2217,6 +2239,10 @@ void decode_double_array_unrolled(const unsigned char * restrict igrib, long jle
decode_double_array_byte(igrib, jlend, numBits, fmin, zscale, fpdata); decode_double_array_byte(igrib, jlend, numBits, fmin, zscale, fpdata);
} }
#undef DISABLE_SIMD
#undef _ENABLE_AVX
#undef _ENABLE_SSE4_1
#define NINT(x) ((x) < 0 ? (int)((x)-.5) : (int)((x)+.5)) #define NINT(x) ((x) < 0 ? (int)((x)-.5) : (int)((x)+.5))
...@@ -10578,7 +10604,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu ...@@ -10578,7 +10604,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return (gribLen); return (gribLen);
} }
static const char grb_libvers[] = "1.6.2" " of ""Jul 10 2013"" ""18:44:40"; static const char grb_libvers[] = "1.6.2" " of ""Jul 11 2013"" ""11:16:39";
const char * const char *
cgribexLibraryVersion(void) cgribexLibraryVersion(void)
{ {
......
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