Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minimal trial implementation for a twisted clover determinant derivative (pre-draft) #1338

Merged
merged 101 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 77 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
618e12b
minimal trial implementation for the derivative of a twisted clover m…
kostrzewa Nov 18, 2022
5c2458f
twistFlavor must be set in computeTMCloverForce
kostrzewa Nov 19, 2022
109440f
newlines in status printfQuda
kostrzewa Nov 19, 2022
60c8699
Fix crash in computeCloverForceQuda.
SaltyChiang Nov 20, 2022
eb888b7
Fix typos in computeCloverForceQuda.
SaltyChiang Nov 20, 2022
b9764df
Apply dynamic inverse for clover term in `cloverSigmaTraceCompute`.
SaltyChiang Nov 22, 2022
8e15042
Fix the `cudaErrorIllegalAddress` error in `computeCloverForce`.
SaltyChiang Nov 22, 2022
45421de
Fix possiable incompatible extended dimensions in `cloverDerivative`.
SaltyChiang Nov 22, 2022
a1a9c62
Revert and clean up.
SaltyChiang Nov 23, 2022
5265c1a
some more temporary debug help
kostrzewa Nov 30, 2022
7e9eff6
Merge remote-tracking branch 'SaltyChiang/hotfix/computeCloverForceQu…
kostrzewa Nov 30, 2022
bc16ff5
match x and p with x and -y in tmLQCD
Marcogarofalo Dec 21, 2022
d969bc3
computeCloverForce match tmLQCD
Marcogarofalo Jan 26, 2023
2606bcd
fix value of ferm_epsilon
Marcogarofalo Jan 30, 2023
723f037
computeTMCloverForceQuda now gives the same result of tmLQCD
Marcogarofalo Feb 1, 2023
defbbff
Make sure extendedGaugeResident has the correct R
Marcogarofalo Feb 1, 2023
95ff6b8
add parity option to computeCloverSigmaTrace
Marcogarofalo Feb 7, 2023
1e1af7f
dirty fix for multiple mpi tasks
Marcogarofalo May 10, 2023
64ec54c
fix reference tmc_dslash
Marcogarofalo Jun 1, 2023
10c19d5
start writing reference test for clover force
Marcogarofalo Jun 2, 2023
f6a2b88
contruction of the spinot x and p on the host reference
Marcogarofalo Jun 2, 2023
d8fbbfd
initiate the momentum to zero
Marcogarofalo Jun 29, 2023
e7e87e6
start reference implementation of computeCloverForce
Marcogarofalo Jul 6, 2023
2dc13ee
A B parity=0 works
Marcogarofalo Jul 7, 2023
92520d6
change momentum sign + split result of different kernels
Marcogarofalo Jul 7, 2023
e56a6e5
host reference of computeCloverForce
Marcogarofalo Jul 10, 2023
f699aea
loading clover and inverting in cloverSigmaTraceCompute_host
Marcogarofalo Aug 16, 2023
c40348b
cloverDerivative_reference implementation
Marcogarofalo Sep 8, 2023
2f47c1e
computeCloverSigmaOprod_reference implementation
Marcogarofalo Sep 11, 2023
a21a6bd
fix typo
Marcogarofalo Sep 11, 2023
e455efa
formatting
Marcogarofalo Sep 27, 2023
1ac71e7
Merge branch 'develop' into feature/tm_force
Marcogarofalo Sep 28, 2023
f4fccdb
Merge branch 'develop' into feature/tm_force
Marcogarofalo Sep 28, 2023
915194c
remove unused argument
Marcogarofalo Sep 29, 2023
3cba7b1
set appropriate dslash in TMCloverForce_test
Marcogarofalo Sep 29, 2023
cf2ba5a
computeTMCloverForceQuda in single precision
Marcogarofalo Oct 1, 2023
e69a8d3
add support when when ndef MULTI_GPU
Marcogarofalo Oct 2, 2023
4383a77
cloverDerivative in single precision
Marcogarofalo Oct 2, 2023
6f1129b
set mu to zero if --dslash-type clover
Marcogarofalo Oct 4, 2023
def42f5
avoiding warning
Marcogarofalo Oct 4, 2023
f141e86
print only on verbose
Marcogarofalo Oct 5, 2023
4a84a48
try to fix segmentation fault
Marcogarofalo Oct 5, 2023
27a3e7b
fix test for --dslash-type clover
Marcogarofalo Oct 5, 2023
fd30fd7
pass quarkX and quarkP to computeCloverForce
Marcogarofalo Nov 1, 2023
32dbf2e
remove comment
Marcogarofalo Nov 1, 2023
30e4f52
return error if symmetric preconditioning
Marcogarofalo Nov 1, 2023
bacaa48
remove typo
Marcogarofalo Nov 2, 2023
b770a71
foce of ratio of determinants
Marcogarofalo Nov 21, 2023
a6b85ac
Merge branch 'develop' of github.com:lattice/quda into feature/tm_force
maddyscientist Dec 2, 2023
d67e973
Test cleanup and fix some profiling
maddyscientist Dec 2, 2023
63e8ce7
Cleanup of ColorSpinorField: packing and ghost exchange methods are n…
maddyscientist Dec 4, 2023
88b7f1c
Significant cleanup of clover force kernels. Fix non-dynamic clover …
maddyscientist Dec 5, 2023
f3eb95c
Minor optimization
maddyscientist Dec 5, 2023
901dded
Minor cleanup
maddyscientist Dec 5, 2023
5a20f27
fix segmentation fault with multiple quark fields
Marcogarofalo Dec 5, 2023
d79722e
force test with multiple quark fields
Marcogarofalo Dec 5, 2023
0ceec38
test support detratio flag
Marcogarofalo Dec 5, 2023
4903592
nvector and detratio as command line argument
Marcogarofalo Dec 5, 2023
34bf89e
add corners in the ghost face counting
Marcogarofalo Dec 5, 2023
ab942df
Add some OMP parallelization to clover force tests
maddyscientist Dec 5, 2023
f87ec70
Remove unecessary communication from clover_outer_product and work ar…
maddyscientist Dec 5, 2023
cda08b0
fix variable used uninitialised
Marcogarofalo Dec 6, 2023
c1ee1f7
minor cleanup
Marcogarofalo Dec 6, 2023
1b3c342
Cleanup and optimization of clover derivative kernel: fuse into a sin…
maddyscientist Dec 6, 2023
1eeab25
Cleanup of clover sigma oprod kernel
maddyscientist Dec 6, 2023
d80a476
Small cleanup of clover sigma trace kernel
maddyscientist Dec 6, 2023
3aed5e0
Merge branch 'feature/tm_force' of github.com:lattice/quda into featu…
maddyscientist Dec 7, 2023
c310d9c
Some small cleanup of clover interface functions
maddyscientist Dec 7, 2023
96b7f29
Fix narrowing conversion with clover sigma outer product. Make clove…
maddyscientist Dec 8, 2023
f1f6d2b
Improve robustness of some host verification code utils
maddyscientist Dec 8, 2023
410d081
Significant cleanup of clover force test code. ctest now checks both…
maddyscientist Dec 8, 2023
51b2e81
Fix some warnings and add more override statements
maddyscientist Dec 8, 2023
db3cdf7
Profile comms part of clover outer product
maddyscientist Dec 8, 2023
f111dfe
Fix for narrowing conversion
maddyscientist Dec 8, 2023
ddd0fa9
Add missing override
maddyscientist Dec 8, 2023
ad814bb
Only download host mom field if we need to for clover force. Cleanup…
maddyscientist Dec 8, 2023
6f8349a
Rename clover force test code for consistency with other tests
maddyscientist Dec 9, 2023
4954aff
In test code: move common gamma matrix definition to gamma_reference.h
maddyscientist Dec 12, 2023
014913e
Some review fixes
maddyscientist Dec 12, 2023
7c4a177
Remove stray semicolon
maddyscientist Dec 12, 2023
45eaa3d
Change --detratio to --determinant-ratio
maddyscientist Dec 12, 2023
6cefd1c
clover::is_enabled() to is_enabled_clover()
maddyscientist Dec 13, 2023
1aa953e
Create clover_force function to remove some redundancy between clover…
maddyscientist Dec 13, 2023
39ef8b7
Add missing file
maddyscientist Dec 13, 2023
461f1b6
Enforce that the solution type for the clover force is MatPCDagMatPC
maddyscientist Dec 14, 2023
c0fdc7b
Some cleanup of the clover force reference computation (some changes …
maddyscientist Dec 14, 2023
6d16183
Fix function name for consistency with the rest of the library
maddyscientist Dec 14, 2023
b752a97
Some tweaks to improve applicability of GaugeField::createExtendedGauge
maddyscientist Dec 15, 2023
7bd79ed
Clean up of extended field handling used in clover force reference code
maddyscientist Dec 15, 2023
19ce4dd
remove tmp spinor
Marcogarofalo Dec 15, 2023
f044f97
Add ColorSpinorField::operator[] method for accessing parity subsets
maddyscientist Dec 18, 2023
3af895c
Fix for vector_ref
maddyscientist Dec 18, 2023
0b99a1d
Move all of the clover force computation to clover_force.cpp: differe…
maddyscientist Dec 18, 2023
f0356b9
Fix compile warning in last commit
maddyscientist Dec 18, 2023
85f3b8e
Add non const reference variant to vector_ref::make_set
maddyscientist Dec 19, 2023
dbec66b
Minor cleanup of solver.cpp
maddyscientist Dec 20, 2023
dcf1198
Apply clang-format
maddyscientist Dec 20, 2023
e07532e
fix comments
Marcogarofalo Dec 20, 2023
2b46f7f
Merge branch 'develop' of github.com:lattice/quda into feature/tm_force
maddyscientist Dec 20, 2023
c614356
Merge branch 'feature/tm_force' of github.com:lattice/quda into featu…
maddyscientist Dec 20, 2023
e545e36
Fix warning
maddyscientist Dec 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions include/clover_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ namespace quda {
namespace clover
{

/**
@brief Helper function that returns whether we have enabled
clover fermions.
*/
constexpr bool is_enabled()
maddyscientist marked this conversation as resolved.
Show resolved Hide resolved
{
#ifdef GPU_CLOVER_DIRAC
return true;
#else
return false;
#endif
}

/**
@brief Helper function that returns whether we have enabled
dynamic clover inversion or not.
Expand Down Expand Up @@ -481,8 +494,8 @@ namespace quda {
@param coeff Multiplicative coefficient (e.g., dt * residue)
*/
void computeCloverForce(GaugeField& force, const GaugeField& U,
std::vector<ColorSpinorField*> &x, std::vector<ColorSpinorField*> &p,
std::vector<double> &coeff);
cvector_ref<const ColorSpinorField> &x, cvector_ref<const ColorSpinorField> &p,
const std::vector<double> &coeff);
/**
@brief Compute the outer product from the solver solution fields
arising from the diagonal term of the fermion bilinear in
Expand All @@ -494,18 +507,19 @@ namespace quda {
@coeff coeff[in] Multiplicative coefficient (e.g., dt * residiue), one for each parity
*/
void computeCloverSigmaOprod(GaugeField& oprod,
std::vector<ColorSpinorField*> &x,
std::vector<ColorSpinorField*> &p,
std::vector< std::vector<double> > &coeff);
cvector_ref<const ColorSpinorField> &x,
cvector_ref<const ColorSpinorField> &p,
const std::vector< array<double, 2> > &coeff);
/**
@brief Compute the matrix tensor field necessary for the force calculation from
the clover trace action. This computes a tensor field [mu,nu].

@param output The computed matrix field (tensor matrix field)
@param clover The input clover field
@param coeff Scalar coefficient multiplying the result (e.g., stepsize)
@param parity The field parity we are working on
*/
void computeCloverSigmaTrace(GaugeField &output, const CloverField &clover, double coeff);
void computeCloverSigmaTrace(GaugeField &output, const CloverField &clover, double coeff, int parity);

/**
@brief Compute the derivative of the clover matrix in the direction
Expand All @@ -516,9 +530,8 @@ namespace quda {
@param gauge The input gauge field
@param oprod The input outer-product field (tensor matrix field)
@param coeff Multiplicative coefficient (e.g., clover coefficient)
@param parity The field parity we are working on
*/
void cloverDerivative(GaugeField &force, GaugeField &gauge, GaugeField &oprod, double coeff, QudaParity parity);
void cloverDerivative(GaugeField &force, GaugeField &gauge, GaugeField &oprod, double coeff);

/**
@brief This function is used for copying from a source clover field to a destination clover field
Expand Down
26 changes: 13 additions & 13 deletions include/color_spinor_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ namespace quda
size_t norm_offset = 0; /** offset to the norm (if applicable) */

// multi-GPU parameters
array_2d<void *, 2, QUDA_MAX_DIM> ghost = {}; // pointers to the ghost regions - NULL by default
mutable array_2d<void *, 2, QUDA_MAX_DIM> ghost = {}; // pointers to the ghost regions - NULL by default
mutable lat_dim_t ghostFace = {}; // the size of each face
mutable lat_dim_t ghostFaceCB = {}; // the size of each checkboarded face
mutable array<void *, 2 *QUDA_MAX_DIM> ghost_buf = {}; // wrapper that points to current ghost zone
Expand Down Expand Up @@ -510,7 +510,7 @@ namespace quda
@param[in] nFace Depth of each halo
@param[in] spin_project Whether the halos are spin projected (Wilson-type fermions only)
*/
void createComms(int nFace, bool spin_project = true);
void createComms(int nFace, bool spin_project = true) const;

/**
@brief Packs the ColorSpinorField's ghost zone
Expand All @@ -530,7 +530,7 @@ namespace quda
*/
void packGhost(const int nFace, const QudaParity parity, const int dagger, const qudaStream_t &stream,
MemoryLocation location[2 * QUDA_MAX_DIM], MemoryLocation location_label, bool spin_project,
double a = 0, double b = 0, double c = 0, int shmem = 0);
double a = 0, double b = 0, double c = 0, int shmem = 0) const;

