1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45:36 +00:00

Build system progressing

This commit is contained in:
Peter Boyle 2015-03-04 04:13:07 +00:00
parent 523e3bd8d5
commit 3c5f08a1d6
4 changed files with 92 additions and 37 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
*.lo
*.o
*.obj
*~
# Precompiled Headers
*.gch

63
Grid.h
View File

@ -18,44 +18,57 @@
#include <random>
#include <functional>
#include <stdlib.h>
#include <sys/time.h>
#include <stdio.h>
#ifdef OMP
#include <Grid_config.h>
////////////////////////////////////////////////////////////
// Tunable header includes
////////////////////////////////////////////////////////////
#ifdef HAVE_OPENMP
#define OMP
#include <omp.h>
#endif
#ifdef MAC
#ifdef HAVE_MALLOC_MALLOC_H
#include <malloc/malloc.h>
#else
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#ifndef POOH
////////////////////////////////////////////////////////////
// SIMD Alignment controls
////////////////////////////////////////////////////////////
#ifdef HAVE_VAR_ATTRIBUTE_ALIGNED
#define ALIGN_DIRECTIVE(A) __attribute__ ((aligned(A)))
#else
#define ALIGN_DIRECTIVE(A) __declspec(align(A))
#endif
#ifdef SSE2
#include <pmmintrin.h>
#define SIMDalign ALIGN_DIRECTIVE(16)
#endif
#if defined(AVX1) || defined (AVX2)
#include <immintrin.h>
#define SIMDalign ALIGN_DIRECTIVE(32)
#endif
#ifdef SSE2
#include <pmmintrin.h>
#define SIMDalign ALIGN_DIRECTIVE(16)
#endif
#ifdef AVX512
#include <immintrin.h>
#define SIMDalign ALIGN_DIRECTIVE(64)
#endif
#include <sys/time.h>
#include <stdio.h>
namespace dpo {
void Grid_init(void);
inline double usecond(void)
{
struct timeval tv;
@ -168,29 +181,16 @@ inline double usecond(void)
typedef vector4double dvec;
typedef vector4double zvec;
#endif
#if defined (AVX1) || defined (AVX2) || defined (AVX512)
inline void v_prefetch0(int size, const char *ptr){
for(int i=0;i<size;i+=64){
for(int i=0;i<size;i+=64){ // Define L1 linesize above// What about SSE?
_mm_prefetch(ptr+i+4096,_MM_HINT_T1);
_mm_prefetch(ptr+i+512,_MM_HINT_T0);
}
}
#else
inline void v_prefetch0(int size, const char *ptr){};
#endif
/*
typedef vComplexF vFComplex;
typedef vComplexD vDComplex;
typedef vComplexF vComplex;
void zeroit(vRealF &z){ vzero(z);}
void zeroit(vRealD &z){ vzero(z);}
void zeroit(vComplexF &z){ vzero(z);}
void zeroit(vComplexD &z){ vzero(z);}
inline void zeroit(float &z){ z=0;}
inline void zeroit(double &z){ z=0;}
inline void zeroit(ComplexF &z){ z=0;}
inline void zeroit(ComplexD &z){ z=0;}
*/
///////////////////////////////////////////////////
// Scalar, Vector, Matrix objects.
@ -1157,15 +1157,6 @@ operator!=(const myallocator<_Tp>&, const myallocator<_Tp>&){ return false; }
}; // namespace dpo
////////////////////////////////////////////////////////////////////////////////////////
// Test code
////////////////////////////////////////////////////////////////////////////////////////
/*
using namespace std;
using namespace dpo;
using namespace dpo::QCD;
*/
#endif

View File

@ -15,6 +15,12 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the <malloc/malloc.h> header file. */
#undef HAVE_MALLOC_MALLOC_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@ -39,6 +45,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if the system has the `aligned' variable attribute */
#undef HAVE_VAR_ATTRIBUTE_ALIGNED
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

View File

@ -1,2 +1,56 @@
AC_INIT([Grid], [1.0])
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([Grid], [1.0], [paboyle@ph.ed.ac.uk])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([Grid.h])
AC_CONFIG_HEADERS([Grid_config.h])
# Checks for programs.
AC_PROG_CXX
AC_OPENMP
# Checks for libraries.
AX_GCC_VAR_ATTRIBUTE(aligned)
# Checks for header files.
AC_CHECK_HEADERS(stdint.h)
AC_CHECK_HEADERS(malloc/malloc.h)
AC_CHECK_HEADERS(malloc.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
# Checks for library functions.
AC_CHECK_FUNCS([gettimeofday])
AC_ARG_ENABLE([simd],[AC_HELP_STRING([--enable-simd=AVX|AVX2|SSE|SSE2|AVX512],[Select instructions])],[ac_SIMD=${enable_simd}],[ac_SIMD=AVX2])
case ${ac_SIMD} in
SSE)
echo Configuring for SSE1
AC_DEFINE([SSE],[1],[SSE] )
;;
SSE2)
echo Configuring for SSE2
AC_DEFINE([SSE2],[1],[SSE2] )
;;
AVX)
echo Configuring for AVX
AC_DEFINE([AVX],[1],[AVX] )
;;
AVX2)
echo Configuring for AVX2
AC_DEFINE([AVX2],[1],[AVX2] )
;;
AVX512)
echo Configuring for AVX512
AC_DEFINE([AVX512],[1],[AVX512] )
;;
*)
AC_MSG_ERROR([${ac_SIMD} unsupported --enable-simd option]);
;;
esac
AC_OUTPUT