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

Remove compiler errors and warnings

This commit is contained in:
Peter Boyle 2019-07-18 14:47:02 +01:00
parent 08904f830e
commit a23dc295ac
13 changed files with 60 additions and 42 deletions

View File

@ -25,6 +25,7 @@
#endif
#include <Grid/Eigen/Dense>
#include <Grid/Eigen/unsupported/CXX11/Tensor>
/* NVCC restore */
#ifdef __NVCC__REDEFINE__

View File

@ -359,7 +359,11 @@ public:
ImplicitlyRestartedLanczos<FineField> IRL(ChebyOp,Op,Nstop,Nk,Nm,resid,MaxIt,betastp,MinRes);
FineField src(_FineGrid); src=1.0; src.Checkerboard() = _checkerboard;
FineField src(_FineGrid);
typedef typename FineField::scalar_type Scalar;
// src=1.0;
src=Scalar(1.0);
src.Checkerboard() = _checkerboard;
int Nconv;
IRL.calc(evals_fine,subspace,src,Nconv,false);

View File

@ -1,6 +1,6 @@
#pragma once
//#include <Grid/Hadrons/Global.hpp>
#include <Grid/Eigen/unsupported/CXX11/Tensor>
#include <Grid/Grid_Eigen_Tensor.h>
NAMESPACE_BEGIN(Grid);

View File