/**
Pack the field halos in preparation for halo exchange, e.g., for Dslash
Expand All @@ -550,7 +550,7 @@ namespace quda
*/
void pack(int nFace, int parity, int dagger, const qudaStream_t &stream, MemoryLocation location[2 * QUDA_MAX_DIM],
MemoryLocation location_label, bool spin_project = true, double a = 0, double b = 0, double c = 0,
int shmem = 0);
int shmem = 0) const;

/**
@brief Initiate the gpu to cpu send of the ghost zone (halo)
Expand All @@ -559,7 +559,7 @@ namespace quda
@param dir The direction (QUDA_BACKWARDS or QUDA_FORWARDS)
@param stream The array of streams to use
*/
void sendGhost(void *ghost_spinor, const int dim, const QudaDirection dir, const qudaStream_t &stream);
void sendGhost(void *ghost_spinor, const int dim, const QudaDirection dir, const qudaStream_t &stream) const;

/**
Initiate the cpu to gpu send of the ghost zone (halo)
Expand All @@ -568,7 +568,7 @@ namespace quda
@param dir The direction (QUDA_BACKWARDS or QUDA_FORWARDS)
@param stream The array of streams to use
*/
void unpackGhost(const void *ghost_spinor, const int dim, const QudaDirection dir, const qudaStream_t &stream);
void unpackGhost(const void *ghost_spinor, const int dim, const QudaDirection dir, const qudaStream_t &stream) const;

