From 20180777709cb15804507a6c2d6407cbaa450b9b Mon Sep 17 00:00:00 2001 From: paboyle Date: Mon, 5 Mar 2018 00:28:24 +0000 Subject: [PATCH] Make NVCC happy with the compile. This is warning free on 9.1 on my laptop (both make and make tests). --- .../iterative/LocalCoherenceLanczos.h | 2 +- .../PrecGeneralisedConjugateResidual.h | 4 +-- lib/json/json.hpp | 3 +-- lib/lattice/Lattice_ET.h | 10 ++++--- lib/lattice/Lattice_matrix_reduction.h | 3 ++- lib/serialisation/JSON_IO.h | 27 +++++++++++++++++++ lib/tensors/Tensor_exp.h | 3 +-- tests/core/Test_cshift_red_black.cc | 1 - tests/core/Test_cshift_red_black_rotate.cc | 1 - tests/core/Test_cshift_rotate.cc | 1 - tests/core/Test_dwf_rb5d.cc | 1 - tests/core/Test_gamma.cc | 4 --- tests/core/Test_main.cc | 1 - tests/core/Test_quenched_update.cc | 1 - tests/core/Test_zmobius_even_odd.cc | 24 ++++++++++++++--- tests/forces/Test_dwf_gpforce.cc | 1 - tests/forces/Test_gp_rect_force.cc | 1 - tests/forces/Test_gpwilson_force.cc | 7 ----- tests/forces/Test_wilson_force.cc | 1 - tests/forces/Test_zmobius_force.cc | 3 +-- ..._dwf_compressed_lanczos_reorg_synthetic.cc | 2 +- tests/lanczos/Test_synthetic_lanczos.cc | 5 ++-- tests/lanczos/Test_wilson_lanczos.cc | 2 -- tests/solver/Test_dwf_hdcr.cc | 1 - tests/solver/Test_zmobius_cg_prec.cc | 2 +- 25 files changed, 65 insertions(+), 46 deletions(-) diff --git a/lib/algorithms/iterative/LocalCoherenceLanczos.h b/lib/algorithms/iterative/LocalCoherenceLanczos.h index 02904d3e..ca5193df 100644 --- a/lib/algorithms/iterative/LocalCoherenceLanczos.h +++ b/lib/algorithms/iterative/LocalCoherenceLanczos.h @@ -57,7 +57,7 @@ public: RealD , coarse_relax_tol, std::vector, blockSize, std::string, config, - std::vector < std::complex >, omega, + std::vector < ComplexD >, omega, RealD, mass, RealD, M5); }; diff --git a/lib/algorithms/iterative/PrecGeneralisedConjugateResidual.h b/lib/algorithms/iterative/PrecGeneralisedConjugateResidual.h index 69f53ad8..f77cc6a6 100644 --- a/lib/algorithms/iterative/PrecGeneralisedConjugateResidual.h +++ b/lib/algorithms/iterative/PrecGeneralisedConjugateResidual.h @@ -113,9 +113,9 @@ public: RealD GCRnStep(LinearOperatorBase &Linop,const Field &src, Field &psi,RealD rsq){ RealD cp; - RealD a, b, c, d; + RealD a, b; RealD zAz, zAAz; - RealD rAq, rq; + RealD rq; GridBase *grid = src.Grid(); diff --git a/lib/json/json.hpp b/lib/json/json.hpp index f5601de8..fb52a265 100644 --- a/lib/json/json.hpp +++ b/lib/json/json.hpp @@ -1371,8 +1371,7 @@ struct from_json_fn template void call(const BasicJsonType& /*unused*/, T& /*unused*/, priority_tag<0> /*unused*/) const noexcept { - static_assert(sizeof(BasicJsonType) == 0, - "could not find from_json() method in T's namespace"); + static_assert(sizeof(BasicJsonType) == 0,"could not find from_json() method in T's namespace"); } public: diff --git a/lib/lattice/Lattice_ET.h b/lib/lattice/Lattice_ET.h index 2cdc6b37..00b73274 100644 --- a/lib/lattice/Lattice_ET.h +++ b/lib/lattice/Lattice_ET.h @@ -133,7 +133,7 @@ auto eval(const unsigned int ss, const LatticeTrinaryExpression // Perhaps a conformable method. ////////////////////////////////////////////////////////////////////////// template ::value, T1>::type * = nullptr> -inline void GridFromExpression(GridBase *&grid, const T1 &lat) // Lattice leaf +accelerator_inline void GridFromExpression(GridBase *&grid, const T1 &lat) // Lattice leaf { lat.Conformable(grid); } @@ -209,7 +209,7 @@ inline void CBFromExpression(int &cb, const LatticeTrinaryExpression \ struct name { \ - static auto inline func(const arg a) -> decltype(ret) { return ret; } \ + static auto accelerator_inline func(const arg a) -> decltype(ret) { return ret; } \ }; GridUnopClass(UnarySub, -a); @@ -242,7 +242,8 @@ GridUnopClass(UnaryExp, exp(a)); #define GridBinOpClass(name, combination) \ template \ struct name { \ - static auto inline func(const left &lhs, const right &rhs) \ + static auto accelerator_inline \ + func(const left &lhs, const right &rhs) \ -> decltype(combination) const \ { \ return combination; \ @@ -264,7 +265,8 @@ GridBinOpClass(BinaryOrOr, lhs || rhs); #define GridTrinOpClass(name, combination) \ template \ struct name { \ - static auto inline func(const predicate &pred, const left &lhs, const right &rhs) \ + static auto accelerator_inline \ + func(const predicate &pred, const left &lhs, const right &rhs) \ -> decltype(combination) const \ { \ return combination; \ diff --git a/lib/lattice/Lattice_matrix_reduction.h b/lib/lattice/Lattice_matrix_reduction.h index ccbc13b2..0980ad8a 100644 --- a/lib/lattice/Lattice_matrix_reduction.h +++ b/lib/lattice/Lattice_matrix_reduction.h @@ -177,7 +177,8 @@ static void sliceInnerProductMatrix( Eigen::MatrixXcd &mat, const Lattice for(int j=0;j(real(z),imag(z)); }} }}); thread_critical { diff --git a/lib/serialisation/JSON_IO.h b/lib/serialisation/JSON_IO.h index 00287447..b5255de3 100644 --- a/lib/serialisation/JSON_IO.h +++ b/lib/serialisation/JSON_IO.h @@ -54,6 +54,18 @@ namespace Grid void pop(void); template void writeDefault(const std::string &s, const U &x); +#ifdef __NVCC__ + void writeDefault(const std::string &s, const Grid::ComplexD &x) + { + std::complex z(real(x),imag(x)); + writeDefault(s,z); + } + void writeDefault(const std::string &s, const Grid::ComplexF &x) + { + std::complex z(real(x),imag(x)); + writeDefault(s,z); + } +#endif template void writeDefault(const std::string &s, const std::complex &x); template @@ -89,6 +101,21 @@ namespace Grid void readDefault(const std::string &s, std::vector &output); template void readDefault(const std::string &s, std::pair &output); +#ifdef __NVCC__ + void readDefault(const std::string &s, ComplexD &output) + { + std::complex z; + readDefault(s,z); + output = ComplexD(real(z),imag(z)); + } + void readDefault(const std::string &s, ComplexF &output) + { + std::complex z; + readDefault(s,z); + output = ComplexD(real(z),imag(z)); + } +#endif + private: json jobject_; // main object json jcur_; // current json object diff --git a/lib/tensors/Tensor_exp.h b/lib/tensors/Tensor_exp.h index 368242dc..6f9e8360 100644 --- a/lib/tensors/Tensor_exp.h +++ b/lib/tensors/Tensor_exp.h @@ -66,14 +66,13 @@ accelerator_inline iMatrix Exponentiate(const iMatrix &arg, Re typedef iMatrix mat; typedef iScalar scalar; mat unit(1.0); - mat temp(unit); const Complex one_over_three = 1.0 / 3.0; const Complex one_over_two = 1.0 / 2.0; scalar c0, c1, tmp, c0max, theta, u, w; scalar xi0, u2, w2, cosw; scalar fden, h0, h1, h2; - scalar e2iu, emiu, ixi0, qt; + scalar e2iu, emiu, ixi0; scalar f0, f1, f2; scalar unity(1.0); diff --git a/tests/core/Test_cshift_red_black.cc b/tests/core/Test_cshift_red_black.cc index 68489c4a..34325072 100644 --- a/tests/core/Test_cshift_red_black.cc +++ b/tests/core/Test_cshift_red_black.cc @@ -62,7 +62,6 @@ int main (int argc, char ** argv) lex=Zero(); Integer stride =1; { - double nrm; LatticeComplex coor(&Fine); for(int d=0;d > omegas; + std::vector < ComplexD > omegas; #if 0 for(int i=0;i(0.0686324988446592,0.0550658530827402) ); omegas.push_back( std::complex(0.0686324988446592,-0.0550658530827402) ); #endif - - ZMobiusFermionR Ddwf(Umu, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mass, M5, omegas,1.,0.); -// DomainWallFermionR Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); + /* + argument types are: (Grid::LatticeGaugeField, + Grid::GridCartesian, + Grid::GridRedBlackCartesian, + Grid::GridCartesian, + Grid::GridRedBlackCartesian, + Grid::RealD, + Grid::RealD, + std::__1::vector, + std::__1::allocator>>, double, double) + ZMobiusFermion(GaugeField &_Umu, + GridCartesian &FiveDimGrid, + GridRedBlackCartesian &FiveDimRedBlackGrid, + GridCartesian &FourDimGrid, + GridRedBlackCartesian &FourDimRedBlackGrid, + RealD _mass,RealD _M5, + std::vector &gamma, RealD b,RealD c,const ImplParams &p= ImplParams()) : + */ + ZMobiusFermionR Ddwf(Umu, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mass, M5, omegas,RealD(1.),RealD(0.)); LatticeFermion src_e (FrbGrid); LatticeFermion src_o (FrbGrid); diff --git a/tests/forces/Test_dwf_gpforce.cc b/tests/forces/Test_dwf_gpforce.cc index 51dfa47a..60911b22 100644 --- a/tests/forces/Test_dwf_gpforce.cc +++ b/tests/forces/Test_dwf_gpforce.cc @@ -105,7 +105,6 @@ int main (int argc, char ** argv) RealD dt = 0.0001; RealD Hmom = 0.0; RealD Hmomprime = 0.0; - RealD Hmompp = 0.0; LatticeColourMatrix mommu(UGrid); LatticeColourMatrix forcemu(UGrid); LatticeGaugeField mom(UGrid); diff --git a/tests/forces/Test_gp_rect_force.cc b/tests/forces/Test_gp_rect_force.cc index 691e1d0a..e5626514 100644 --- a/tests/forces/Test_gp_rect_force.cc +++ b/tests/forces/Test_gp_rect_force.cc @@ -57,7 +57,6 @@ int main (int argc, char ** argv) SU3::HotConfiguration(pRNG,U); double beta = 1.0; - double c1 = 0.331; //GparityPlaqPlusRectangleActionR Action(beta,c1); ConjugateWilsonGaugeActionR Action(beta); diff --git a/tests/forces/Test_gpwilson_force.cc b/tests/forces/Test_gpwilson_force.cc index 28d92e35..9a4a2c1c 100644 --- a/tests/forces/Test_gpwilson_force.cc +++ b/tests/forces/Test_gpwilson_force.cc @@ -29,9 +29,6 @@ Author: paboyle using namespace std; using namespace Grid; - ; - - int main (int argc, char ** argv) { @@ -41,14 +38,11 @@ int main (int argc, char ** argv) Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd()); Coordinate mpi_layout = GridDefaultMpi(); - const int Ls=8; - GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()), GridDefaultMpi()); GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); GridCartesian * FGrid = UGrid; - GridRedBlackCartesian * FrbGrid = UrbGrid; std::vector seeds4({1,2,3,4}); GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4); @@ -69,7 +63,6 @@ int main (int argc, char ** argv) // Unmodified matrix element //////////////////////////////////// RealD mass=0.01; - RealD M5=1.8; const int nu = 3; std::vector twists(Nd,0); twists[nu] = 1; diff --git a/tests/forces/Test_wilson_force.cc b/tests/forces/Test_wilson_force.cc index f011649a..5bfdef72 100644 --- a/tests/forces/Test_wilson_force.cc +++ b/tests/forces/Test_wilson_force.cc @@ -85,7 +85,6 @@ int main (int argc, char ** argv) RealD dt = 0.0001; RealD Hmom = 0.0; RealD Hmomprime = 0.0; - RealD Hmompp = 0.0; LatticeColourMatrix mommu(&Grid); LatticeColourMatrix forcemu(&Grid); LatticeGaugeField mom(&Grid); diff --git a/tests/forces/Test_zmobius_force.cc b/tests/forces/Test_zmobius_force.cc index 9d110aba..bf07b347 100644 --- a/tests/forces/Test_zmobius_force.cc +++ b/tests/forces/Test_zmobius_force.cc @@ -29,7 +29,6 @@ Author: Peter Boyle using namespace std; using namespace Grid; - ; int main (int argc, char ** argv) { @@ -70,7 +69,7 @@ int main (int argc, char ** argv) RealD b=0.5; RealD c=0.5; - std::vector < std::complex > omegas; + std::vector < ComplexD > omegas; omegas.push_back( std::complex(1.45806438985048,-0) ); omegas.push_back( std::complex(1.18231318389348,-0) ); omegas.push_back( std::complex(0.830951166685955,-0) ); diff --git a/tests/lanczos/Test_dwf_compressed_lanczos_reorg_synthetic.cc b/tests/lanczos/Test_dwf_compressed_lanczos_reorg_synthetic.cc index 98f0b948..0b1c3a1f 100644 --- a/tests/lanczos/Test_dwf_compressed_lanczos_reorg_synthetic.cc +++ b/tests/lanczos/Test_dwf_compressed_lanczos_reorg_synthetic.cc @@ -229,7 +229,7 @@ struct CompressedLanczosParams : Serializable { LanczosParams, CoarseParams, std::vector, blockSize, std::string, config, - std::vector < std::complex >, omega, + std::vector < ComplexD >, omega, RealD, mass, RealD, M5 ); diff --git a/tests/lanczos/Test_synthetic_lanczos.cc b/tests/lanczos/Test_synthetic_lanczos.cc index 3cd78241..7a3591dd 100644 --- a/tests/lanczos/Test_synthetic_lanczos.cc +++ b/tests/lanczos/Test_synthetic_lanczos.cc @@ -31,8 +31,8 @@ Author: paboyle using namespace std; using namespace Grid; - ; +/* static int FEenableexcept (unsigned int excepts) { @@ -53,6 +53,7 @@ FEenableexcept (unsigned int excepts) return 0; #endif } +*/ template class DumbOperator : public LinearOperatorBase { @@ -102,7 +103,6 @@ public: int main (int argc, char ** argv) { - // FEenableexcept(FE_ALL_EXCEPT & ~FE_INEXACT); Grid_init(&argc,&argv); @@ -117,7 +117,6 @@ int main (int argc, char ** argv) RealD alpha = 1.2; RealD beta = 0.1; - RealD mu = 0.0; int order = 11; Chebyshev Cheby(alpha,beta,order); std::ofstream file("cheby.dat"); diff --git a/tests/lanczos/Test_wilson_lanczos.cc b/tests/lanczos/Test_wilson_lanczos.cc index 9082a07e..01258ac7 100644 --- a/tests/lanczos/Test_wilson_lanczos.cc +++ b/tests/lanczos/Test_wilson_lanczos.cc @@ -71,8 +71,6 @@ int main(int argc, char** argv) { */ RealD mass = -0.1; - RealD M5 = 1.8; - RealD mob_b = 1.5; FermionOp WilsonOperator(Umu,*FGrid,*FrbGrid,mass); MdagMLinearOperator HermOp(WilsonOperator); /// <----- //SchurDiagTwoOperator HermOp(WilsonOperator); diff --git a/tests/solver/Test_dwf_hdcr.cc b/tests/solver/Test_dwf_hdcr.cc index 7aeef745..626f5be7 100644 --- a/tests/solver/Test_dwf_hdcr.cc +++ b/tests/solver/Test_dwf_hdcr.cc @@ -99,7 +99,6 @@ public: MdagMLinearOperator fMdagMOp(_FineMatrix); p1=in; - RealD absp2; for(int i=0;i<20;i++){ RealD absp1=std::sqrt(norm2(p1)); fMdagMOp.HermOp(p1,p2);// this is the G5 herm bit diff --git a/tests/solver/Test_zmobius_cg_prec.cc b/tests/solver/Test_zmobius_cg_prec.cc index a5ef4af4..fb57cff1 100644 --- a/tests/solver/Test_zmobius_cg_prec.cc +++ b/tests/solver/Test_zmobius_cg_prec.cc @@ -79,7 +79,7 @@ int main(int argc, char** argv) { RealD mass = 0.01; RealD M5 = 1.8; - std::vector < std::complex > omegas; + std::vector < ComplexD > omegas; #if 0 for(int i=0;i