@ -33,7 +33,7 @@ Author: Guido Cossu <guido.cossu@ed.ac.uk>
#include <type_traits>
#include <Grid/tensors/Tensors.h>
#include <Grid/serialisation/VectorUtils.h>
#include <Grid/Eigen/unsupported/CXX11/Tensor>
#include <Grid/Grid_Eigen_Tensor.h>
namespace Grid {
namespace EigenIO {

View File

@ -236,7 +236,7 @@ public:
accelerator Grid_simd() = default;
accelerator_inline Grid_simd(const Grid_simd &rhs) : v(rhs.v){}; // compiles in movaps
accelerator_inline Grid_simd(const Grid_simd &&rhs) : v(rhs.v){};
accelerator Grid_simd(const Real a) { vsplat(*this, Scalar_type(a)); };
accelerator_inline Grid_simd(const Real a) { vsplat(*this, Scalar_type(a)); };
// Enable if complex type
template <typename S = Scalar_type> accelerator_inline
Grid_simd(const typename std::enable_if<is_complex<S>::value, S>::type a) {

View File

@ -84,7 +84,6 @@ public:
Coordinate NbrCoor;
for(Integer site=0;site<osites;site++){
for(Integer ii=0;ii<npoints;ii++){
Integer Nbr;
Integer lex = site*npoints+ii;
GeneralStencilEntry SE;
////////////////////////////////////////////////

View File

@ -191,7 +191,7 @@ public:
static accelerator_inline constexpr int Nsimd(void) { return sizeof(vector_type)/sizeof(scalar_type); }
template <class T, typename std::enable_if<!isGridTensor<T>::value, T>::type * = nullptr>
strong_inline auto operator=(T arg) -> iVector<vtype, N> {
accelerator_inline auto operator=(T arg) -> iVector<vtype, N> {
zeroit(*this);
for (int i = 0; i < N; i++) _internal[i] = arg;
return *this;

View File

@ -29,7 +29,7 @@ namespace Grid{
}
template<class coor_t>
static accelerator_inline void IndexFromCoorReversed (const coor_t& coor,int &index,const coor_t &dims){
static inline void IndexFromCoorReversed (const coor_t& coor,int &index,const coor_t &dims){
int nd=dims.size();
int stride=1;
index=0;
@ -39,7 +39,7 @@ namespace Grid{
}
}
template<class coor_t>
static accelerator_inline void CoorFromIndexReversed (coor_t& coor,int index,const coor_t &dims){
static inline void CoorFromIndexReversed (coor_t& coor,int index,const coor_t &dims){
int nd= dims.size();
coor.resize(nd);
for(int d=nd-1;d>=0;d--){

View File

@ -48,6 +48,8 @@ namespace Grid{
typedef typename FermionOperatorD::FermionField FieldD;
typedef typename FermionOperatorF::FermionField FieldF;
using OperatorFunction<FieldD>::operator();
RealD Tolerance;
RealD InnerTolerance; //Initial tolerance for inner CG. Defaults to Tolerance but can be changed
Integer MaxInnerIterations;

View File

@ -167,8 +167,10 @@ public:
template <typename C, typename MatLeft, typename MatRight>
static inline void accTrMul(C &acc, const MatLeft &a, const MatRight &b)
{
if ((MatLeft::Options == Eigen::RowMajor) and
(MatRight::Options == Eigen::ColMajor))
const int RowMajor = Eigen::RowMajor;
const int ColMajor = Eigen::ColMajor;
if ((MatLeft::Options == RowMajor) and
(MatRight::Options == ColMajor))
{
thread_for(r,a.rows(),
{
@ -218,18 +220,20 @@ public:
const Mat<ComplexD, Opts...> &b)
{
static const ComplexD one(1., 0.), zero(0., 0.);
const int RowMajor = Eigen::RowMajor;
const int ColMajor = Eigen::ColMajor;
if ((res.rows() != a.rows()) or (res.cols() != b.cols()))
{
res.resize(a.rows(), b.cols());
}
if (Mat<ComplexD, Opts...>::Options == Eigen::RowMajor)
if (Mat<ComplexD, Opts...>::Options == RowMajor)
{
cblas_zgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, a.rows(), b.cols(),
a.cols(), &one, a.data(), a.cols(), b.data(), b.cols(), &zero,
res.data(), res.cols());
}
else if (Mat<ComplexD, Opts...>::Options == Eigen::ColMajor)
else if (Mat<ComplexD, Opts...>::Options == ColMajor)
{
cblas_zgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, a.rows(), b.cols(),
a.cols(), &one, a.data(), a.rows(), b.data(), b.rows(), &zero,
@ -243,18 +247,20 @@ public:
const Mat<ComplexF, Opts...> &b)
{
static const ComplexF one(1., 0.), zero(0., 0.);
const int RowMajor = Eigen::RowMajor;
const int ColMajor = Eigen::ColMajor;
if ((res.rows() != a.rows()) or (res.cols() != b.cols()))
{
res.resize(a.rows(), b.cols());
}
if (Mat<ComplexF, Opts...>::Options == Eigen::RowMajor)
if (Mat<ComplexF, Opts...>::Options == RowMajor)
{
cblas_cgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, a.rows(), b.cols(),
a.cols(), &one, a.data(), a.cols(), b.data(), b.cols(), &zero,
res.data(), res.cols());
}
else if (Mat<ComplexF, Opts...>::Options == Eigen::ColMajor)
else if (Mat<ComplexF, Opts...>::Options == ColMajor)
{
cblas_cgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, a.rows(), b.cols(),
a.cols(), &one, a.data(), a.rows(), b.data(), b.rows(), &zero,
@ -281,22 +287,25 @@ private:
unsigned int &bInc, const unsigned int aRow,
const MatLeft &a, const MatRight &b)
{
if (MatLeft::Options == Eigen::RowMajor)
const int RowMajor = Eigen::RowMajor;
const int ColMajor = Eigen::ColMajor;
if (MatLeft::Options == RowMajor)
{
aPt = a.data() + aRow*a.cols();
aInc = 1;
}
else if (MatLeft::Options == Eigen::ColMajor)
else if (MatLeft::Options == ColMajor)
{
aPt = a.data() + aRow;
aInc = a.rows();
}
if (MatRight::Options == Eigen::RowMajor)
if (MatRight::Options == RowMajor)
{
bPt = b.data() + aRow;
bInc = b.cols();
}
else if (MatRight::Options == Eigen::ColMajor)
else if (MatRight::Options == ColMajor)
{
bPt = b.data() + aRow*b.rows();
bInc = 1;
@ -309,22 +318,24 @@ private:
unsigned int &bInc, const unsigned int aCol,
const MatLeft &a, const MatRight &b)
{
if (MatLeft::Options == Eigen::RowMajor)
const int RowMajor = Eigen::RowMajor;
const int ColMajor = Eigen::ColMajor;
if (MatLeft::Options == RowMajor)
{
aPt = a.data() + aCol;
aInc = a.cols();
}
else if (MatLeft::Options == Eigen::ColMajor)
else if (MatLeft::Options == ColMajor)
{
aPt = a.data() + aCol*a.rows();
aInc = 1;
}
if (MatRight::Options == Eigen::RowMajor)
if (MatRight::Options == RowMajor)
{
bPt = b.data() + aCol*b.cols();
bInc = 1;
}
else if (MatRight::Options == Eigen::ColMajor)
else if (MatRight::Options == ColMajor)
{
bPt = b.data() + aCol;
bInc = b.rows();

View File

@ -118,7 +118,7 @@ std::vector<std::string> TAmputate<FImpl1, FImpl2>::getOutput(void)
template <typename Fimpl1, typename Fimpl2>
SpinColourMatrix TAmputate<Fimpl1, Fimpl2>::invertspincolmat(SpinColourMatrix &scmat)
{
Eigen::MatrixXcf scmat_2d(Ns*Nc,Ns*Nc);
Eigen::MatrixXcd scmat_2d(Ns*Nc,Ns*Nc);
for(int ic=0; ic<Nc; ic++){
for(int jc=0; jc<Nc; jc++){
for(int is=0; is<Ns; is++){
@ -126,7 +126,7 @@ SpinColourMatrix TAmputate<Fimpl1, Fimpl2>::invertspincolmat(SpinColourMatrix &s
scmat_2d(Ns*ic+is,Ns*jc+js) = scmat()(is,js)(ic,jc);
}}
}}
Eigen::MatrixXcf scmat_2d_inv = scmat_2d.inverse();
Eigen::MatrixXcd scmat_2d_inv = scmat_2d.inverse();
SpinColourMatrix scmat_inv;
for(int ic=0; ic<Nc; ic++){
for(int jc=0; jc<Nc; jc++){

View File

@ -34,6 +34,8 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace Grid;
using namespace Hadrons;
const int RowMajor = Eigen::RowMajor;
const int ColMajor = Eigen::ColMajor;
#ifdef GRID_COMMS_MPI3
#define GET_RANK(rank, nMpi) \
@ -129,22 +131,22 @@ static inline void zdotuRow(ComplexD &res, const unsigned int aRow,
const ComplexD *aPt, *bPt;
unsigned int aInc, bInc;
if (MatLeft::Options == Eigen::RowMajor)
if (MatLeft::Options == RowMajor)
{
aPt = a.data() + aRow*a.cols();
aInc = 1;
}
else if (MatLeft::Options == Eigen::ColMajor)
else if (MatLeft::Options == ColMajor)
{
aPt = a.data() + aRow;
aInc = a.rows();
}
if (MatRight::Options == Eigen::RowMajor)
if (MatRight::Options == RowMajor)
{
bPt = b.data() + aRow;
bInc = b.cols();
}
else if (MatRight::Options == Eigen::ColMajor)
else if (MatRight::Options == ColMajor)
{
bPt = b.data() + aRow*b.rows();
bInc = 1;
@ -159,22 +161,22 @@ static inline void zdotuCol(ComplexD &res, const unsigned int aCol,
const ComplexD *aPt, *bPt;
unsigned int aInc, bInc;
if (MatLeft::Options == Eigen::RowMajor)
if (MatLeft::Options == RowMajor)
{
aPt = a.data() + aCol;
aInc = a.cols();
}
else if (MatLeft::Options == Eigen::ColMajor)
else if (MatLeft::Options == ColMajor)
{
aPt = a.data() + aCol*a.rows();
aInc = 1;
}
if (MatRight::Options == Eigen::RowMajor)
if (MatRight::Options == RowMajor)
{
bPt = b.data() + aCol*b.cols();
bInc = 1;
}
else if (MatRight::Options == Eigen::ColMajor)
else if (MatRight::Options == ColMajor)
{
bPt = b.data() + aCol;
bInc = b.rows();
@ -199,20 +201,20 @@ void fullTrBenchmark(const unsigned int ni, const unsigned int nj, const unsigne
{
std::cout << "==== tr(A*B) benchmarks" << std::endl;
std::cout << "A matrices use ";
if (MatLeft::Options == Eigen::RowMajor)
if (MatLeft::Options == RowMajor)
{
std::cout << "row-major ordering" << std::endl;
}
else if (MatLeft::Options == Eigen::ColMajor)
else if (MatLeft::Options == ColMajor)
{
std::cout << "col-major ordering" << std::endl;
}
std::cout << "B matrices use ";
if (MatRight::Options == Eigen::RowMajor)
if (MatRight::Options == RowMajor)
{
std::cout << "row-major ordering" << std::endl;
}
else if (MatRight::Options == Eigen::ColMajor)
else if (MatRight::Options == ColMajor)
{
std::cout << "col-major ordering" << std::endl;
}
@ -359,11 +361,11 @@ void fullMulBenchmark(const unsigned int ni, const unsigned int nj, const unsign
{
std::cout << "==== A*B benchmarks" << std::endl;
std::cout << "all matrices use ";
if (Mat::Options == Eigen::RowMajor)
if (Mat::Options == RowMajor)
{
std::cout << "row-major ordering" << std::endl;
}
else if (Mat::Options == Eigen::ColMajor)
else if (Mat::Options == ColMajor)
{
std::cout << "col-major ordering" << std::endl;
}
@ -386,13 +388,13 @@ void fullMulBenchmark(const unsigned int ni, const unsigned int nj, const unsign
[](Mat &res, const Mat &a, const Mat &b)
{
const ComplexD one(1., 0.), zero(0., 0.);
if (Mat::Options == Eigen::RowMajor)
if (Mat::Options == RowMajor)
{
cblas_zgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, a.rows(), b.cols(),
a.cols(), &one, a.data(), a.cols(), b.data(), b.cols(), &zero,
res.data(), res.cols());
}
else if (Mat::Options == Eigen::ColMajor)
else if (Mat::Options == ColMajor)
{
cblas_zgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, a.rows(), b.cols(),
a.cols(), &one, a.data(), a.rows(), b.data(), b.rows(), &zero,

View File

@ -98,7 +98,7 @@ int main(int argc, char ** argv)
for(int d=0;d<Nd;d++) shift[d]=0;
shift[dir1]=disp1;
shift[dir2]=disp2;
std::vector<Coordinate> shifts(1,shift);
std::vector<Coordinate> shifts(npoint,shift);
GeneralLocalStencil gStencil(&Fine,shifts);
Bar = Cshift(Foo,dir1,disp1);
@ -106,7 +106,6 @@ int main(int argc, char ** argv)
// Implement a stencil code that should agree with cshift!
for(int i=0;i<Check.Grid()->oSites();i++){
int permute_type;
auto SE = gStencil.GetEntry(0,i);
auto check = Check.View();
auto foo = Foo.View();