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

Make NVCC happy with the compile. This is warning free on 9.1 on my laptop (both make and make tests).

This commit is contained in:
paboyle 2018-03-05 00:28:24 +00:00
parent 984e06e2b5
commit 2018077770
25 changed files with 65 additions and 46 deletions

View File

@ -57,7 +57,7 @@ public:
RealD , coarse_relax_tol, RealD , coarse_relax_tol,
std::vector<int>, blockSize, std::vector<int>, blockSize,
std::string, config, std::string, config,
std::vector < std::complex<double> >, omega, std::vector < ComplexD >, omega,
RealD, mass, RealD, mass,
RealD, M5); RealD, M5);
}; };

View File

@ -113,9 +113,9 @@ public:
RealD GCRnStep(LinearOperatorBase<Field> &Linop,const Field &src, Field &psi,RealD rsq){ RealD GCRnStep(LinearOperatorBase<Field> &Linop,const Field &src, Field &psi,RealD rsq){
RealD cp; RealD cp;
RealD a, b, c, d; RealD a, b;
RealD zAz, zAAz; RealD zAz, zAAz;
RealD rAq, rq; RealD rq;
GridBase *grid = src.Grid(); GridBase *grid = src.Grid();

View File

@ -1371,8 +1371,7 @@ struct from_json_fn
template<typename BasicJsonType, typename T> template<typename BasicJsonType, typename T>
void call(const BasicJsonType& /*unused*/, T& /*unused*/, priority_tag<0> /*unused*/) const noexcept void call(const BasicJsonType& /*unused*/, T& /*unused*/, priority_tag<0> /*unused*/) const noexcept
{ {
static_assert(sizeof(BasicJsonType) == 0, static_assert(sizeof(BasicJsonType) == 0,"could not find from_json() method in T's namespace");
"could not find from_json() method in T's namespace");
} }
public: public:

View File

@ -133,7 +133,7 @@ auto eval(const unsigned int ss, const LatticeTrinaryExpression<Op, T1, T2, T3>
// Perhaps a conformable method. // Perhaps a conformable method.
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
template <class T1,typename std::enable_if<is_lattice<T1>::value, T1>::type * = nullptr> template <class T1,typename std::enable_if<is_lattice<T1>::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); lat.Conformable(grid);
} }
@ -209,7 +209,7 @@ inline void CBFromExpression(int &cb, const LatticeTrinaryExpression<Op, T1, T2,
#define GridUnopClass(name, ret) \ #define GridUnopClass(name, ret) \
template <class arg> \ template <class arg> \
struct name { \ 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); GridUnopClass(UnarySub, -a);
@ -242,7 +242,8 @@ GridUnopClass(UnaryExp, exp(a));
#define GridBinOpClass(name, combination) \ #define GridBinOpClass(name, combination) \
template <class left, class right> \ template <class left, class right> \
struct name { \ 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 \ -> decltype(combination) const \
{ \ { \
return combination; \ return combination; \
@ -264,7 +265,8 @@ GridBinOpClass(BinaryOrOr, lhs || rhs);
#define GridTrinOpClass(name, combination) \ #define GridTrinOpClass(name, combination) \
template <class predicate, class left, class right> \ template <class predicate, class left, class right> \
struct name { \ 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 \ -> decltype(combination) const \
{ \ { \
return combination; \ return combination; \

View File

@ -177,7 +177,8 @@ static void sliceInnerProductMatrix( Eigen::MatrixXcd &mat, const Lattice<vobj>
for(int j=0;j<Nblock;j++){ for(int j=0;j<Nblock;j++){
auto tmp = innerProduct(Left[i],Right[j]); auto tmp = innerProduct(Left[i],Right[j]);
auto rtmp = TensorRemove(tmp); auto rtmp = TensorRemove(tmp);
mat_thread(i,j) += Reduce(rtmp); ComplexD z = Reduce(rtmp);
mat_thread(i,j) += std::complex<double>(real(z),imag(z));
}} }}
}}); }});
thread_critical { thread_critical {

View File

@ -54,6 +54,18 @@ namespace Grid
void pop(void); void pop(void);
template <typename U> template <typename U>
void writeDefault(const std::string &s, const U &x); void writeDefault(const std::string &s, const U &x);
#ifdef __NVCC__
void writeDefault(const std::string &s, const Grid::ComplexD &x)
{
std::complex<double> z(real(x),imag(x));
writeDefault(s,z);
}
void writeDefault(const std::string &s, const Grid::ComplexF &x)
{
std::complex<float> z(real(x),imag(x));
writeDefault(s,z);
}
#endif
template <typename U> template <typename U>
void writeDefault(const std::string &s, const std::complex<U> &x); void writeDefault(const std::string &s, const std::complex<U> &x);
template <typename U> template <typename U>
@ -89,6 +101,21 @@ namespace Grid
void readDefault(const std::string &s, std::vector<U> &output); void readDefault(const std::string &s, std::vector<U> &output);
template <typename U, typename P> template <typename U, typename P>
void readDefault(const std::string &s, std::pair<U,P> &output); void readDefault(const std::string &s, std::pair<U,P> &output);
#ifdef __NVCC__
void readDefault(const std::string &s, ComplexD &output)
{
std::complex<double> z;
readDefault(s,z);
output = ComplexD(real(z),imag(z));
}
void readDefault(const std::string &s, ComplexF &output)
{
std::complex<float> z;
readDefault(s,z);
output = ComplexD(real(z),imag(z));
}
#endif
private: private:
json jobject_; // main object json jobject_; // main object
json jcur_; // current json object json jcur_; // current json object

View File

@ -66,14 +66,13 @@ accelerator_inline iMatrix<vtype,3> Exponentiate(const iMatrix<vtype,3> &arg, Re
typedef iMatrix<vtype,3> mat; typedef iMatrix<vtype,3> mat;
typedef iScalar<vtype> scalar; typedef iScalar<vtype> scalar;
mat unit(1.0); mat unit(1.0);
mat temp(unit);
const Complex one_over_three = 1.0 / 3.0; const Complex one_over_three = 1.0 / 3.0;
const Complex one_over_two = 1.0 / 2.0; const Complex one_over_two = 1.0 / 2.0;
scalar c0, c1, tmp, c0max, theta, u, w; scalar c0, c1, tmp, c0max, theta, u, w;
scalar xi0, u2, w2, cosw; scalar xi0, u2, w2, cosw;
scalar fden, h0, h1, h2; scalar fden, h0, h1, h2;
scalar e2iu, emiu, ixi0, qt; scalar e2iu, emiu, ixi0;
scalar f0, f1, f2; scalar f0, f1, f2;
scalar unity(1.0); scalar unity(1.0);

View File

@ -62,7 +62,6 @@ int main (int argc, char ** argv)
lex=Zero(); lex=Zero();
Integer stride =1; Integer stride =1;
{ {
double nrm;
LatticeComplex coor(&Fine); LatticeComplex coor(&Fine);
for(int d=0;d<Nd;d++){ for(int d=0;d<Nd;d++){

View File

@ -63,7 +63,6 @@ int main (int argc, char ** argv)
lex=Zero(); lex=Zero();
Integer stride =1; Integer stride =1;
{ {
double nrm;
LatticeComplex coor(&Fine); LatticeComplex coor(&Fine);
for(int d=0;d<Nd;d++){ for(int d=0;d<Nd;d++){

View File

@ -49,7 +49,6 @@ int main (int argc, char ** argv)
lex=Zero(); lex=Zero();
Integer stride =1; Integer stride =1;
{ {
double nrm;
LatticeComplex coor(&Fine); LatticeComplex coor(&Fine);
for(int d=0;d<4;d++){ for(int d=0;d<4;d++){

View File

@ -93,7 +93,6 @@ int main (int argc, char ** argv)
} }
*/ */
RealD mass=0.1;
RealD M5 =1.8; RealD M5 =1.8;
typename WilsonFermion5DR::ImplParams params; typename WilsonFermion5DR::ImplParams params;

View File

@ -140,7 +140,6 @@ void checkGamma(const Gamma::Algebra a, GridSerialRNG &rng)
SpinVector v; SpinVector v;
SpinMatrix m, &testg = testAlgebra[a]; SpinMatrix m, &testg = testAlgebra[a];
Gamma g(a); Gamma g(a);
bool pass = true;
random(rng, v); random(rng, v);
random(rng, m); random(rng, m);
@ -159,7 +158,6 @@ void checkProd(const Gamma::Algebra a, const Gamma::Algebra b)
{ {
SpinMatrix gm, testg = testAlgebra[a]*testAlgebra[b]; SpinMatrix gm, testg = testAlgebra[a]*testAlgebra[b];
Gamma g = Gamma(a)*Gamma(b); Gamma g = Gamma(a)*Gamma(b);
bool pass = true;
std::cout << GridLogMessage << "Checking " << Gamma::name[a] << " * " std::cout << GridLogMessage << "Checking " << Gamma::name[a] << " * "
<< Gamma::name[b] << ": "; << Gamma::name[b] << ": ";
@ -173,7 +171,6 @@ void checkAdj(const Gamma::Algebra a)
{ {
SpinMatrix gm, testg = adj(testAlgebra[a]); SpinMatrix gm, testg = adj(testAlgebra[a]);
Gamma g(adj(Gamma(a))); Gamma g(adj(Gamma(a)));
bool pass = true;
std::cout << GridLogMessage << "Checking adj(" << Gamma::name[a] << "): "; std::cout << GridLogMessage << "Checking adj(" << Gamma::name[a] << "): ";
gm = 1.0; gm = 1.0;
@ -215,7 +212,6 @@ void checkGammaL(const Gamma::Algebra a, GridSerialRNG &rng)
SpinVector v; SpinVector v;
SpinMatrix m, &testg = testAlgebra[a], pl; SpinMatrix m, &testg = testAlgebra[a], pl;
GammaL gl(a); GammaL gl(a);
bool pass = true;
random(rng, v); random(rng, v);
random(rng, m); random(rng, m);

View File

@ -515,7 +515,6 @@ int main(int argc, char **argv) {
double nrm = 0; double nrm = 0;
LatticeColourMatrix deriv(&Fine); LatticeColourMatrix deriv(&Fine);
double half = 0.5;
deriv = 0.5 * Cshift(Foo, 0, 1) - 0.5 * Cshift(Foo, 0, -1); deriv = 0.5 * Cshift(Foo, 0, 1) - 0.5 * Cshift(Foo, 0, -1);
for (int dir = 0; dir < 4; dir++) { for (int dir = 0; dir < 4; dir++) {

View File

@ -58,7 +58,6 @@ int main (int argc, char ** argv)
// SU3 colour operatoions // SU3 colour operatoions
LatticeColourMatrix link(grid); LatticeColourMatrix link(grid);
LatticeColourMatrix staple(grid); LatticeColourMatrix staple(grid);
int mu=0;
// Apply heatbath to the link // Apply heatbath to the link
RealD beta=6.0; RealD beta=6.0;

View File

@ -84,7 +84,7 @@ int main (int argc, char ** argv)
RealD mass=0.1; RealD mass=0.1;
RealD M5 =1.8; RealD M5 =1.8;
std::vector < std::complex<double> > omegas; std::vector < ComplexD > omegas;
#if 0 #if 0
for(int i=0;i<Ls;i++){ for(int i=0;i<Ls;i++){
double imag = 0.; double imag = 0.;
@ -105,9 +105,25 @@ int main (int argc, char ** argv)
omegas.push_back( std::complex<double>(0.0686324988446592,0.0550658530827402) ); omegas.push_back( std::complex<double>(0.0686324988446592,0.0550658530827402) );
omegas.push_back( std::complex<double>(0.0686324988446592,-0.0550658530827402) ); omegas.push_back( std::complex<double>(0.0686324988446592,-0.0550658530827402) );
#endif #endif
/*
ZMobiusFermionR Ddwf(Umu, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mass, M5, omegas,1.,0.); argument types are: (Grid::LatticeGaugeField,
// DomainWallFermionR Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); Grid::GridCartesian,
Grid::GridRedBlackCartesian,
Grid::GridCartesian,
Grid::GridRedBlackCartesian,
Grid::RealD,
Grid::RealD,
std::__1::vector<std::__1::complex<double>,
std::__1::allocator<std::__1::complex<double>>>, double, double)
ZMobiusFermion(GaugeField &_Umu,
GridCartesian &FiveDimGrid,
GridRedBlackCartesian &FiveDimRedBlackGrid,
GridCartesian &FourDimGrid,
GridRedBlackCartesian &FourDimRedBlackGrid,
RealD _mass,RealD _M5,
std::vector<ComplexD> &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_e (FrbGrid);
LatticeFermion src_o (FrbGrid); LatticeFermion src_o (FrbGrid);

View File

@ -105,7 +105,6 @@ int main (int argc, char ** argv)
RealD dt = 0.0001; RealD dt = 0.0001;
RealD Hmom = 0.0; RealD Hmom = 0.0;
RealD Hmomprime = 0.0; RealD Hmomprime = 0.0;
RealD Hmompp = 0.0;
LatticeColourMatrix mommu(UGrid); LatticeColourMatrix mommu(UGrid);
LatticeColourMatrix forcemu(UGrid); LatticeColourMatrix forcemu(UGrid);
LatticeGaugeField mom(UGrid); LatticeGaugeField mom(UGrid);

View File

@ -57,7 +57,6 @@ int main (int argc, char ** argv)
SU3::HotConfiguration(pRNG,U); SU3::HotConfiguration(pRNG,U);
double beta = 1.0; double beta = 1.0;
double c1 = 0.331;
//GparityPlaqPlusRectangleActionR Action(beta,c1); //GparityPlaqPlusRectangleActionR Action(beta,c1);
ConjugateWilsonGaugeActionR Action(beta); ConjugateWilsonGaugeActionR Action(beta);

View File

@ -29,9 +29,6 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std; using namespace std;
using namespace Grid; using namespace Grid;
;
int main (int argc, char ** argv) int main (int argc, char ** argv)
{ {
@ -41,14 +38,11 @@ int main (int argc, char ** argv)
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd()); Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi(); Coordinate mpi_layout = GridDefaultMpi();
const int Ls=8;
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(),
GridDefaultSimd(Nd,vComplex::Nsimd()), GridDefaultSimd(Nd,vComplex::Nsimd()),
GridDefaultMpi()); GridDefaultMpi());
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
GridCartesian * FGrid = UGrid; GridCartesian * FGrid = UGrid;
GridRedBlackCartesian * FrbGrid = UrbGrid;
std::vector<int> seeds4({1,2,3,4}); std::vector<int> seeds4({1,2,3,4});
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4); GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
@ -69,7 +63,6 @@ int main (int argc, char ** argv)
// Unmodified matrix element // Unmodified matrix element
//////////////////////////////////// ////////////////////////////////////
RealD mass=0.01; RealD mass=0.01;
RealD M5=1.8;
const int nu = 3; const int nu = 3;
std::vector<int> twists(Nd,0); twists[nu] = 1; std::vector<int> twists(Nd,0); twists[nu] = 1;

View File

@ -85,7 +85,6 @@ int main (int argc, char ** argv)
RealD dt = 0.0001; RealD dt = 0.0001;
RealD Hmom = 0.0; RealD Hmom = 0.0;
RealD Hmomprime = 0.0; RealD Hmomprime = 0.0;
RealD Hmompp = 0.0;
LatticeColourMatrix mommu(&Grid); LatticeColourMatrix mommu(&Grid);
LatticeColourMatrix forcemu(&Grid); LatticeColourMatrix forcemu(&Grid);
LatticeGaugeField mom(&Grid); LatticeGaugeField mom(&Grid);

View File

@ -29,7 +29,6 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std; using namespace std;
using namespace Grid; using namespace Grid;
;
int main (int argc, char ** argv) int main (int argc, char ** argv)
{ {
@ -70,7 +69,7 @@ int main (int argc, char ** argv)
RealD b=0.5; RealD b=0.5;
RealD c=0.5; RealD c=0.5;
std::vector < std::complex<double> > omegas; std::vector < ComplexD > omegas;
omegas.push_back( std::complex<double>(1.45806438985048,-0) ); omegas.push_back( std::complex<double>(1.45806438985048,-0) );
omegas.push_back( std::complex<double>(1.18231318389348,-0) ); omegas.push_back( std::complex<double>(1.18231318389348,-0) );
omegas.push_back( std::complex<double>(0.830951166685955,-0) ); omegas.push_back( std::complex<double>(0.830951166685955,-0) );

View File

@ -229,7 +229,7 @@ struct CompressedLanczosParams : Serializable {
LanczosParams, CoarseParams, LanczosParams, CoarseParams,
std::vector<int>, blockSize, std::vector<int>, blockSize,
std::string, config, std::string, config,
std::vector < std::complex<double> >, omega, std::vector < ComplexD >, omega,
RealD, mass, RealD, mass,
RealD, M5 RealD, M5
); );

View File

@ -31,8 +31,8 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std; using namespace std;
using namespace Grid; using namespace Grid;
;
/*
static int static int
FEenableexcept (unsigned int excepts) FEenableexcept (unsigned int excepts)
{ {
@ -53,6 +53,7 @@ FEenableexcept (unsigned int excepts)
return 0; return 0;
#endif #endif
} }
*/
template<class Field> class DumbOperator : public LinearOperatorBase<Field> { template<class Field> class DumbOperator : public LinearOperatorBase<Field> {
@ -102,7 +103,6 @@ public:
int main (int argc, char ** argv) int main (int argc, char ** argv)
{ {
// FEenableexcept(FE_ALL_EXCEPT & ~FE_INEXACT);
Grid_init(&argc,&argv); Grid_init(&argc,&argv);
@ -117,7 +117,6 @@ int main (int argc, char ** argv)
RealD alpha = 1.2; RealD alpha = 1.2;
RealD beta = 0.1; RealD beta = 0.1;
RealD mu = 0.0;
int order = 11; int order = 11;
Chebyshev<LatticeComplex> Cheby(alpha,beta,order); Chebyshev<LatticeComplex> Cheby(alpha,beta,order);
std::ofstream file("cheby.dat"); std::ofstream file("cheby.dat");

View File

@ -71,8 +71,6 @@ int main(int argc, char** argv) {
*/ */
RealD mass = -0.1; RealD mass = -0.1;
RealD M5 = 1.8;
RealD mob_b = 1.5;
FermionOp WilsonOperator(Umu,*FGrid,*FrbGrid,mass); FermionOp WilsonOperator(Umu,*FGrid,*FrbGrid,mass);
MdagMLinearOperator<FermionOp,LatticeFermion> HermOp(WilsonOperator); /// <----- MdagMLinearOperator<FermionOp,LatticeFermion> HermOp(WilsonOperator); /// <-----
//SchurDiagTwoOperator<FermionOp,FermionField> HermOp(WilsonOperator); //SchurDiagTwoOperator<FermionOp,FermionField> HermOp(WilsonOperator);

View File

@ -99,7 +99,6 @@ public:
MdagMLinearOperator<Matrix,FineField> fMdagMOp(_FineMatrix); MdagMLinearOperator<Matrix,FineField> fMdagMOp(_FineMatrix);
p1=in; p1=in;
RealD absp2;
for(int i=0;i<20;i++){ for(int i=0;i<20;i++){
RealD absp1=std::sqrt(norm2(p1)); RealD absp1=std::sqrt(norm2(p1));
fMdagMOp.HermOp(p1,p2);// this is the G5 herm bit fMdagMOp.HermOp(p1,p2);// this is the G5 herm bit

View File

@ -79,7 +79,7 @@ int main(int argc, char** argv) {
RealD mass = 0.01; RealD mass = 0.01;
RealD M5 = 1.8; RealD M5 = 1.8;
std::vector < std::complex<double> > omegas; std::vector < ComplexD > omegas;
#if 0 #if 0
for(int i=0;i<Ls;i++){ for(int i=0;i<Ls;i++){
double imag = 0.; double imag = 0.;