mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-03 18:55:56 +01: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);
|
ComplexD nrm = innerProduct(arg,arg);
|
||||||
return real(nrm);
|
return real(nrm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//The global maximum of the site norm2
|
||||||
template<class vobj> inline RealD maxLocalNorm2(const Lattice<vobj> &arg)
|
template<class vobj> inline RealD maxLocalNorm2(const Lattice<vobj> &arg)
|
||||||
{
|
{
|
||||||
typedef typename vobj::tensor_reduced vscalar;
|
typedef typename vobj::tensor_reduced vscalar; //iScalar<iScalar<.... <vPODtype> > >
|
||||||
typedef typename vobj::scalar_object scalar;
|
typedef typename vscalar::scalar_object scalar; //iScalar<iScalar<.... <PODtype> > >
|
||||||
typedef typename getPrecision<vobj>::real_scalar_type rscalar;
|
|
||||||
|
|
||||||
Lattice<vscalar> inner = localNorm2(arg);
|
Lattice<vscalar> inner = localNorm2(arg);
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class MADWF
|
|||||||
maxiter =_maxiter;
|
maxiter =_maxiter;
|
||||||
};
|
};
|
||||||
|
|
||||||
void operator() (const FermionFieldo &src4,FermionFieldo &sol5)
|
void operator() (const FermionFieldo &src,FermionFieldo &sol5)
|
||||||
{
|
{
|
||||||
std::cout << GridLogMessage<< " ************************************************" << std::endl;
|
std::cout << GridLogMessage<< " ************************************************" << std::endl;
|
||||||
std::cout << GridLogMessage<< " MADWF-like algorithm " << std::endl;
|
std::cout << GridLogMessage<< " MADWF-like algorithm " << std::endl;
|
||||||
@ -114,8 +114,16 @@ class MADWF
|
|||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
//Import source, include Dminus factors
|
//Import source, include Dminus factors
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
Mato.ImportPhysicalFermionSource(src4,b);
|
GridBase *src_grid = src.Grid();
|
||||||
std::cout << GridLogMessage << " src4 " <<norm2(src4)<<std::endl;
|
|
||||||
|
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;
|
std::cout << GridLogMessage << " b " <<norm2(b)<<std::endl;
|
||||||
|
|
||||||
defect = b;
|
defect = b;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <Grid/GridCore.h>
|
#include <Grid/GridCore.h>
|
||||||
|
|
||||||
NAMESPACE_BEGIN(Grid);
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
int acceleratorAbortOnGpuError=1;
|
||||||
uint32_t accelerator_threads=2;
|
uint32_t accelerator_threads=2;
|
||||||
uint32_t acceleratorThreads(void) {return accelerator_threads;};
|
uint32_t acceleratorThreads(void) {return accelerator_threads;};
|
||||||
void acceleratorThreads(uint32_t t) {accelerator_threads = t;};
|
void acceleratorThreads(uint32_t t) {accelerator_threads = t;};
|
||||||
|
@ -100,6 +100,8 @@ void acceleratorInit(void);
|
|||||||
#define accelerator __host__ __device__
|
#define accelerator __host__ __device__
|
||||||
#define accelerator_inline __host__ __device__ inline
|
#define accelerator_inline __host__ __device__ inline
|
||||||
|
|
||||||
|
extern int acceleratorAbortOnGpuError;
|
||||||
|
|
||||||
accelerator_inline int acceleratorSIMTlane(int Nsimd) {
|
accelerator_inline int acceleratorSIMTlane(int Nsimd) {
|
||||||
#ifdef GRID_SIMT
|
#ifdef GRID_SIMT
|
||||||
return threadIdx.z;
|
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 )); \
|
printf("Cuda error %s \n", cudaGetErrorString( err )); \
|
||||||
puts(__FILE__); \
|
puts(__FILE__); \
|
||||||
printf("Line %d\n",__LINE__); \
|
printf("Line %d\n",__LINE__); \
|
||||||
|
if (acceleratorAbortOnGpuError) assert(err==cudaSuccess); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,12 +232,13 @@ int main(int argc, char **argv) {
|
|||||||
scalar = localNorm2(cVec);
|
scalar = localNorm2(cVec);
|
||||||
|
|
||||||
std::cout << "Testing maxLocalNorm2" <<std::endl;
|
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);
|
TComplex big(10.0);
|
||||||
Coordinate coor;
|
Coordinate coor;
|
||||||
|
|
||||||
random(FineRNG, scalar);
|
|
||||||
Fine.GlobalIndexToGlobalCoor(gsite,coor);
|
Fine.GlobalIndexToGlobalCoor(gsite,coor);
|
||||||
pokeSite(big,scalar,coor);
|
pokeSite(big,scalar,coor);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user