mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-22 17:52:02 +01:00
Compare commits
33 Commits
feature/di
...
3984265851
Author | SHA1 | Date | |
---|---|---|---|
3984265851 | |||
45361d188f | |||
80c9d77e02 | |||
3aff64dddb | |||
b4f2ca81ff | |||
d1dea5f840 | |||
54f8b84d16 | |||
da503fef0e | |||
4a6802098a | |||
f9b41a84d2 | |||
5d7e0d18b9 | |||
9e64387933 | |||
983b681d46 | |||
4072408b6f | |||
bd76b47fbf | |||
18ce23aa75 | |||
ffa7fe0cc2 | |||
86dac5ff4f | |||
4a382fad3f | |||
cc753670d9 | |||
cc9d88ea1c | |||
b281b0166e | |||
6a21f694ff | |||
af64c1c6b6 | |||
866f48391a | |||
a4df527d74 | |||
5764d21161 | |||
496d04cd85 | |||
10e6d7c6ce | |||
c42e25e5b8 | |||
a00ae981e0 | |||
39214702f6 | |||
3e4614c63a |
54
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
54
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
name: Bug report
|
||||||
|
description: Report a bug.
|
||||||
|
title: "<insert title>"
|
||||||
|
labels: [bug]
|
||||||
|
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: >
|
||||||
|
Thank you for taking the time to file a bug report.
|
||||||
|
Please check that the code is pointing to the HEAD of develop
|
||||||
|
or any commit in master which is tagged with a version number.
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: "Describe the issue:"
|
||||||
|
description: >
|
||||||
|
Describe the issue and any previous attempt to solve it.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: "Code example:"
|
||||||
|
description: >
|
||||||
|
If relevant, show how to reproduce the issue using a minimal working
|
||||||
|
example.
|
||||||
|
placeholder: |
|
||||||
|
<< your code here >>
|
||||||
|
render: shell
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: "Target platform:"
|
||||||
|
description: >
|
||||||
|
Give a description of the target platform (CPU, network, compiler).
|
||||||
|
Please give the full CPU part description, using for example
|
||||||
|
`cat /proc/cpuinfo | grep 'model name' | uniq` (Linux)
|
||||||
|
or `sysctl machdep.cpu.brand_string` (macOS) and the full output
|
||||||
|
the `--version` option of your compiler.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: "Configure options:"
|
||||||
|
description: >
|
||||||
|
Please give the exact configure command used and attach
|
||||||
|
`config.log`, `grid.config.summary` and the output of `make V=1`.
|
||||||
|
render: shell
|
||||||
|
validations:
|
||||||
|
required: true
|
@ -542,6 +542,7 @@ public:
|
|||||||
(*this)(in[i], out[i]);
|
(*this)(in[i], out[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
virtual ~LinearFunction(){};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Field> class IdentityLinearFunction : public LinearFunction<Field> {
|
template<class Field> class IdentityLinearFunction : public LinearFunction<Field> {
|
||||||
|
@ -166,16 +166,16 @@ public:
|
|||||||
rsqf[s] =rsq[s];
|
rsqf[s] =rsq[s];
|
||||||
std::cout<<GridLogMessage<<"ConjugateGradientMultiShiftMixedPrecCleanup: shift "<< s <<" target resid "<<rsq[s]<<std::endl;
|
std::cout<<GridLogMessage<<"ConjugateGradientMultiShiftMixedPrecCleanup: shift "<< s <<" target resid "<<rsq[s]<<std::endl;
|
||||||
// ps_d[s] = src_d;
|
// ps_d[s] = src_d;
|
||||||
precisionChangeFast(ps_f[s],src_d);
|
precisionChange(ps_f[s],src_d);
|
||||||
}
|
}
|
||||||
// r and p for primary
|
// r and p for primary
|
||||||
p_d = src_d; //primary copy --- make this a reference to ps_d to save axpys
|
p_d = src_d; //primary copy --- make this a reference to ps_d to save axpys
|
||||||
r_d = p_d;
|
r_d = p_d;
|
||||||
|
|
||||||
//MdagM+m[0]
|
//MdagM+m[0]
|
||||||
precisionChangeFast(p_f,p_d);
|
precisionChange(p_f,p_d);
|
||||||
Linop_f.HermOpAndNorm(p_f,mmp_f,d,qq); // mmp = MdagM p d=real(dot(p, mmp)), qq=norm2(mmp)
|
Linop_f.HermOpAndNorm(p_f,mmp_f,d,qq); // mmp = MdagM p d=real(dot(p, mmp)), qq=norm2(mmp)
|
||||||
precisionChangeFast(tmp_d,mmp_f);
|
precisionChange(tmp_d,mmp_f);
|
||||||
Linop_d.HermOpAndNorm(p_d,mmp_d,d,qq); // mmp = MdagM p d=real(dot(p, mmp)), qq=norm2(mmp)
|
Linop_d.HermOpAndNorm(p_d,mmp_d,d,qq); // mmp = MdagM p d=real(dot(p, mmp)), qq=norm2(mmp)
|
||||||
tmp_d = tmp_d - mmp_d;
|
tmp_d = tmp_d - mmp_d;
|
||||||
std::cout << " Testing operators match "<<norm2(mmp_d)<<" f "<<norm2(mmp_f)<<" diff "<< norm2(tmp_d)<<std::endl;
|
std::cout << " Testing operators match "<<norm2(mmp_d)<<" f "<<norm2(mmp_f)<<" diff "<< norm2(tmp_d)<<std::endl;
|
||||||
@ -204,7 +204,7 @@ public:
|
|||||||
|
|
||||||
for(int s=0;s<nshift;s++) {
|
for(int s=0;s<nshift;s++) {
|
||||||
axpby(psi_d[s],0.,-bs[s]*alpha[s],src_d,src_d);
|
axpby(psi_d[s],0.,-bs[s]*alpha[s],src_d,src_d);
|
||||||
precisionChangeFast(psi_f[s],psi_d[s]);
|
precisionChange(psi_f[s],psi_d[s]);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
@ -225,7 +225,7 @@ public:
|
|||||||
AXPYTimer.Stop();
|
AXPYTimer.Stop();
|
||||||
|
|
||||||
PrecChangeTimer.Start();
|
PrecChangeTimer.Start();
|
||||||
precisionChangeFast(r_f, r_d);
|
precisionChange(r_f, r_d);
|
||||||
PrecChangeTimer.Stop();
|
PrecChangeTimer.Stop();
|
||||||
|
|
||||||
AXPYTimer.Start();
|
AXPYTimer.Start();
|
||||||
@ -243,13 +243,13 @@ public:
|
|||||||
|
|
||||||
cp=c;
|
cp=c;
|
||||||
PrecChangeTimer.Start();
|
PrecChangeTimer.Start();
|
||||||
precisionChangeFast(p_f, p_d); //get back single prec search direction for linop
|
precisionChange(p_f, p_d); //get back single prec search direction for linop
|
||||||
PrecChangeTimer.Stop();
|
PrecChangeTimer.Stop();
|
||||||
MatrixTimer.Start();
|
MatrixTimer.Start();
|
||||||
Linop_f.HermOp(p_f,mmp_f);
|
Linop_f.HermOp(p_f,mmp_f);
|
||||||
MatrixTimer.Stop();
|
MatrixTimer.Stop();
|
||||||
PrecChangeTimer.Start();
|
PrecChangeTimer.Start();
|
||||||
precisionChangeFast(mmp_d, mmp_f); // From Float to Double
|
precisionChange(mmp_d, mmp_f); // From Float to Double
|
||||||
PrecChangeTimer.Stop();
|
PrecChangeTimer.Stop();
|
||||||
|
|
||||||
d=real(innerProduct(p_d,mmp_d));
|
d=real(innerProduct(p_d,mmp_d));
|
||||||
@ -311,7 +311,7 @@ public:
|
|||||||
SolverTimer.Stop();
|
SolverTimer.Stop();
|
||||||
|
|
||||||
for(int s=0;s<nshift;s++){
|
for(int s=0;s<nshift;s++){
|
||||||
precisionChangeFast(psi_d[s],psi_f[s]);
|
precisionChange(psi_d[s],psi_f[s]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ public:
|
|||||||
Linop_d.HermOpAndNorm(p_d,mmp_d,d,qq); // mmp = MdagM p d=real(dot(p, mmp)), qq=norm2(mmp)
|
Linop_d.HermOpAndNorm(p_d,mmp_d,d,qq); // mmp = MdagM p d=real(dot(p, mmp)), qq=norm2(mmp)
|
||||||
tmp_d = tmp_d - mmp_d;
|
tmp_d = tmp_d - mmp_d;
|
||||||
std::cout << " Testing operators match "<<norm2(mmp_d)<<" f "<<norm2(mmp_f)<<" diff "<< norm2(tmp_d)<<std::endl;
|
std::cout << " Testing operators match "<<norm2(mmp_d)<<" f "<<norm2(mmp_f)<<" diff "<< norm2(tmp_d)<<std::endl;
|
||||||
// assert(norm2(tmp_d)< 1.0e-4);
|
assert(norm2(tmp_d)< 1.0);
|
||||||
|
|
||||||
axpy(mmp_d,mass[0],p_d,mmp_d);
|
axpy(mmp_d,mass[0],p_d,mmp_d);
|
||||||
RealD rn = norm2(p_d);
|
RealD rn = norm2(p_d);
|
||||||
|
@ -519,7 +519,6 @@ void MemoryManager::Audit(std::string s)
|
|||||||
uint64_t LruBytes1=0;
|
uint64_t LruBytes1=0;
|
||||||
uint64_t LruBytes2=0;
|
uint64_t LruBytes2=0;
|
||||||
uint64_t LruCnt=0;
|
uint64_t LruCnt=0;
|
||||||
uint64_t LockedBytes=0;
|
|
||||||
|
|
||||||
std::cout << " Memory Manager::Audit() from "<<s<<std::endl;
|
std::cout << " Memory Manager::Audit() from "<<s<<std::endl;
|
||||||
for(auto it=LRU.begin();it!=LRU.end();it++){
|
for(auto it=LRU.begin();it!=LRU.end();it++){
|
||||||
|
@ -128,7 +128,7 @@ double CartesianCommunicator::StencilSendToRecvFromBegin(std::vector<CommsReques
|
|||||||
int recv_from_rank,int dor,
|
int recv_from_rank,int dor,
|
||||||
int xbytes,int rbytes, int dir)
|
int xbytes,int rbytes, int dir)
|
||||||
{
|
{
|
||||||
return 2.0*bytes;
|
return xbytes+rbytes;
|
||||||
}
|
}
|
||||||
void CartesianCommunicator::StencilSendToRecvFromComplete(std::vector<CommsRequest_t> &waitall,int dir)
|
void CartesianCommunicator::StencilSendToRecvFromComplete(std::vector<CommsRequest_t> &waitall,int dir)
|
||||||
{
|
{
|
||||||
|
@ -91,6 +91,59 @@ void *SharedMemory::ShmBufferSelf(void)
|
|||||||
//std::cerr << "ShmBufferSelf "<<ShmRank<<" "<<std::hex<< ShmCommBufs[ShmRank] <<std::dec<<std::endl;
|
//std::cerr << "ShmBufferSelf "<<ShmRank<<" "<<std::hex<< ShmCommBufs[ShmRank] <<std::dec<<std::endl;
|
||||||
return ShmCommBufs[ShmRank];
|
return ShmCommBufs[ShmRank];
|
||||||
}
|
}
|
||||||
|
static inline int divides(int a,int b)
|
||||||
|
{
|
||||||
|
return ( b == ( (b/a)*a ) );
|
||||||
|
}
|
||||||
|
void GlobalSharedMemory::GetShmDims(const Coordinate &WorldDims,Coordinate &ShmDims)
|
||||||
|
{
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Allow user to configure through environment variable
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
char* str = getenv(("GRID_SHM_DIMS_" + std::to_string(ShmDims.size())).c_str());
|
||||||
|
if ( str ) {
|
||||||
|
std::vector<int> IntShmDims;
|
||||||
|
GridCmdOptionIntVector(std::string(str),IntShmDims);
|
||||||
|
assert(IntShmDims.size() == WorldDims.size());
|
||||||
|
long ShmSize = 1;
|
||||||
|
for (int dim=0;dim<WorldDims.size();dim++) {
|
||||||
|
ShmSize *= (ShmDims[dim] = IntShmDims[dim]);
|
||||||
|
assert(divides(ShmDims[dim],WorldDims[dim]));
|
||||||
|
}
|
||||||
|
assert(ShmSize == WorldShmSize);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Powers of 2,3,5 only in prime decomposition for now
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
int ndimension = WorldDims.size();
|
||||||
|
ShmDims=Coordinate(ndimension,1);
|
||||||
|
|
||||||
|
std::vector<int> primes({2,3,5});
|
||||||
|
|
||||||
|
int dim = 0;
|
||||||
|
int last_dim = ndimension - 1;
|
||||||
|
int AutoShmSize = 1;
|
||||||
|
while(AutoShmSize != WorldShmSize) {
|
||||||
|
int p;
|
||||||
|
for(p=0;p<primes.size();p++) {
|
||||||
|
int prime=primes[p];
|
||||||
|
if ( divides(prime,WorldDims[dim]/ShmDims[dim])
|
||||||
|
&& divides(prime,WorldShmSize/AutoShmSize) ) {
|
||||||
|
AutoShmSize*=prime;
|
||||||
|
ShmDims[dim]*=prime;
|
||||||
|
last_dim = dim;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (p == primes.size() && last_dim == dim) {
|
||||||
|
std::cerr << "GlobalSharedMemory::GetShmDims failed" << std::endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
dim=(dim+1) %ndimension;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
|
@ -170,59 +170,7 @@ void GlobalSharedMemory::OptimalCommunicator(const Coordinate &processors,Grid_M
|
|||||||
if(nscan==3 && HPEhypercube ) OptimalCommunicatorHypercube(processors,optimal_comm,SHM);
|
if(nscan==3 && HPEhypercube ) OptimalCommunicatorHypercube(processors,optimal_comm,SHM);
|
||||||
else OptimalCommunicatorSharedMemory(processors,optimal_comm,SHM);
|
else OptimalCommunicatorSharedMemory(processors,optimal_comm,SHM);
|
||||||
}
|
}
|
||||||
static inline int divides(int a,int b)
|
|
||||||
{
|
|
||||||
return ( b == ( (b/a)*a ) );
|
|
||||||
}
|
|
||||||
void GlobalSharedMemory::GetShmDims(const Coordinate &WorldDims,Coordinate &ShmDims)
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////////
|
|
||||||
// Allow user to configure through environment variable
|
|
||||||
////////////////////////////////////////////////////////////////
|
|
||||||
char* str = getenv(("GRID_SHM_DIMS_" + std::to_string(ShmDims.size())).c_str());
|
|
||||||
if ( str ) {
|
|
||||||
std::vector<int> IntShmDims;
|
|
||||||
GridCmdOptionIntVector(std::string(str),IntShmDims);
|
|
||||||
assert(IntShmDims.size() == WorldDims.size());
|
|
||||||
long ShmSize = 1;
|
|
||||||
for (int dim=0;dim<WorldDims.size();dim++) {
|
|
||||||
ShmSize *= (ShmDims[dim] = IntShmDims[dim]);
|
|
||||||
assert(divides(ShmDims[dim],WorldDims[dim]));
|
|
||||||
}
|
|
||||||
assert(ShmSize == WorldShmSize);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
|
||||||
// Powers of 2,3,5 only in prime decomposition for now
|
|
||||||
////////////////////////////////////////////////////////////////
|
|
||||||
int ndimension = WorldDims.size();
|
|
||||||
ShmDims=Coordinate(ndimension,1);
|
|
||||||
|
|
||||||
std::vector<int> primes({2,3,5});
|
|
||||||
|
|
||||||
int dim = 0;
|
|
||||||
int last_dim = ndimension - 1;
|
|
||||||
int AutoShmSize = 1;
|
|
||||||
while(AutoShmSize != WorldShmSize) {
|
|
||||||
int p;
|
|
||||||
for(p=0;p<primes.size();p++) {
|
|
||||||
int prime=primes[p];
|
|
||||||
if ( divides(prime,WorldDims[dim]/ShmDims[dim])
|
|
||||||
&& divides(prime,WorldShmSize/AutoShmSize) ) {
|
|
||||||
AutoShmSize*=prime;
|
|
||||||
ShmDims[dim]*=prime;
|
|
||||||
last_dim = dim;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (p == primes.size() && last_dim == dim) {
|
|
||||||
std::cerr << "GlobalSharedMemory::GetShmDims failed" << std::endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
dim=(dim+1) %ndimension;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void GlobalSharedMemory::OptimalCommunicatorHypercube(const Coordinate &processors,Grid_MPI_Comm & optimal_comm,Coordinate &SHM)
|
void GlobalSharedMemory::OptimalCommunicatorHypercube(const Coordinate &processors,Grid_MPI_Comm & optimal_comm,Coordinate &SHM)
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
@ -507,6 +507,7 @@ public:
|
|||||||
}
|
}
|
||||||
this->face_table_computed=1;
|
this->face_table_computed=1;
|
||||||
assert(this->u_comm_offset==this->_unified_buffer_size);
|
assert(this->u_comm_offset==this->_unified_buffer_size);
|
||||||
|
accelerator_barrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -332,8 +332,7 @@ void WilsonFermion5D<Impl>::DhopInternalOverlappedComms(StencilImpl & st, Lebesg
|
|||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
{
|
{
|
||||||
GRID_TRACE("Gather");
|
GRID_TRACE("Gather");
|
||||||
st.HaloExchangeOptGather(in,compressor);
|
st.HaloExchangeOptGather(in,compressor); // Put the barrier in the routine
|
||||||
accelerator_barrier();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::vector<CommsRequest_t> > requests;
|
std::vector<std::vector<CommsRequest_t> > requests;
|
||||||
|
@ -428,9 +428,10 @@ void WilsonKernels<Impl>::DhopDirKernel( StencilImpl &st, DoubledGaugeField &U,S
|
|||||||
auto ptr = &st.surface_list[0]; \
|
auto ptr = &st.surface_list[0]; \
|
||||||
accelerator_forNB( ss, sz, Simd::Nsimd(), { \
|
accelerator_forNB( ss, sz, Simd::Nsimd(), { \
|
||||||
int sF = ptr[ss]; \
|
int sF = ptr[ss]; \
|
||||||
int sU = ss/Ls; \
|
int sU = sF/Ls; \
|
||||||
WilsonKernels<Impl>::A(st_v,U_v,buf,sF,sU,in_v,out_v); \
|
WilsonKernels<Impl>::A(st_v,U_v,buf,sF,sU,in_v,out_v); \
|
||||||
});
|
}); \
|
||||||
|
accelerator_barrier();
|
||||||
|
|
||||||
#define ASM_CALL(A) \
|
#define ASM_CALL(A) \
|
||||||
thread_for( sss, Nsite, { \
|
thread_for( sss, Nsite, { \
|
||||||
@ -474,9 +475,10 @@ void WilsonKernels<Impl>::DhopKernel(int Opt,StencilImpl &st, DoubledGaugeField
|
|||||||
if (Opt == WilsonKernelsStatic::OptInlineAsm ) { ASM_CALL(AsmDhopSiteInt); return;}
|
if (Opt == WilsonKernelsStatic::OptInlineAsm ) { ASM_CALL(AsmDhopSiteInt); return;}
|
||||||
#endif
|
#endif
|
||||||
} else if( exterior ) {
|
} else if( exterior ) {
|
||||||
|
// dependent on result of merge
|
||||||
acceleratorFenceComputeStream();
|
acceleratorFenceComputeStream();
|
||||||
if (Opt == WilsonKernelsStatic::OptGeneric ) { KERNEL_CALL(GenericDhopSiteExt); return;}
|
if (Opt == WilsonKernelsStatic::OptGeneric ) { KERNEL_CALL_EXT(GenericDhopSiteExt); return;}
|
||||||
if (Opt == WilsonKernelsStatic::OptHandUnroll ) { KERNEL_CALL(HandDhopSiteExt); return;}
|
if (Opt == WilsonKernelsStatic::OptHandUnroll ) { KERNEL_CALL_EXT(HandDhopSiteExt); return;}
|
||||||
#ifndef GRID_CUDA
|
#ifndef GRID_CUDA
|
||||||
if (Opt == WilsonKernelsStatic::OptInlineAsm ) { ASM_CALL(AsmDhopSiteExt); return;}
|
if (Opt == WilsonKernelsStatic::OptInlineAsm ) { ASM_CALL(AsmDhopSiteExt); return;}
|
||||||
#endif
|
#endif
|
||||||
@ -506,9 +508,10 @@ void WilsonKernels<Impl>::DhopKernel(int Opt,StencilImpl &st, DoubledGaugeField
|
|||||||
if (Opt == WilsonKernelsStatic::OptInlineAsm ) { ASM_CALL(AsmDhopSiteDagInt); return;}
|
if (Opt == WilsonKernelsStatic::OptInlineAsm ) { ASM_CALL(AsmDhopSiteDagInt); return;}
|
||||||
#endif
|
#endif
|
||||||
} else if( exterior ) {
|
} else if( exterior ) {
|
||||||
|
// Dependent on result of merge
|
||||||
acceleratorFenceComputeStream();
|
acceleratorFenceComputeStream();
|
||||||
if (Opt == WilsonKernelsStatic::OptGeneric ) { KERNEL_CALL(GenericDhopSiteDagExt); return;}
|
if (Opt == WilsonKernelsStatic::OptGeneric ) { KERNEL_CALL_EXT(GenericDhopSiteDagExt); return;}
|
||||||
if (Opt == WilsonKernelsStatic::OptHandUnroll ) { KERNEL_CALL(HandDhopSiteDagExt); return;}
|
if (Opt == WilsonKernelsStatic::OptHandUnroll ) { KERNEL_CALL_EXT(HandDhopSiteDagExt); return;}
|
||||||
#ifndef GRID_CUDA
|
#ifndef GRID_CUDA
|
||||||
if (Opt == WilsonKernelsStatic::OptInlineAsm ) { ASM_CALL(AsmDhopSiteDagExt); return;}
|
if (Opt == WilsonKernelsStatic::OptInlineAsm ) { ASM_CALL(AsmDhopSiteDagExt); return;}
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,9 +53,10 @@ NAMESPACE_BEGIN(Grid);
|
|||||||
Integer ReliableUpdateFreq;
|
Integer ReliableUpdateFreq;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
//Action evaluation
|
||||||
//Allow derived classes to override the multishift CG
|
//Allow derived classes to override the multishift CG
|
||||||
virtual void multiShiftInverse(bool numerator, const MultiShiftFunction &approx, const Integer MaxIter, const FermionFieldD &in, FermionFieldD &out){
|
virtual void multiShiftInverse(bool numerator, const MultiShiftFunction &approx, const Integer MaxIter, const FermionFieldD &in, FermionFieldD &out){
|
||||||
#if 0
|
#if 1
|
||||||
SchurDifferentiableOperator<ImplD> schurOp(numerator ? NumOpD : DenOpD);
|
SchurDifferentiableOperator<ImplD> schurOp(numerator ? NumOpD : DenOpD);
|
||||||
ConjugateGradientMultiShift<FermionFieldD> msCG(MaxIter, approx);
|
ConjugateGradientMultiShift<FermionFieldD> msCG(MaxIter, approx);
|
||||||
msCG(schurOp,in, out);
|
msCG(schurOp,in, out);
|
||||||
@ -70,9 +71,10 @@ NAMESPACE_BEGIN(Grid);
|
|||||||
msCG(schurOpD, in, out);
|
msCG(schurOpD, in, out);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
//Force evaluation
|
||||||
virtual void multiShiftInverse(bool numerator, const MultiShiftFunction &approx, const Integer MaxIter, const FermionFieldD &in, std::vector<FermionFieldD> &out_elems, FermionFieldD &out){
|
virtual void multiShiftInverse(bool numerator, const MultiShiftFunction &approx, const Integer MaxIter, const FermionFieldD &in, std::vector<FermionFieldD> &out_elems, FermionFieldD &out){
|
||||||
SchurDifferentiableOperator<ImplD> schurOpD(numerator ? NumOpD : DenOpD);
|
SchurDifferentiableOperator<ImplD> schurOpD(numerator ? NumOpD : DenOpD);
|
||||||
SchurDifferentiableOperator<ImplF> schurOpF (numerator ? NumOpF : DenOpF);
|
SchurDifferentiableOperator<ImplF> schurOpF(numerator ? NumOpF : DenOpF);
|
||||||
|
|
||||||
FermionFieldD inD(NumOpD.FermionRedBlackGrid());
|
FermionFieldD inD(NumOpD.FermionRedBlackGrid());
|
||||||
FermionFieldD outD(NumOpD.FermionRedBlackGrid());
|
FermionFieldD outD(NumOpD.FermionRedBlackGrid());
|
||||||
@ -84,20 +86,15 @@ NAMESPACE_BEGIN(Grid);
|
|||||||
virtual void ImportGauge(const typename ImplD::GaugeField &Ud){
|
virtual void ImportGauge(const typename ImplD::GaugeField &Ud){
|
||||||
|
|
||||||
typename ImplF::GaugeField Uf(NumOpF.GaugeGrid());
|
typename ImplF::GaugeField Uf(NumOpF.GaugeGrid());
|
||||||
typename ImplD::GaugeField Ud2(NumOpD.GaugeGrid());
|
|
||||||
precisionChange(Uf, Ud);
|
precisionChange(Uf, Ud);
|
||||||
precisionChange(Ud2, Ud);
|
|
||||||
|
|
||||||
std::cout << "Importing "<<norm2(Ud)<<" "<< norm2(Uf)<<" " << norm2(Ud2)<<std::endl;
|
std::cout << "Importing "<<norm2(Ud)<<" "<< norm2(Uf)<<" " <<std::endl;
|
||||||
|
|
||||||
NumOpD.ImportGauge(Ud);
|
NumOpD.ImportGauge(Ud);
|
||||||
DenOpD.ImportGauge(Ud);
|
DenOpD.ImportGauge(Ud);
|
||||||
|
|
||||||
NumOpF.ImportGauge(Uf);
|
NumOpF.ImportGauge(Uf);
|
||||||
DenOpF.ImportGauge(Uf);
|
DenOpF.ImportGauge(Uf);
|
||||||
|
|
||||||
NumOpD.ImportGauge(Ud2);
|
|
||||||
DenOpD.ImportGauge(Ud2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -320,7 +320,7 @@ struct Conj{
|
|||||||
|
|
||||||
struct TimesMinusI{
|
struct TimesMinusI{
|
||||||
//Complex single
|
//Complex single
|
||||||
inline float32x4_t operator()(float32x4_t in, float32x4_t ret){
|
inline float32x4_t operator()(float32x4_t in){
|
||||||
// ar ai br bi -> ai -ar ai -br
|
// ar ai br bi -> ai -ar ai -br
|
||||||
float32x4_t r0, r1;
|
float32x4_t r0, r1;
|
||||||
r0 = vnegq_f32(in); // -ar -ai -br -bi
|
r0 = vnegq_f32(in); // -ar -ai -br -bi
|
||||||
@ -328,7 +328,7 @@ struct TimesMinusI{
|
|||||||
return vtrn1q_f32(r1, r0); // ar -ai br -bi
|
return vtrn1q_f32(r1, r0); // ar -ai br -bi
|
||||||
}
|
}
|
||||||
//Complex double
|
//Complex double
|
||||||
inline float64x2_t operator()(float64x2_t in, float64x2_t ret){
|
inline float64x2_t operator()(float64x2_t in){
|
||||||
// a ib -> b -ia
|
// a ib -> b -ia
|
||||||
float64x2_t tmp;
|
float64x2_t tmp;
|
||||||
tmp = vnegq_f64(in);
|
tmp = vnegq_f64(in);
|
||||||
@ -338,7 +338,7 @@ struct TimesMinusI{
|
|||||||
|
|
||||||
struct TimesI{
|
struct TimesI{
|
||||||
//Complex single
|
//Complex single
|
||||||
inline float32x4_t operator()(float32x4_t in, float32x4_t ret){
|
inline float32x4_t operator()(float32x4_t in){
|
||||||
// ar ai br bi -> -ai ar -bi br
|
// ar ai br bi -> -ai ar -bi br
|
||||||
float32x4_t r0, r1;
|
float32x4_t r0, r1;
|
||||||
r0 = vnegq_f32(in); // -ar -ai -br -bi
|
r0 = vnegq_f32(in); // -ar -ai -br -bi
|
||||||
@ -346,7 +346,7 @@ struct TimesI{
|
|||||||
return vtrn1q_f32(r1, in); // -ai ar -bi br
|
return vtrn1q_f32(r1, in); // -ai ar -bi br
|
||||||
}
|
}
|
||||||
//Complex double
|
//Complex double
|
||||||
inline float64x2_t operator()(float64x2_t in, float64x2_t ret){
|
inline float64x2_t operator()(float64x2_t in){
|
||||||
// a ib -> -b ia
|
// a ib -> -b ia
|
||||||
float64x2_t tmp;
|
float64x2_t tmp;
|
||||||
tmp = vnegq_f64(in);
|
tmp = vnegq_f64(in);
|
||||||
|
@ -348,7 +348,7 @@ public:
|
|||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Stencil query
|
// Stencil query
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
#ifdef SHM_FAST_PATH
|
#if 1
|
||||||
inline int SameNode(int point) {
|
inline int SameNode(int point) {
|
||||||
|
|
||||||
int dimension = this->_directions[point];
|
int dimension = this->_directions[point];
|
||||||
@ -665,11 +665,9 @@ public:
|
|||||||
for(int i=0;i<mm.size();i++){
|
for(int i=0;i<mm.size();i++){
|
||||||
decompressor::MergeFace(decompress,mm[i]);
|
decompressor::MergeFace(decompress,mm[i]);
|
||||||
}
|
}
|
||||||
if ( mm.size() ) acceleratorFenceComputeStream();
|
|
||||||
for(int i=0;i<dd.size();i++){
|
for(int i=0;i<dd.size();i++){
|
||||||
decompressor::DecompressFace(decompress,dd[i]);
|
decompressor::DecompressFace(decompress,dd[i]);
|
||||||
}
|
}
|
||||||
if ( dd.size() ) acceleratorFenceComputeStream();
|
|
||||||
}
|
}
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Set up routines
|
// Set up routines
|
||||||
@ -707,6 +705,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::cout << "BuildSurfaceList size is "<<surface_list.size()<<std::endl;
|
||||||
}
|
}
|
||||||
/// Introduce a block structure and switch off comms on boundaries
|
/// Introduce a block structure and switch off comms on boundaries
|
||||||
void DirichletBlock(const Coordinate &dirichlet_block)
|
void DirichletBlock(const Coordinate &dirichlet_block)
|
||||||
@ -1368,10 +1367,11 @@ public:
|
|||||||
int recv_from_rank;
|
int recv_from_rank;
|
||||||
int xmit_to_rank;
|
int xmit_to_rank;
|
||||||
int shm_send=0;
|
int shm_send=0;
|
||||||
int shm_recv=0;
|
|
||||||
_grid->ShiftedRanks(dimension,nbr_proc,xmit_to_rank,recv_from_rank);
|
_grid->ShiftedRanks(dimension,nbr_proc,xmit_to_rank,recv_from_rank);
|
||||||
#ifdef SHM_FAST_PATH
|
#ifdef SHM_FAST_PATH
|
||||||
#warning STENCIL SHM FAST PATH SELECTED
|
#warning STENCIL SHM FAST PATH SELECTED
|
||||||
|
int shm_recv=0;
|
||||||
// shm == receive pointer if offnode
|
// shm == receive pointer if offnode
|
||||||
// shm == Translate[send pointer] if on node -- my view of his send pointer
|
// shm == Translate[send pointer] if on node -- my view of his send pointer
|
||||||
cobj *shm = (cobj *) _grid->ShmBufferTranslate(recv_from_rank,sp);
|
cobj *shm = (cobj *) _grid->ShmBufferTranslate(recv_from_rank,sp);
|
||||||
@ -1404,7 +1404,6 @@ public:
|
|||||||
acceleratorMemSet(rp,0,bytes); // Zero prefill comms buffer to zero
|
acceleratorMemSet(rp,0,bytes); // Zero prefill comms buffer to zero
|
||||||
}
|
}
|
||||||
int do_send = (comms_send|comms_partial_send) && (!shm_send );
|
int do_send = (comms_send|comms_partial_send) && (!shm_send );
|
||||||
int do_recv = (comms_send|comms_partial_send) && (!shm_recv );
|
|
||||||
AddPacket((void *)sp,(void *)rp,
|
AddPacket((void *)sp,(void *)rp,
|
||||||
xmit_to_rank,do_send,
|
xmit_to_rank,do_send,
|
||||||
recv_from_rank,do_send,
|
recv_from_rank,do_send,
|
||||||
|
@ -133,7 +133,6 @@ typename vobj::scalar_object extractLane(int lane, const vobj & __restrict__ vec
|
|||||||
typedef scalar_type * pointer;
|
typedef scalar_type * pointer;
|
||||||
|
|
||||||
constexpr int words=sizeof(vobj)/sizeof(vector_type);
|
constexpr int words=sizeof(vobj)/sizeof(vector_type);
|
||||||
constexpr int Nsimd=vector_type::Nsimd();
|
|
||||||
|
|
||||||
scalar_object extracted;
|
scalar_object extracted;
|
||||||
pointer __restrict__ sp = (pointer)&extracted; // Type pun
|
pointer __restrict__ sp = (pointer)&extracted; // Type pun
|
||||||
@ -153,7 +152,6 @@ void insertLane(int lane, vobj & __restrict__ vec,const typename vobj::scalar_ob
|
|||||||
typedef scalar_type * pointer;
|
typedef scalar_type * pointer;
|
||||||
|
|
||||||
constexpr int words=sizeof(vobj)/sizeof(vector_type);
|
constexpr int words=sizeof(vobj)/sizeof(vector_type);
|
||||||
constexpr int Nsimd=vector_type::Nsimd();
|
|
||||||
|
|
||||||
pointer __restrict__ sp = (pointer)&extracted;
|
pointer __restrict__ sp = (pointer)&extracted;
|
||||||
vector_type *vp = (vector_type *)&vec;
|
vector_type *vp = (vector_type *)&vec;
|
||||||
@ -178,8 +176,6 @@ void extract(const vobj &vec,const ExtractPointerArray<sobj> &extracted, int off
|
|||||||
const int s = Nsimd/Nextr;
|
const int s = Nsimd/Nextr;
|
||||||
|
|
||||||
vector_type * vp = (vector_type *)&vec;
|
vector_type * vp = (vector_type *)&vec;
|
||||||
scalar_type vtmp;
|
|
||||||
sobj_scalar_type stmp;
|
|
||||||
for(int w=0;w<words;w++){
|
for(int w=0;w<words;w++){
|
||||||
for(int i=0;i<Nextr;i++){
|
for(int i=0;i<Nextr;i++){
|
||||||
sobj_scalar_type * pointer = (sobj_scalar_type *)& extracted[i][offset];
|
sobj_scalar_type * pointer = (sobj_scalar_type *)& extracted[i][offset];
|
||||||
@ -205,7 +201,6 @@ void merge(vobj &vec,const ExtractPointerArray<sobj> &extracted, int offset)
|
|||||||
|
|
||||||
vector_type * vp = (vector_type *)&vec;
|
vector_type * vp = (vector_type *)&vec;
|
||||||
scalar_type vtmp;
|
scalar_type vtmp;
|
||||||
sobj_scalar_type stmp;
|
|
||||||
for(int w=0;w<words;w++){
|
for(int w=0;w<words;w++){
|
||||||
for(int i=0;i<Nextr;i++){
|
for(int i=0;i<Nextr;i++){
|
||||||
sobj_scalar_type * pointer = (sobj_scalar_type *)& extracted[i][offset];
|
sobj_scalar_type * pointer = (sobj_scalar_type *)& extracted[i][offset];
|
||||||
@ -242,9 +237,6 @@ void copyLane(vobjOut & __restrict__ vecOut, int lane_out, const vobjIn & __rest
|
|||||||
typedef oextract_type * opointer;
|
typedef oextract_type * opointer;
|
||||||
typedef iextract_type * ipointer;
|
typedef iextract_type * ipointer;
|
||||||
|
|
||||||
constexpr int oNsimd=ovector_type::Nsimd();
|
|
||||||
constexpr int iNsimd=ivector_type::Nsimd();
|
|
||||||
|
|
||||||
iscalar_type itmp;
|
iscalar_type itmp;
|
||||||
oscalar_type otmp;
|
oscalar_type otmp;
|
||||||
|
|
||||||
|
@ -458,6 +458,7 @@ inline void acceleratorCopySynchronise(void) { hipStreamSynchronize(copyStream);
|
|||||||
// Common on all GPU targets
|
// Common on all GPU targets
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
#if defined(GRID_SYCL) || defined(GRID_CUDA) || defined(GRID_HIP)
|
#if defined(GRID_SYCL) || defined(GRID_CUDA) || defined(GRID_HIP)
|
||||||
|
// FIXME -- the non-blocking nature got broken March 30 2023 by PAB
|
||||||
#define accelerator_forNB( iter1, num1, nsimd, ... ) accelerator_for2dNB( iter1, num1, iter2, 1, nsimd, {__VA_ARGS__} );
|
#define accelerator_forNB( iter1, num1, nsimd, ... ) accelerator_for2dNB( iter1, num1, iter2, 1, nsimd, {__VA_ARGS__} );
|
||||||
|
|
||||||
#define accelerator_for( iter, num, nsimd, ... ) \
|
#define accelerator_for( iter, num, nsimd, ... ) \
|
||||||
@ -525,7 +526,7 @@ inline void acceleratorFreeCpu (void *ptr){free(ptr);};
|
|||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef GRID_SYCL
|
#ifdef GRID_SYCL
|
||||||
inline void acceleratorFenceComputeStream(void){ accelerator_barrier();};
|
inline void acceleratorFenceComputeStream(void){ theGridAccelerator->ext_oneapi_submit_barrier(); };
|
||||||
#else
|
#else
|
||||||
// Ordering within a stream guaranteed on Nvidia & AMD
|
// Ordering within a stream guaranteed on Nvidia & AMD
|
||||||
inline void acceleratorFenceComputeStream(void){ };
|
inline void acceleratorFenceComputeStream(void){ };
|
||||||
|
@ -227,7 +227,7 @@ int main(int argc, char **argv) {
|
|||||||
// std::vector<Real> hasenbusch({ light_mass, 0.005, 0.0145, 0.045, 0.108, 0.25, 0.51 , pv_mass }); // Updated
|
// std::vector<Real> hasenbusch({ light_mass, 0.005, 0.0145, 0.045, 0.108, 0.25, 0.51 , pv_mass }); // Updated
|
||||||
// std::vector<Real> hasenbusch({ light_mass, 0.0145, 0.045, 0.108, 0.25, 0.51 , 0.75 , pv_mass });
|
// std::vector<Real> hasenbusch({ light_mass, 0.0145, 0.045, 0.108, 0.25, 0.51 , 0.75 , pv_mass });
|
||||||
|
|
||||||
int SP_iters=10000;
|
int SP_iters=9000;
|
||||||
|
|
||||||
RationalActionParams OFRp; // Up/down
|
RationalActionParams OFRp; // Up/down
|
||||||
OFRp.lo = 6.0e-5;
|
OFRp.lo = 6.0e-5;
|
||||||
@ -362,12 +362,12 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// Probably dominates the force - back to EOFA.
|
// Probably dominates the force - back to EOFA.
|
||||||
OneFlavourRationalParams SFRp;
|
OneFlavourRationalParams SFRp;
|
||||||
SFRp.lo = 0.25;
|
SFRp.lo = 0.1;
|
||||||
SFRp.hi = 25.0;
|
SFRp.hi = 25.0;
|
||||||
SFRp.MaxIter = 10000;
|
SFRp.MaxIter = 10000;
|
||||||
SFRp.tolerance= 1.0e-5;
|
SFRp.tolerance= 1.0e-8;
|
||||||
SFRp.mdtolerance= 2.0e-4;
|
SFRp.mdtolerance= 2.0e-4;
|
||||||
SFRp.degree = 8;
|
SFRp.degree = 12;
|
||||||
SFRp.precision= 50;
|
SFRp.precision= 50;
|
||||||
|
|
||||||
MobiusEOFAFermionD Strange_Op_L (U , *FGrid , *FrbGrid , *GridPtr , *GridRBPtr , strange_mass, strange_mass, pv_mass, 0.0, -1, M5, b, c);
|
MobiusEOFAFermionD Strange_Op_L (U , *FGrid , *FrbGrid , *GridPtr , *GridRBPtr , strange_mass, strange_mass, pv_mass, 0.0, -1, M5, b, c);
|
||||||
|
@ -329,7 +329,6 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
|
|
||||||
auto grid4= GridPtr;
|
auto grid4= GridPtr;
|
||||||
auto rbgrid4= GridRBPtr;
|
|
||||||
auto rbgrid = StrangeOp.FermionRedBlackGrid();
|
auto rbgrid = StrangeOp.FermionRedBlackGrid();
|
||||||
auto grid = StrangeOp.FermionGrid();
|
auto grid = StrangeOp.FermionGrid();
|
||||||
if(1){
|
if(1){
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# Grid [),branch:name:develop)/statusIcon.svg)](http://ci.cliath.ph.ed.ac.uk/project.html?projectId=GridBasedSoftware_Grid&tab=projectOverview)
|
# Grid
|
||||||
|
|
||||||
**Data parallel C++ mathematical object library.**
|
**Data parallel C++ mathematical object library.**
|
||||||
|
|
||||||
|
[),branch:default:true)/statusIcon.svg)](https://ci.dev.dirac.ed.ac.uk/project/GridBasedSoftware_Grid?mode=builds)
|
||||||
|
|
||||||
License: GPL v2.
|
License: GPL v2.
|
||||||
|
|
||||||
Last update June 2017.
|
Last update June 2017.
|
||||||
|
@ -425,7 +425,7 @@ void Benchmark(int Ls, Coordinate Dirichlet)
|
|||||||
|
|
||||||
err = r_eo-result;
|
err = r_eo-result;
|
||||||
n2e= norm2(err);
|
n2e= norm2(err);
|
||||||
std::cout<<GridLogMessage << "norm diff "<< n2e<< " Line "<<__LINE__ <<std::endl;
|
std::cout<<GridLogMessage << "norm diff "<< n2e<<std::endl;
|
||||||
assert(n2e<1.0e-4);
|
assert(n2e<1.0e-4);
|
||||||
|
|
||||||
pickCheckerboard(Even,src_e,err);
|
pickCheckerboard(Even,src_e,err);
|
||||||
|
@ -3,8 +3,14 @@ export https_proxy=http://proxy-chain.intel.com:911
|
|||||||
export LD_LIBRARY_PATH=$HOME/prereqs/lib/:$LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH=$HOME/prereqs/lib/:$LD_LIBRARY_PATH
|
||||||
|
|
||||||
module load intel-release
|
module load intel-release
|
||||||
source /opt/intel/oneapi/PVC_setup.sh
|
module load intel-comp-rt/embargo-ci-neo
|
||||||
|
|
||||||
|
#source /opt/intel/oneapi/PVC_setup.sh
|
||||||
#source /opt/intel/oneapi/ATS_setup.sh
|
#source /opt/intel/oneapi/ATS_setup.sh
|
||||||
|
#module load intel-nightly/20230331
|
||||||
|
#module load intel-comp-rt/ci-neo-master/026093
|
||||||
|
|
||||||
|
#module load intel/mpich
|
||||||
module load intel/mpich/pvc45.3
|
module load intel/mpich/pvc45.3
|
||||||
export PATH=~/ATS/pti-gpu/tools/onetrace/:$PATH
|
export PATH=~/ATS/pti-gpu/tools/onetrace/:$PATH
|
||||||
|
|
||||||
|
@ -73,12 +73,12 @@ int main (int argc, char ** argv)
|
|||||||
RealD M5 =1.8;
|
RealD M5 =1.8;
|
||||||
|
|
||||||
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
|
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
|
||||||
std::cout<<GridLogMessage <<"DomainWallFermion vectorised test"<<std::endl;
|
std::cout<<GridLogMessage <<"DomainWallFermion test"<<std::endl;
|
||||||
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
|
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
|
||||||
std::vector<Complex> boundary = {1,1,1,-1};
|
std::vector<Complex> boundary = {1,1,1,-1};
|
||||||
DomainWallFermionD::ImplParams Params(boundary);
|
DomainWallFermionD::ImplParams Params(boundary);
|
||||||
Coordinate Dirichlet({0,8,8,16,32});
|
// Coordinate Dirichlet({0,8,8,16,32});
|
||||||
Params.dirichlet=Dirichlet;
|
// Params.dirichlet=Dirichlet;
|
||||||
|
|
||||||
DomainWallFermionD Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,Params);
|
DomainWallFermionD Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,Params);
|
||||||
TestWhat<DomainWallFermionD>(Ddwf,FGrid,FrbGrid,UGrid,mass,M5,&RNG4,&RNG5);
|
TestWhat<DomainWallFermionD>(Ddwf,FGrid,FrbGrid,UGrid,mass,M5,&RNG4,&RNG5);
|
||||||
|
@ -53,7 +53,7 @@ static int readInt(int* argc, char*** argv, std::string&& option, int defaultVal
|
|||||||
|
|
||||||
static float readFloat(int* argc, char*** argv, std::string&& option, float defaultValue) {
|
static float readFloat(int* argc, char*** argv, std::string&& option, float defaultValue) {
|
||||||
std::string arg;
|
std::string arg;
|
||||||
float ret = defaultValue;
|
double ret = defaultValue;
|
||||||
if(checkPresent(argc, argv, option)) {
|
if(checkPresent(argc, argv, option)) {
|
||||||
arg = getContent(argc, argv, option);
|
arg = getContent(argc, argv, option);
|
||||||
GridCmdOptionFloat(arg, ret);
|
GridCmdOptionFloat(arg, ret);
|
||||||
|
@ -1,244 +0,0 @@
|
|||||||
/*************************************************************************************
|
|
||||||
|
|
||||||
Gamma::Algebra Gmu [] = {
|
|
||||||
Gamma::Algebra::GammaX,
|
|
||||||
Gamma::Algebra::GammaY,
|
|
||||||
Gamma::Algebra::GammaZ,
|
|
||||||
Gamma::Algebra::GammaT,
|
|
||||||
Gamma::Algebra::Gamma5
|
|
||||||
};
|
|
||||||
|
|
||||||
int main (int argc, char ** argv)
|
|
||||||
{
|
|
||||||
Grid_init(&argc,&argv);
|
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
|
||||||
|
|
||||||
Coordinate latt_size = GridDefaultLatt();
|
|
||||||
Coordinate simd_layout = GridDefaultSimd(Nd,vComplexD::Nsimd());
|
|
||||||
Coordinate mpi_layout = GridDefaultMpi();
|
|
||||||
|
|
||||||
int vol = 1;
|
|
||||||
for(int d=0;d<latt_size.size();d++){
|
|
||||||
vol = vol * latt_size[d];
|
|
||||||
}
|
|
||||||
GridCartesian GRID(latt_size,simd_layout,mpi_layout);
|
|
||||||
GridRedBlackCartesian RBGRID(&GRID);
|
|
||||||
|
|
||||||
LatticeComplexD coor(&GRID);
|
|
||||||
|
|
||||||
ComplexD ci(0.0,1.0);
|
|
||||||
|
|
||||||
std::vector<int> seeds({1,2,3,4});
|
|
||||||
GridSerialRNG sRNG; sRNG.SeedFixedIntegers(seeds); // naughty seeding
|
|
||||||
GridParallelRNG pRNG(&GRID);
|
|
||||||
pRNG.SeedFixedIntegers(seeds);
|
|
||||||
|
|
||||||
LatticeGaugeFieldD Umu(&GRID);
|
|
||||||
SU<Nc>::ColdConfiguration(pRNG,Umu); // Unit gauge
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
|
||||||
// Wilson test
|
|
||||||
////////////////////////////////////////////////////
|
|
||||||
{
|
|
||||||
LatticeFermionD src(&GRID); gaussian(pRNG,src);
|
|
||||||
LatticeFermionD src_p(&GRID);
|
|
||||||
LatticeFermionD tmp(&GRID);
|
|
||||||
LatticeFermionD ref(&GRID);
|
|
||||||
LatticeFermionD result(&GRID);
|
|
||||||
|
|
||||||
RealD mass=0.1;
|
|
||||||
WilsonFermionD Dw(Umu,GRID,RBGRID,mass);
|
|
||||||
|
|
||||||
Dw.M(src,ref);
|
|
||||||
std::cout << "Norm src "<<norm2(src)<<std::endl;
|
|
||||||
std::cout << "Norm Dw x src "<<norm2(ref)<<std::endl;
|
|
||||||
{
|
|
||||||
FFT theFFT(&GRID);
|
|
||||||
|
|
||||||
////////////////
|
|
||||||
// operator in Fourier space
|
|
||||||
////////////////
|
|
||||||
tmp =ref;
|
|
||||||
theFFT.FFT_all_dim(result,tmp,FFT::forward);
|
|
||||||
std::cout<<"FFT[ Dw x src ] "<< norm2(result)<<std::endl;
|
|
||||||
|
|
||||||
tmp = src;
|
|
||||||
theFFT.FFT_all_dim(src_p,tmp,FFT::forward);
|
|
||||||
std::cout<<"FFT[ src ] "<< norm2(src_p)<<std::endl;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// work out the predicted FT from Fourier
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
auto FGrid = &GRID;
|
|
||||||
LatticeFermionD Kinetic(FGrid); Kinetic = Zero();
|
|
||||||
LatticeComplexD kmu(FGrid);
|
|
||||||
LatticeInteger scoor(FGrid);
|
|
||||||
LatticeComplexD sk (FGrid); sk = Zero();
|
|
||||||
LatticeComplexD sk2(FGrid); sk2= Zero();
|
|
||||||
LatticeComplexD W(FGrid); W= Zero();
|
|
||||||
LatticeComplexD one(FGrid); one =ComplexD(1.0,0.0);
|
|
||||||
ComplexD ci(0.0,1.0);
|
|
||||||
|
|
||||||
for(int mu=0;mu<Nd;mu++) {
|
|
||||||
|
|
||||||
RealD TwoPiL = M_PI * 2.0/ latt_size[mu];
|
|
||||||
|
|
||||||
LatticeCoordinate(kmu,mu);
|
|
||||||
|
|
||||||
kmu = TwoPiL * kmu;
|
|
||||||
|
|
||||||
sk2 = sk2 + 2.0*sin(kmu*0.5)*sin(kmu*0.5);
|
|
||||||
sk = sk + sin(kmu) *sin(kmu);
|
|
||||||
|
|
||||||
// -1/2 Dw -> 1/2 gmu (eip - emip) = i sinp gmu
|
|
||||||
Kinetic = Kinetic + sin(kmu)*ci*(Gamma(Gmu[mu])*src_p);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
W = mass + sk2;
|
|
||||||
Kinetic = Kinetic + W * src_p;
|
|
||||||
|
|
||||||
std::cout<<"Momentum space src "<< norm2(src_p)<<std::endl;
|
|
||||||
std::cout<<"Momentum space Dw x src "<< norm2(Kinetic)<<std::endl;
|
|
||||||
std::cout<<"FT[Coordinate space Dw] "<< norm2(result)<<std::endl;
|
|
||||||
|
|
||||||
result = result - Kinetic;
|
|
||||||
std::cout<<"diff "<< norm2(result)<<std::endl;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << " =======================================" <<std::endl;
|
|
||||||
std::cout << " Checking FourierFreePropagator x Dw = 1" <<std::endl;
|
|
||||||
std::cout << " =======================================" <<std::endl;
|
|
||||||
std::cout << "Dw src = " <<norm2(src)<<std::endl;
|
|
||||||
std::cout << "Dw tmp = " <<norm2(tmp)<<std::endl;
|
|
||||||
Dw.M(src,tmp);
|
|
||||||
|
|
||||||
Dw.FreePropagator(tmp,ref,mass);
|
|
||||||
|
|
||||||
std::cout << "Dw ref = " <<norm2(ref)<<std::endl;
|
|
||||||
|
|
||||||
ref = ref - src;
|
|
||||||
|
|
||||||
std::cout << "Dw ref-src = " <<norm2(ref)<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
|
||||||
// Wilson prop
|
|
||||||
////////////////////////////////////////////////////
|
|
||||||
{
|
|
||||||
std::cout<<"****************************************"<<std::endl;
|
|
||||||
std::cout << "Wilson Mom space 4d propagator \n";
|
|
||||||
std::cout<<"****************************************"<<std::endl;
|
|
||||||
|
|
||||||
LatticeFermionD src(&GRID); gaussian(pRNG,src);
|
|
||||||
LatticeFermionD tmp(&GRID);
|
|
||||||
LatticeFermionD ref(&GRID);
|
|
||||||
LatticeFermionD diff(&GRID);
|
|
||||||
|
|
||||||
src=Zero();
|
|
||||||
Coordinate point(4,0); // 0,0,0,0
|
|
||||||
SpinColourVectorD ferm;
|
|
||||||
ferm=Zero();
|
|
||||||
ferm()(0)(0) = ComplexD(1.0);
|
|
||||||
pokeSite(ferm,src,point);
|
|
||||||
|
|
||||||
RealD mass=0.1;
|
|
||||||
|
|
||||||
WilsonFermionD Dw(Umu,GRID,RBGRID,mass);
|
|
||||||
|
|
||||||
// Momentum space prop
|
|
||||||
std::cout << " Solving by FFT and Feynman rules" <<std::endl;
|
|
||||||
Dw.FreePropagator(src,ref,mass) ;
|
|
||||||
|
|
||||||
Gamma G5(Gamma::Algebra::Gamma5);
|
|
||||||
|
|
||||||
LatticeFermionD result(&GRID);
|
|
||||||
const int sdir=0;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
// Conjugate gradient on normal equations system
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
std::cout << " Solving by Conjugate Gradient (CGNE)" <<std::endl;
|
|
||||||
Dw.Mdag(src,tmp);
|
|
||||||
src=tmp;
|
|
||||||
MdagMLinearOperator<WilsonFermionD,LatticeFermionD> HermOp(Dw);
|
|
||||||
ConjugateGradient<LatticeFermionD> CG(1.0e-10,10000);
|
|
||||||
CG(HermOp,src,result);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
std::cout << " Taking difference" <<std::endl;
|
|
||||||
std::cout << "Dw result "<<norm2(result)<<std::endl;
|
|
||||||
std::cout << "Dw ref "<<norm2(ref)<<std::endl;
|
|
||||||
|
|
||||||
diff = ref - result;
|
|
||||||
std::cout << "result - ref "<<norm2(diff)<<std::endl;
|
|
||||||
|
|
||||||
DumpSliceNorm("Slice Norm Solution ",result,Nd-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
|
||||||
//Gauge invariance test
|
|
||||||
////////////////////////////////////////////////////
|
|
||||||
{
|
|
||||||
std::cout<<"****************************************"<<std::endl;
|
|
||||||
std::cout << "Gauge invariance test \n";
|
|
||||||
std::cout<<"****************************************"<<std::endl;
|
|
||||||
LatticeGaugeField U_GT(&GRID); // Gauge transformed field
|
|
||||||
LatticeColourMatrix g(&GRID); // local Gauge xform matrix
|
|
||||||
U_GT = Umu;
|
|
||||||
// Make a random xform to teh gauge field
|
|
||||||
SU<Nc>::RandomGaugeTransform(pRNG,U_GT,g); // Unit gauge
|
|
||||||
|
|
||||||
LatticeFermionD src(&GRID);
|
|
||||||
LatticeFermionD tmp(&GRID);
|
|
||||||
LatticeFermionD ref(&GRID);
|
|
||||||
LatticeFermionD diff(&GRID);
|
|
||||||
|
|
||||||
// could loop over colors
|
|
||||||
src=Zero();
|
|
||||||
Coordinate point(4,0); // 0,0,0,0
|
|
||||||
SpinColourVectorD ferm;
|
|
||||||
ferm=Zero();
|
|
||||||
ferm()(0)(0) = ComplexD(1.0);
|
|
||||||
pokeSite(ferm,src,point);
|
|
||||||
|
|
||||||
RealD mass=0.1;
|
|
||||||
WilsonFermionD Dw(U_GT,GRID,RBGRID,mass);
|
|
||||||
|
|
||||||
// Momentum space prop
|
|
||||||
std::cout << " Solving by FFT and Feynman rules" <<std::endl;
|
|
||||||
Dw.FreePropagator(src,ref,mass) ;
|
|
||||||
|
|
||||||
Gamma G5(Gamma::Algebra::Gamma5);
|
|
||||||
|
|
||||||
LatticeFermionD result(&GRID);
|
|
||||||
const int sdir=0;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
// Conjugate gradient on normal equations system
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
std::cout << " Solving by Conjugate Gradient (CGNE)" <<std::endl;
|
|
||||||
Dw.Mdag(src,tmp);
|
|
||||||
src=tmp;
|
|
||||||
MdagMLinearOperator<WilsonFermionD,LatticeFermionD> HermOp(Dw);
|
|
||||||
ConjugateGradient<LatticeFermionD> CG(1.0e-10,10000);
|
|
||||||
CG(HermOp,src,result);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
std::cout << " Taking difference" <<std::endl;
|
|
||||||
std::cout << "Dw result "<<norm2(result)<<std::endl;
|
|
||||||
std::cout << "Dw ref "<<norm2(ref)<<std::endl;
|
|
||||||
|
|
||||||
diff = ref - result;
|
|
||||||
std::cout << "result - ref "<<norm2(diff)<<std::endl;
|
|
||||||
|
|
||||||
DumpSliceNorm("Slice Norm Solution ",result,Nd-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Grid_finalize();
|
|
||||||
}
|
|
Reference in New Issue
Block a user