/**
@brief Copies the ghost to the host from the device, prior to
Expand All @@ -577,15 +577,15 @@ namespace quda
the scatter-centric direction (0=backwards,1=forwards)
@param[in] stream The stream in which to do the copy
*/
void gather(int dir, const qudaStream_t &stream);
void gather(int dir, const qudaStream_t &stream) const;

/**
@brief Initiate halo communication receive
@param[in] d d=[2*dim+dir], where dim is dimension and dir is
the scatter-centric direction (0=backwards,1=forwards)
@param[in] gdr Whether we are using GDR on the receive side
*/
void recvStart(int dir, const qudaStream_t &stream, bool gdr = false);
void recvStart(int dir, const qudaStream_t &stream, bool gdr = false) const;

/**
@brief Initiate halo communication sending
Expand All @@ -596,7 +596,7 @@ namespace quda
@param[in] gdr Whether we are using GDR on the send side
@param[in] remote_write Whether we are writing direct to remote memory (or using copy engines)
*/
void sendStart(int d, const qudaStream_t &stream, bool gdr = false, bool remote_write = false);
void sendStart(int d, const qudaStream_t &stream, bool gdr = false, bool remote_write = false) const;

/**
@brief Initiate halo communication
Expand All @@ -606,7 +606,7 @@ namespace quda
@param[in] gdr_send Whether we are using GDR on the send side
@param[in] gdr_recv Whether we are using GDR on the receive side
*/
void commsStart(int d, const qudaStream_t &stream, bool gdr_send = false, bool gdr_recv = false);
void commsStart(int d, const qudaStream_t &stream, bool gdr_send = false, bool gdr_recv = false) const;

