From 5f75735dab3fcad328aeb0d92f9e5dcffd0aec53 Mon Sep 17 00:00:00 2001 From: Christoph Lehner Date: Thu, 6 Apr 2023 18:25:05 +0200 Subject: [PATCH 1/5] Add M and Mdag to WilsonTMFermion --- Grid/qcd/action/fermion/WilsonTMFermion.h | 4 +++- .../WilsonTMFermionImplementation.h | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Grid/qcd/action/fermion/WilsonTMFermion.h b/Grid/qcd/action/fermion/WilsonTMFermion.h index 12c4b71a..cca716a0 100644 --- a/Grid/qcd/action/fermion/WilsonTMFermion.h +++ b/Grid/qcd/action/fermion/WilsonTMFermion.h @@ -63,7 +63,9 @@ public: virtual void MooeeDag(const FermionField &in, FermionField &out) ; virtual void MooeeInv(const FermionField &in, FermionField &out) ; virtual void MooeeInvDag(const FermionField &in, FermionField &out) ; - + virtual void M(const FermionField &in, FermionField &out) ; + virtual void Mdag(const FermionField &in, FermionField &out) ; + private: RealD mu; // TwistedMass parameter diff --git a/Grid/qcd/action/fermion/implementation/WilsonTMFermionImplementation.h b/Grid/qcd/action/fermion/implementation/WilsonTMFermionImplementation.h index 9a1a152c..12771c29 100644 --- a/Grid/qcd/action/fermion/implementation/WilsonTMFermionImplementation.h +++ b/Grid/qcd/action/fermion/implementation/WilsonTMFermionImplementation.h @@ -93,5 +93,25 @@ void WilsonTMFermion::MooeeInvDag(const FermionField &in, FermionField &ou RealD b = tm /sq; axpibg5x(out,in,a,b); } +template +void WilsonTMFermion::M(const FermionField &in, FermionField &out) { + out.Checkerboard() = in.Checkerboard(); + this->Dhop(in, out, DaggerNo); + FermionField tmp(out.Grid()); + RealD a = 4.0+this->mass; + RealD b = this->mu; + axpibg5x(tmp,in,a,b); + axpy(out, 1.0, tmp, out); +} +template +void WilsonTMFermion::Mdag(const FermionField &in, FermionField &out) { + out.Checkerboard() = in.Checkerboard(); + this->Dhop(in, out, DaggerYes); + FermionField tmp(out.Grid()); + RealD a = 4.0+this->mass; + RealD b = -this->mu; + axpibg5x(tmp,in,a,b); + axpy(out, 1.0, tmp, out); +} NAMESPACE_END(Grid); From da9cbfc7cc4c3954e3064210e4d801a9c48f90fe Mon Sep 17 00:00:00 2001 From: Christoph Lehner Date: Fri, 19 May 2023 20:22:20 +0200 Subject: [PATCH 2/5] Suppress BuildSurfaceList verbosity in Stencil.h --- Grid/stencil/Stencil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Grid/stencil/Stencil.h b/Grid/stencil/Stencil.h index 40f224e6..760657ae 100644 --- a/Grid/stencil/Stencil.h +++ b/Grid/stencil/Stencil.h @@ -705,7 +705,7 @@ public: } } } - std::cout << "BuildSurfaceList size is "< Date: Tue, 20 Jun 2023 20:36:24 +0300 Subject: [PATCH 3/5] Accelerator basisRotate also on HIP --- Grid/lattice/Lattice_basis.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Grid/lattice/Lattice_basis.h b/Grid/lattice/Lattice_basis.h index 0928cbd7..9415bd4f 100644 --- a/Grid/lattice/Lattice_basis.h +++ b/Grid/lattice/Lattice_basis.h @@ -62,7 +62,7 @@ void basisRotate(VField &basis,Matrix& Qt,int j0, int j1, int k0,int k1,int Nm) basis_v.push_back(basis[k].View(AcceleratorWrite)); } -#if ( (!defined(GRID_CUDA)) ) +#if ( !(defined(GRID_CUDA) || defined(GRID_HIP)) ) int max_threads = thread_max(); Vector < vobj > Bt(Nm * max_threads); thread_region From e2a3dae1f25d93b3a50649ed119b394deedc800d Mon Sep 17 00:00:00 2001 From: Christoph Lehner Date: Sun, 8 Oct 2023 08:58:44 +0200 Subject: [PATCH 4/5] Option for multiple simultaneous CartesianStencils --- Grid/communicator/SharedMemoryMPI.cc | 20 ++++++++++---------- Grid/stencil/Stencil.h | 7 +++++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Grid/communicator/SharedMemoryMPI.cc b/Grid/communicator/SharedMemoryMPI.cc index 335404c2..affc3ba2 100644 --- a/Grid/communicator/SharedMemoryMPI.cc +++ b/Grid/communicator/SharedMemoryMPI.cc @@ -27,7 +27,7 @@ Author: Christoph Lehner *************************************************************************************/ /* END LEGAL */ -#define header "SharedMemoryMpi: " +#define Grid_header "SharedMemoryMpi: " #include #include @@ -174,8 +174,8 @@ void GlobalSharedMemory::Init(Grid_MPI_Comm comm) MPI_Comm_size(WorldShmComm ,&WorldShmSize); if ( WorldRank == 0) { - std::cout << header " World communicator of size " < &directions, const std::vector &distances, - Parameters p=Parameters()) + Parameters p=Parameters(), + bool preserve_shm=false) { face_table_computed=0; _grid = grid; @@ -854,7 +855,9 @@ public: ///////////////////////////////////////////////////////////////////////////////// const int Nsimd = grid->Nsimd(); - _grid->ShmBufferFreeAll(); + // Allow for multiple stencils to exist simultaneously + if (!preserve_shm) + _grid->ShmBufferFreeAll(); int maxl=2; u_simd_send_buf.resize(maxl); From f2648e94b92c9939e33f55e401ec2fab01d7f553 Mon Sep 17 00:00:00 2001 From: Christoph Lehner Date: Mon, 23 Oct 2023 13:47:41 +0200 Subject: [PATCH 5/5] getHostPointer added to Lattice --- Grid/lattice/Lattice_view.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Grid/lattice/Lattice_view.h b/Grid/lattice/Lattice_view.h index cb568abd..064c10e6 100644 --- a/Grid/lattice/Lattice_view.h +++ b/Grid/lattice/Lattice_view.h @@ -45,6 +45,7 @@ public: }; // Host only GridBase * getGrid(void) const { return _grid; }; + vobj* getHostPointer(void) const { return _odata; }; }; /////////////////////////////////////////////////////////////////////////////////////////