From cab7ef9bc22ea99982e7ff2cd1f7b342d71cf375 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Tue, 14 Apr 2015 23:20:16 +0100 Subject: [PATCH] Some bug fixes --- Grid_main.cc | 8 ++++---- Grid_math_type_mapper.h | 10 ++++++++++ Grid_math_types.h | 3 +++ Grid_simd.h | 12 +++++++++--- Grid_vComplexF.h | 4 +++- Grid_vRealD.h | 3 +++ Grid_vRealF.h | 3 +++ 7 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Grid_main.cc b/Grid_main.cc index 13c3d9ee..8cac55f5 100644 --- a/Grid_main.cc +++ b/Grid_main.cc @@ -14,10 +14,10 @@ int main (int argc, char ** argv) std::vector simd_layout(4); std::vector mpi_layout(4); - mpi_layout[0]=2; - mpi_layout[1]=2; - mpi_layout[2]=2; - mpi_layout[3]=2; + mpi_layout[0]=1; + mpi_layout[1]=1; + mpi_layout[2]=1; + mpi_layout[3]=1; #ifdef AVX512 for(int omp=128;omp<236;omp+=16){ diff --git a/Grid_math_type_mapper.h b/Grid_math_type_mapper.h index 856f2c6b..4e7120b1 100644 --- a/Grid_math_type_mapper.h +++ b/Grid_math_type_mapper.h @@ -10,6 +10,7 @@ namespace Grid { typedef typename T::scalar_type scalar_type; typedef typename T::vector_type vector_type; typedef typename T::tensor_reduced tensor_reduced; + // enum { TensorLevel = T::TensorLevel }; }; ////////////////////////////////////////////////////////////////////////////////// @@ -20,24 +21,28 @@ namespace Grid { typedef RealF scalar_type; typedef RealF vector_type; typedef RealF tensor_reduced ; + // enum { TensorLevel = 0 }; }; template<> class GridTypeMapper { public: typedef RealD scalar_type; typedef RealD vector_type; typedef RealD tensor_reduced; + // enum { TensorLevel = 0 }; }; template<> class GridTypeMapper { public: typedef ComplexF scalar_type; typedef ComplexF vector_type; typedef ComplexF tensor_reduced; + // enum { TensorLevel = 0 }; }; template<> class GridTypeMapper { public: typedef ComplexD scalar_type; typedef ComplexD vector_type; typedef ComplexD tensor_reduced; + // enum { TensorLevel = 0 }; }; template<> class GridTypeMapper { @@ -45,30 +50,35 @@ namespace Grid { typedef RealF scalar_type; typedef vRealF vector_type; typedef vRealF tensor_reduced; + // enum { TensorLevel = 0 }; }; template<> class GridTypeMapper { public: typedef RealD scalar_type; typedef vRealD vector_type; typedef vRealD tensor_reduced; + //enum { TensorLevel = 0 }; }; template<> class GridTypeMapper { public: typedef ComplexF scalar_type; typedef vComplexF vector_type; typedef vComplexF tensor_reduced; + //enum { TensorLevel = 0 }; }; template<> class GridTypeMapper { public: typedef ComplexD scalar_type; typedef vComplexD vector_type; typedef vComplexD tensor_reduced; + //enum { TensorLevel = 0 }; }; template<> class GridTypeMapper { public: typedef Integer scalar_type; typedef vInteger vector_type; typedef vInteger tensor_reduced; + //enum { TensorLevel = 0 }; }; // Again terminate the recursion. diff --git a/Grid_math_types.h b/Grid_math_types.h index 01fc7bf2..db90bda7 100644 --- a/Grid_math_types.h +++ b/Grid_math_types.h @@ -19,6 +19,7 @@ public: typedef typename GridTypeMapper::scalar_type scalar_type; typedef typename GridTypeMapper::vector_type vector_type; typedef typename GridTypeMapper::tensor_reduced tensor_reduced_v; + //enum { TensorLevel = GridTypeMapper::TensorLevel + 1}; typedef iScalar tensor_reduced; @@ -78,6 +79,7 @@ public: typedef typename GridTypeMapper::scalar_type scalar_type; typedef typename GridTypeMapper::vector_type vector_type; typedef typename GridTypeMapper::tensor_reduced tensor_reduced_v; + // enum { TensorLevel = GridTypeMapper::TensorLevel + 1}; typedef iScalar tensor_reduced; @@ -136,6 +138,7 @@ public: typedef typename GridTypeMapper::scalar_type scalar_type; typedef typename GridTypeMapper::vector_type vector_type; typedef typename GridTypeMapper::tensor_reduced tensor_reduced_v; + // enum { TensorLevel = GridTypeMapper::TensorLevel + 1}; typedef iScalar tensor_reduced; iMatrix(Zero &z){ *this = zero; }; diff --git a/Grid_simd.h b/Grid_simd.h index 4f9f4b0d..f0cf6c08 100644 --- a/Grid_simd.h +++ b/Grid_simd.h @@ -273,10 +273,16 @@ namespace Grid { inline void add (vRealD *__restrict__ y,const vRealD *__restrict__ l,const RealD *__restrict__ r){ *y = (*l) + (*r); } // Default precision - typedef RealD Real; - typedef std::complex Complex; - +#ifdef GRID_DEFAULT_PRECISION_DOUBLE + typedef RealD Real; typedef vRealD vReal; typedef vComplexD vComplex; + typedef std::complex Complex; +#else + typedef RealF Real; + typedef vRealF vReal; + typedef vComplexF vComplex; + typedef std::complex Complex; +#endif } #endif diff --git a/Grid_vComplexF.h b/Grid_vComplexF.h index 9dc5f051..75c47248 100644 --- a/Grid_vComplexF.h +++ b/Grid_vComplexF.h @@ -373,6 +373,8 @@ friend inline void vstore(const vComplexF &ret, ComplexF *a){ { return l*r; } - + inline vComplexF trace(const vComplexF &arg){ + return arg; + } } #endif diff --git a/Grid_vRealD.h b/Grid_vRealD.h index 84c80698..86f738f3 100644 --- a/Grid_vRealD.h +++ b/Grid_vRealD.h @@ -247,6 +247,9 @@ namespace Grid { { return l*r; } + inline vRealD trace(const vRealD &arg){ + return arg; + } } diff --git a/Grid_vRealF.h b/Grid_vRealF.h index aeb454f0..b7c127ce 100644 --- a/Grid_vRealF.h +++ b/Grid_vRealF.h @@ -268,6 +268,9 @@ friend inline void vstore(const vRealF &ret, float *a){ return l*r; } + inline vRealF trace(const vRealF &arg){ + return arg; + } }