/**
@brief Non-blocking query if the halo communication has completed
Expand All @@ -616,7 +616,7 @@ namespace quda
@param[in] gdr_send Whether we are using GDR on the send side
@param[in] gdr_recv Whether we are using GDR on the receive side
*/
int commsQuery(int d, const qudaStream_t &stream, bool gdr_send = false, bool gdr_recv = false);
int commsQuery(int d, const qudaStream_t &stream, bool gdr_send = false, bool gdr_recv = false) const;

/**
@brief Wait on halo communication to complete
Expand All @@ -626,7 +626,7 @@ namespace quda
@param[in] gdr_send Whether we are using GDR on the send side
@param[in] gdr_recv Whether we are using GDR on the receive side
*/
void commsWait(int d, const qudaStream_t &stream, bool gdr_send = false, bool gdr_recv = false);
void commsWait(int d, const qudaStream_t &stream, bool gdr_send = false, bool gdr_recv = false) const;

/**
@brief Unpacks the ghost from host to device after
Expand All @@ -636,7 +636,7 @@ namespace quda
@param[in] stream The stream in which to do the copy. If
-1 is passed then the copy will be issied to the d^th stream
*/
void scatter(int d, const qudaStream_t &stream);
void scatter(int d, const qudaStream_t &stream) const;

/**
Do the exchange between neighbouring nodes of the data in
Expand Down
Loading