mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Merge branch 'bugfix/maxnorm2' into feature/gparity_HMC
This commit is contained in:
commit
c2676853ca
@ -166,11 +166,12 @@ template<class vobj> inline RealD norm2(const Lattice<vobj> &arg){
|
||||
ComplexD nrm = innerProduct(arg,arg);
|
||||
return real(nrm);
|
||||
}
|
||||
|
||||
//The global maximum of the site norm2
|
||||
template<class vobj> inline RealD maxLocalNorm2(const Lattice<vobj> &arg)
|
||||
{
|
||||
typedef typename vobj::tensor_reduced vscalar;
|
||||
typedef typename vobj::scalar_object scalar;
|
||||
typedef typename getPrecision<vobj>::real_scalar_type rscalar;
|
||||
typedef typename vobj::tensor_reduced vscalar; //iScalar<iScalar<.... <vPODtype> > >
|
||||
typedef typename vscalar::scalar_object scalar; //iScalar<iScalar<.... <PODtype> > >
|
||||
|
||||
Lattice<vscalar> inner = localNorm2(arg);
|
||||
|
||||
|
@ -85,7 +85,7 @@ class MADWF
|
||||
maxiter =_maxiter;
|
||||
};
|
||||
|
||||
void operator() (const FermionFieldo &src4,FermionFieldo &sol5)
|
||||
void operator() (const FermionFieldo &src,FermionFieldo &sol5)
|
||||
{
|
||||
std::cout << GridLogMessage<< " ************************************************" << std::endl;
|
||||
std::cout << GridLogMessage<< " MADWF-like algorithm " << std::endl;
|
||||
@ -114,8 +114,16 @@ class MADWF
|
||||
///////////////////////////////////////
|
||||
//Import source, include Dminus factors
|
||||
///////////////////////////////////////
|
||||
Mato.ImportPhysicalFermionSource(src4,b);
|
||||
std::cout << GridLogMessage << " src4 " <<norm2(src4)<<std::endl;
|
||||
GridBase *src_grid = src.Grid();
|
||||
|
||||
assert( (src_grid == Mato.GaugeGrid()) || (src_grid == Mato.FermionGrid()));
|
||||
|
||||
if ( src_grid == Mato.GaugeGrid() ) {
|
||||
Mato.ImportPhysicalFermionSource(src,b);
|
||||
} else {
|
||||
b=src;
|
||||
}
|
||||
std::cout << GridLogMessage << " src " <<norm2(src)<<std::endl;
|
||||
std::cout << GridLogMessage << " b " <<norm2(b)<<std::endl;
|
||||
|
||||
defect = b;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <Grid/GridCore.h>
|
||||
|
||||
NAMESPACE_BEGIN(Grid);
|
||||
int acceleratorAbortOnGpuError=1;
|
||||
uint32_t accelerator_threads=2;
|
||||
uint32_t acceleratorThreads(void) {return accelerator_threads;};
|
||||
void acceleratorThreads(uint32_t t) {accelerator_threads = t;};
|
||||
|
@ -100,6 +100,8 @@ void acceleratorInit(void);
|
||||
#define accelerator __host__ __device__
|
||||
#define accelerator_inline __host__ __device__ inline
|
||||
|
||||
extern int acceleratorAbortOnGpuError;
|
||||
|
||||
accelerator_inline int acceleratorSIMTlane(int Nsimd) {
|
||||
#ifdef GRID_SIMT
|
||||
return threadIdx.z;
|
||||
@ -140,6 +142,7 @@ void LambdaApply(uint64_t num1, uint64_t num2, uint64_t num3, lambda Lambda)
|
||||
printf("Cuda error %s \n", cudaGetErrorString( err )); \
|
||||
puts(__FILE__); \
|
||||
printf("Line %d\n",__LINE__); \
|
||||
if (acceleratorAbortOnGpuError) assert(err==cudaSuccess); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -232,12 +232,13 @@ int main(int argc, char **argv) {
|
||||
scalar = localNorm2(cVec);
|
||||
|
||||
std::cout << "Testing maxLocalNorm2" <<std::endl;
|
||||
for(Integer gsite=0;gsite<Fine.gSites();gsite++){
|
||||
|
||||
|
||||
LatticeComplex rand_scalar(&Fine);
|
||||
random(FineRNG, rand_scalar); //uniform [0,1]
|
||||
for(Integer gsite=0;gsite<Fine.gSites();gsite++){ //check on every site independently
|
||||
scalar = rand_scalar;
|
||||
TComplex big(10.0);
|
||||
Coordinate coor;
|
||||
|
||||
random(FineRNG, scalar);
|
||||
Fine.GlobalIndexToGlobalCoor(gsite,coor);
|
||||
pokeSite(big,scalar,coor);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user