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

Feature/openqxd #1414

Open
wants to merge 160 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
ed966db
initial structure (completely untested and still a lot of things WIP)
mathiaswagner Sep 26, 2022
71c1897
compilation fixes and plaquette dummy
mathiaswagner Sep 27, 2022
efc24b8
Updated rank formula
fernandezdlg Sep 27, 2022
61b8a02
Typo corrected
fernandezdlg Sep 27, 2022
a40b032
Typo corrected
fernandezdlg Sep 27, 2022
0a69472
fix rankFromCoords to consider BLK order
nyholme Sep 28, 2022
c29aa66
some fixes for openQCD testing
mathiaswagner Sep 28, 2022
d3d4022
Still not working,
fernandezdlg Jan 27, 2023
9e1b7ad
Now working, todo: add ipt directly in quda
fernandezdlg Jan 30, 2023
aec93e3
TODO: comments & planning
fernandezdlg Feb 3, 2023
1f0e573
hardwire quda rankfromcoords
fernandezdlg Feb 20, 2023
6271fac
hardwire test 2
fernandezdlg Feb 25, 2023
ef1e5af
Merge branch 'feature/openqxd' of github.com:fernandezdlg/quda into f…
fernandezdlg Feb 25, 2023
8550ed0
ignore build folder
fernandezdlg Mar 3, 2023
c9d0f6c
rankFromCoords for OpenQxD gauge fields working.
fernandezdlg Mar 8, 2023
301378b
OpenQCD spinor interface from TIFR (need adjusting
fernandezdlg Mar 14, 2023
240d614
commented out openqcd spinors sections for compile
fernandezdlg Mar 20, 2023
6202ac4
spinors feature OK (still needs correct indexing)
fernandezdlg Mar 20, 2023
cf3a04a
openqcd dslash correction + load color spinor
fernandezdlg Mar 21, 2023
16b7df0
load-save in spinors+gauge + format
fernandezdlg Mar 22, 2023
12f22f4
small correction on load fct
fernandezdlg Mar 23, 2023
d535512
ordering done, lexicographical io w openqxd
fernandezdlg Mar 23, 2023
f538e53
added openqcd dirac order
fernandezdlg Mar 23, 2023
568d1cd
dslash quda := NO dslash operator applied
fernandezdlg Mar 23, 2023
dc8c99f
strange bad indexing behaviour (check3 log)
fernandezdlg Mar 23, 2023
ecc2177
small corrections + comments
fernandezdlg Mar 24, 2023
8b1830d
cleanup and test oddeven
fernandezdlg Mar 24, 2023
f738510
latest test
fernandezdlg Mar 24, 2023
ad8f689
formatting
fernandezdlg Mar 25, 2023
189896e
corrected over-include enum + cmmnts
fernandezdlg Mar 26, 2023
37e6023
return to previous formatting
fernandezdlg Mar 26, 2023
b0076de
small corrs + formatting
fernandezdlg Mar 26, 2023
2525a5b
gauge save load
fernandezdlg Mar 26, 2023
9dce279
quda openqcd gauge loadsave, load, and save
fernandezdlg Mar 26, 2023
4ff5cce
removed comments
fernandezdlg Mar 27, 2023
b2d7446
rearrangement
fernandezdlg Mar 27, 2023
fdf641c
plaquette only function
fernandezdlg Mar 27, 2023
ca66195
small correction
fernandezdlg Mar 27, 2023
bc95079
gauge working, color using spacespinorcolor totest
fernandezdlg Apr 2, 2023
e1bed36
final
fernandezdlg Apr 13, 2023
5e60bc5
stated to clean up mess a little
Aug 14, 2023
402cab6
cleaned up
Aug 15, 2023
ed234bd
refactored plaquette
Aug 21, 2023
bfe766f
Only have generic lexicographical ordering in OpenQCDOrder
Aug 23, 2023
b837622
norms on both sides coincide
Aug 24, 2023
23b1e0b
all reordering of spinor fields done in quda now
Aug 25, 2023
b577392
added functions gamma{0,2,3}() that don't work
Aug 25, 2023
26918e6
Add QUDA_OPENQCD_GAMMA_BASIS
Aug 31, 2023
d3fdc43
fixed openQCD_qudaGamma
Sep 11, 2023
fe01653
removed implicit fallthrough in switch case of gammai()
Sep 11, 2023
34d388d
global minus for openqcd gamma matrix transformation
Sep 11, 2023
b6157c5
dirac operator seems to work now
Sep 12, 2023
fdd1b62
clover term works
Sep 13, 2023
be90f9d
GCR inverter works
Sep 14, 2023
736d2cd
cleaned up a little
Sep 14, 2023
3f131b0
Add fvtx for profiler
donion74 Sep 19, 2023
92a8b50
Optimize malloc
donion74 Sep 19, 2023
088678e
Add parameters for multigrid (incomplete)
Sep 20, 2023
271f828
Undo minus sign in back transformation
Sep 21, 2023
00136bf
Add global minus in Dirac
donion74 Sep 21, 2023
076cf0e
Add back and forth test
donion74 Sep 21, 2023
d9c4fff
Remove *= -1
donion74 Sep 21, 2023
a37c286
Revert "Undo minus sign in back transformation"
Sep 21, 2023
7c89362
Fix back_and_forth test
donion74 Sep 21, 2023
5c21522
Merge branch 'feature/openqxd-thesis-release' of https://github.com/c…
Sep 21, 2023
30ae3bd
Fix mistake in transformation and remove Romans' minus sign in transf…
donion74 Sep 21, 2023
7985910
Fix mistake in Udagger
donion74 Sep 21, 2023
5f57224
Modify gamma5
Sep 21, 2023
fd9975e
Changes for MG support.
timrupertharris Sep 22, 2023
78465cf
Merge branch 'feature/openqxd-thesis-release' of https://github.com/c…
timrupertharris Sep 22, 2023
9f52f30
Add debugging information
Sep 22, 2023
61e4985
Polish code
donion74 Sep 25, 2023
ef78041
Change back and forth test
donion74 Sep 25, 2023
18518f5
Merge branch 'multgrid-solver' into feature/openqxd-thesis-release
donion74 Sep 25, 2023
29da468
Modify back and forth test
donion74 Sep 25, 2023
8ababe5
Modify printfQuda
donion74 Sep 25, 2023
53d9a8c
Merge branch 'multgrid-solver' into feature/openqxd-thesis-release
donion74 Sep 25, 2023
4a9ba76
Return true_res and disable half precision in multigrid
donion74 Sep 25, 2023
1cac7c0
Remove qudaInvert
donion74 Sep 25, 2023
96bb7ab
Merge branch 'feature/openqxd-thesis-release' of https://github.com/c…
Sep 25, 2023
ed254d5
Add comment about Precision for multigrid
donion74 Sep 25, 2023
febf4fb
Moved init of cuda_prec_sloppy into openQCD_qudaMultigrid.
timrupertharris Sep 26, 2023
83ce801
added clover field load function to load cloer field from openQCD
Sep 27, 2023
0c9bcf0
we need csw and coeff to determine kappa in clover_field_order.h Open…
Sep 27, 2023
2a91f8b
Merge remote-tracking branch 'refs/remotes/origin/feature/openqxd-the…
Sep 27, 2023
3a0012c
first attempt for no loads
Sep 29, 2023
d929534
Merge branch 'feature/openqxd-thesis-release' of https://github.com/c…
Oct 4, 2023
14baf0f
Debug cstar error
donion74 Sep 22, 2023
1f7fb9a
Debug cstar error
donion74 Sep 22, 2023
ac3d0d0
Use layout.cstar for setting cstar
donion74 Sep 25, 2023
e7eaaa9
Fix }
donion74 Sep 25, 2023
abdcbcc
Use global_ipr for ranksFromCoords
Oct 4, 2023
732d760
Print debug
Sep 29, 2023
25ed056
Remove debug info
Oct 4, 2023
b69b67a
Fix bracket, clean up
Oct 4, 2023
748693a
Comment debugging
Oct 4, 2023
f663ec2
Remove comment
Oct 4, 2023
129c578
Restore info about communicator
Oct 6, 2023
512e3e9
Rename variables
Oct 6, 2023
4d9b28a
Remove debug statements
Oct 6, 2023
236f869
added relevant parameters to Dirac struct
Oct 6, 2023
cdd360e
Use BUILD_INTERFACE_OPENQCD to set cstar
Oct 9, 2023
025b0e3
Merge branch 'feature/openqxd-thesis-release' of https://github.com/c…
Oct 9, 2023
dd0e4a5
Remove abs(dims)
Oct 9, 2023
86134fb
towards a general solver interface
Oct 17, 2023
3ad9b06
works with QCD+QED (clover term is transfered always)
Oct 18, 2023
36251b5
finally transfer clover only when needed (ie QCD+QED)
Oct 18, 2023
a0d8622
added remaining settings
Oct 19, 2023
ec3e911
solved a bug that prevented reordering on CPU to work
Nov 1, 2023
86ff1d5
in case of openQCD gauge fields, allocate and transfer 4*VOLUME +
Nov 1, 2023
b8bc138
reordering of gauge field done purely within QUDA (only load, not store)
Nov 1, 2023
1ce6b19
changed gauge loading and added eigensolver interface (not working yet)
Nov 1, 2023
9e81a4c
solved the mystical local lattice direction = 6 bug
Nov 1, 2023
9778011
changed comments to C89 style (such that we can link C89 programs
Nov 2, 2023
8f4c7dc
setup verbosity
Nov 3, 2023
608dec2
Merge pull request #1 from lattice/develop
chaoos Nov 6, 2023
1c85393
fixed eigensolverDestroy
Nov 6, 2023
3af70d1
Merge remote-tracking branch 'origin/develop' into feature/openqxd
Nov 6, 2023
0842ed0
cleaned up tabs/spaces, comment, unnecessary additions
Nov 6, 2023
ef57751
fixed gitignore
Nov 6, 2023
0020993
removed comment
Nov 6, 2023
e622ce8
cleaned up openqcd interface
Nov 6, 2023
7085cc5
outsourced all openqcd index functions
Nov 6, 2023
ad6787a
fixed reordering on GPU
Nov 6, 2023
df1bd16
macro war to enable "-std=c89 -pedantic -Werror" in openqxds checks
Nov 7, 2023
93c3f6a
added comment for loadGaugeQuda
Nov 8, 2023
8301dbf
added MatQuda profiling
Nov 8, 2023
200295d
removed check functions and unnecessary including
Nov 14, 2023
59578cc
added requested comments
Nov 14, 2023
bab885c
check for nullptr in comm_create_topology
Dec 5, 2023
dd29926
ipt and iup function exposed, parsing infile section "QUDA"
Dec 5, 2023
43a1b4f
the Wilson and Wilson-clover Dirac operator are gamma5 Hermtitian
Dec 6, 2023
23fefb1
added functionality to compute both (left and right) singular vectors…
Dec 6, 2023
848e6d9
added comments for eigensolver interface
Dec 6, 2023
02b8481
some convenience mappings for the enums
Dec 8, 2023
ae170fe
in TRLM: n_kr must be >= n_conv+12, else iter_keep may become negatice
Dec 8, 2023
d56921e
verbose error message if section is not a quda section
Dec 12, 2023
886c90f
more verbose error msg when solver section is not a QUDA one
Dec 15, 2023
e6ce728
added function comm_dim_cstar to query if a dimension is C*
Dec 15, 2023
ba9ace1
solved P2P communication bug when C* boundaries are active
Dec 15, 2023
1b1a55c
added packed formats
Feb 5, 2024
c2c8ef6
Merge branch 'feature/openqxd' of https://github.com/chaoos/quda into…
Feb 5, 2024
dd92262
dynamic t_boundary
Feb 7, 2024
20e59ba
enable RECONSTRUCT_8/9/12/13/NO for openqxd interface
Feb 7, 2024
d40d6e5
fixed eigensolver, when cuda_prec_eigensolver is not set in the infile
Feb 13, 2024
6c7bb9d
only transfer/recalc gauge/clover field according to openqxd's flag DB
Feb 14, 2024
005aed9
added void pointer to QudaInvertParam struct for arbitrary additinal
Feb 19, 2024
ad1ab82
changed solver interface to only deal with solver section IDs
Feb 19, 2024
c1fec52
refactored interface
Feb 21, 2024
d356fa0
removed ptr in getHandle
Feb 22, 2024
a80dd55
removed ptr in getHandle (2)
Feb 23, 2024
466d702
fixed clang complaining "error: suggest braces around initialization of
Feb 23, 2024
c79cb4a
in openQCD sometimes we test with gauge field all set to unity, then the
Feb 23, 2024
6edc863
remove trailing whitespaces
Feb 23, 2024
568dd37
applied clang-format as described in https://github.com/lattice/quda/…
Feb 23, 2024
3150761
eigensolver iterface rewritten to use identifiers too (as inverter
Feb 28, 2024
0752a23
fixed compiler error in CI/CD
Feb 28, 2024
ca54f7e
clang-format
Feb 28, 2024
9d9ace7
fixed eigensolver deallocation
Mar 12, 2024
f63a507
added openQCD_qudaDw_NoLoads (wrapper around Dirac operator that does
Jul 3, 2024
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ option(QUDA_OPENBLAS "enable OpenBLAS" OFF)
# Interface options
option(QUDA_INTERFACE_QDP "build qdp interface" ON)
option(QUDA_INTERFACE_MILC "build milc interface" ON)
option(QUDA_INTERFACE_OPENQCD "build OpenQCD interface" OFF)
option(QUDA_INTERFACE_CPS "build cps interface" OFF)
option(QUDA_INTERFACE_QDPJIT "build qdpjit interface" OFF)
option(QUDA_INTERFACE_BQCD "build bqcd interface" OFF)
Expand Down
2 changes: 2 additions & 0 deletions include/clover_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ namespace quda {
inverse(param.inverse),
clover(param.clover),
cloverInv(param.cloverInv),
csw(param.csw),
coeff(param.coeff),
maddyscientist marked this conversation as resolved.
Show resolved Hide resolved
twist_flavor(param.twist_flavor),
mu2(param.mu2),
epsilon2(param.epsilon2),
Expand Down
96 changes: 96 additions & 0 deletions include/clover_field_order.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <convert.h>
#include <clover_field.h>
#include <complex_quda.h>
#include <index_helper.cuh>
maddyscientist marked this conversation as resolved.
Show resolved Hide resolved
#include <quda_matrix.h>
#include <color_spinor.h>
#include <load_store.h>
Expand Down Expand Up @@ -637,7 +638,11 @@ namespace quda {
errorQuda("Accessor reconstruct = %d does not match field reconstruct %d", enable_reconstruct,
clover.Reconstruct());
if (clover.max_element(is_inverse) == 0.0 && isFixed<Float>::value)
#ifdef BUILD_OPENQCD_INTERFACE
warningQuda("%p max_element(%d) appears unset", &clover, is_inverse); /* ignore if the SW-field is zero */
#else
errorQuda("%p max_element(%d) appears unset", &clover, is_inverse);
#endif
if (clover.Diagonal() == 0.0 && clover.Reconstruct()) errorQuda("%p diagonal appears unset", &clover);
this->clover = clover_ ? clover_ : clover.data<Float *>(is_inverse);
}
Expand Down Expand Up @@ -1015,6 +1020,97 @@ namespace quda {
size_t Bytes() const { return length*sizeof(Float); }
};

/**
* OpenQCD ordering for clover fields
*/
template <typename Float, int length = 72> struct OpenQCDOrder {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, whether QUDA has sufficient capability to create the clover term for OpenQ*D's use case or whether you have specific requirements that we are lacking? E.g., exponential clover or anisotropy?

static constexpr bool enable_reconstruct = false;
typedef typename mapper<Float>::type RegType;
Float *clover;
const int volumeCB;
const QudaTwistFlavorType twist_flavor;
const Float mu2;
const Float epsilon2;
const double coeff;
const double csw;
const double kappa;
const int dim[4]; // xyzt convention
const int L[4]; // txyz convention

OpenQCDOrder(const CloverField &clover, bool inverse, Float *clover_ = nullptr, void * = nullptr) :
volumeCB(clover.Stride()),
twist_flavor(clover.TwistFlavor()),
mu2(clover.Mu2()),
epsilon2(clover.Epsilon2()),
coeff(clover.Coeff()),
csw(clover.Csw()),
kappa(clover.Coeff() / clover.Csw()),
dim {clover.X()[0], clover.X()[1], clover.X()[2], clover.X()[3]}, // *local* lattice dimensions, xyzt
L {clover.X()[3], clover.X()[0], clover.X()[1], clover.X()[2]} // *local* lattice dimensions, txyz
{
if (clover.Order() != QUDA_OPENQCD_CLOVER_ORDER) {
errorQuda("Invalid clover order %d for this accessor", clover.Order());
}
this->clover = clover_ ? clover_ : clover.data<Float *>(inverse);
if (clover.Coeff() == 0.0 || clover.Csw() == 0.0) { errorQuda("Neither coeff nor csw may be zero!"); }
}

QudaTwistFlavorType TwistFlavor() const { return twist_flavor; }
Float Mu2() const { return mu2; }
Float Epsilon2() const { return epsilon2; }

/**
* @brief Gets the offset in Floats from the openQCD base pointer to
* the spinor field.
*
* @param[in] x_cb Checkerboard index coming from quda
* @param[in] parity The parity coming from quda
*
* @return The offset.
*/
__device__ __host__ inline int getCloverOffset(int x_cb, int parity) const
{
int x_quda[4], x[4];
getCoords(x_quda, x_cb, dim, parity); // x_quda contains xyzt local Carthesian corrdinates
openqcd::rotate_coords(x_quda, x); // xyzt -> txyz, x = openQCD local Carthesian lattice coordinate
return openqcd::ipt(x, L) * length;
}

/**
* @brief Load a clover field at lattice point x_cb
*
* @param v The output clover matrix in QUDA order
* @param x_cb The checkerboarded lattice site
* @param parity The parity of the lattice site
*/
__device__ __host__ inline void load(RegType v[length], int x_cb, int parity) const
{
int sign[36] = {-1, -1, -1, -1, -1, -1, // diagonals (idx 0-5)
-1, +1, -1, +1, -1, -1, -1, -1, -1, -1, // column 0 (idx 6-15)
-1, +1, -1, -1, -1, -1, -1, -1, // column 1 (idx 16-23)
-1, -1, -1, -1, -1, -1, // column 2 (idx 24-29)
-1, +1, -1, +1, // column 3 (idx 30-33)
-1, +1}; // column 4 (idx 34-35)
int map[36] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 18, 19, 24, 25, 16, 17,
12, 13, 20, 21, 26, 27, 14, 15, 22, 23, 28, 29, 30, 31, 32, 33, 34, 35};
const int M = length / 2;
int offset = getCloverOffset(x_cb, parity);
auto Ap = &clover[offset]; // A_+
auto Am = &clover[offset + M]; // A_-

#pragma unroll
for (int i = 0; i < M; i++) {
v[i] = sign[i] * (kappa * Am[map[i]] - (i < 6));
v[M + i] = sign[i] * (kappa * Ap[map[i]] - (i < 6));
}
}

// FIXME implement the save routine for OpenQCD ordered fields
__device__ __host__ inline void save(RegType[length], int, int) const { }

size_t Bytes() const { return length * sizeof(Float); }
};

} // namespace clover

// Use traits to reduce the template explosion
Expand Down
3 changes: 3 additions & 0 deletions include/color_spinor_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ namespace quda
} else if (inv_param.dirac_order == QUDA_TIFR_PADDED_DIRAC_ORDER) {
fieldOrder = QUDA_PADDED_SPACE_SPIN_COLOR_FIELD_ORDER;
siteOrder = QUDA_EVEN_ODD_SITE_ORDER;
} else if (inv_param.dirac_order == QUDA_OPENQCD_DIRAC_ORDER) {
fieldOrder = QUDA_OPENQCD_FIELD_ORDER;
siteOrder = QUDA_EVEN_ODD_SITE_ORDER;
} else {
errorQuda("Dirac order %d not supported", inv_param.dirac_order);
}
Expand Down
79 changes: 79 additions & 0 deletions include/color_spinor_field_order.h
Original file line number Diff line number Diff line change
Expand Up @@ -1811,6 +1811,85 @@ namespace quda
size_t Bytes() const { return nParity * volumeCB * Nc * Ns * 2 * sizeof(Float); }
};

/**
* struct to define order of spinor fields in OpenQCD
*
* @tparam Float Underlying type of data (precision)
* @tparam Ns Number of spin degrees of freedom
* @tparam Nc Number of color degrees of freedom
*/
template <typename Float, int Ns, int Nc> struct OpenQCDDiracOrder {
using Accessor = OpenQCDDiracOrder<Float, Ns, Nc>;
using real = typename mapper<Float>::type;
using complex = complex<real>;

static const int length = 2 * Ns * Nc; // 12 complex (2 floats) numbers per spinor color field
Float *field;
size_t offset;
Float *ghost[8];
int volumeCB;
int faceVolumeCB[4];
int nParity;
const int dim[4]; // xyzt convention
const int L[4]; // txyz convention

OpenQCDDiracOrder(const ColorSpinorField &a, int = 1, Float *field_ = 0, float * = 0) :
field(field_ ? field_ : a.data<Float *>()),
offset(a.Bytes() / (2 * sizeof(Float))), // TODO: What's this for??
volumeCB(a.VolumeCB()),
nParity(a.SiteSubset()),
dim {a.X(0), a.X(1), a.X(2), a.X(3)}, // *local* lattice dimensions, xyzt
L {a.X(3), a.X(0), a.X(1), a.X(2)} // *local* lattice dimensions, txyz
{
if constexpr (length != 24) { errorQuda("Spinor field length %d not supported", length); }
}

/**
* @brief Gets the offset in Floats from the openQCD base pointer to
* the spinor field.
*
* @param[in] x Checkerboard index coming from quda
* @param[in] parity The parity coming from quda
*
* @return The offset.
*/
__device__ __host__ inline int getSpinorOffset(int x_cb, int parity) const
{
int x_quda[4], x[4];
getCoords(x_quda, x_cb, dim, parity); // x_quda contains xyzt local Carthesian corrdinates
openqcd::rotate_coords(x_quda, x); // xyzt -> txyz, x = openQCD local Carthesian lattice coordinate
return openqcd::ipt(x, L) * length;
}

__device__ __host__ inline void load(complex v[length / 2], int x_cb, int parity = 0) const
{
auto in = &field[getSpinorOffset(x_cb, parity)];
block_load<complex, length / 2>(v, reinterpret_cast<const complex *>(in));
}

__device__ __host__ inline void save(const complex v[length / 2], int x_cb, int parity = 0) const
{
auto out = &field[getSpinorOffset(x_cb, parity)];
block_store<complex, length / 2>(reinterpret_cast<complex *>(out), v);
}

/**
@brief This accessor routine returns a colorspinor_wrapper to this object,
allowing us to overload various operators for manipulating at
the site level interms of matrix operations.
@param[in] x_cb Checkerboarded space-time index we are requesting
@param[in] parity Parity we are requesting
@return Instance of a colorspinor_wrapper that curries in access to
this field at the above coordinates.
*/
__device__ __host__ inline auto operator()(int x_cb, int parity) const
{
return colorspinor_wrapper<real, Accessor>(*this, x_cb, parity);
}

size_t Bytes() const { return nParity * volumeCB * Nc * Ns * 2 * sizeof(Float); }
}; // openQCDDiracOrder

} // namespace colorspinor

// Use traits to reduce the template explosion
Expand Down
7 changes: 7 additions & 0 deletions include/comm_quda.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ namespace quda
*/
int comm_dim(int dim);

/**
Return whether the dimension dim is a C* dimension or not
@param dim Dimension which we are querying
@return C* dimension or nor
*/
bool comm_dim_cstar(int dim);

/**
Return the coording of this process in the dimension dim
@param dim Dimension which we are querying
Expand Down
30 changes: 27 additions & 3 deletions include/communicator_quda.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace quda
int (*coords)[QUDA_MAX_DIM];
int my_rank;
int my_coords[QUDA_MAX_DIM];
int cstar; // number of C* direction as per openQxD convention
Copy link
Author

@chaoos chaoos Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We extended the Topology struct with a cstar member to indicate how many spatial directions have C* boundaries. Maybe you want to have that as a option in the QudaInvertParam struct? However, we need this setting here, since it influences in the process grid topology.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgive my ignorance, but are the C* boundaries only relevant for fermions?

// It might be worth adding communicators to allow for efficient reductions:
// #if defined(MPI_COMMS)
// MPI_Comm comm;
Expand Down Expand Up @@ -126,9 +127,26 @@ namespace quda
inline int comm_rank_displaced(const Topology *topo, const int displacement[])
{
int coords[QUDA_MAX_DIM];

for (int i = 0; i < QUDA_MAX_DIM; i++) {
coords[i] = (i < topo->ndim) ? mod(comm_coords(topo)[i] + displacement[i], comm_dims(topo)[i]) : 0;
int shift_integer;

int Nx_displacement = 0;
for (int i = QUDA_MAX_DIM - 1; i >= 0; i--) {
// cstar shift[x] shift[y] shift[z] shift[t]
// 0 0 0 0 0
// 1 0 0 0 0
// 2 0 1 0 0
// 3 0 1 1 0
if (i < topo->ndim && ((i == 1 && topo->cstar >= 2) || (i == 2 && topo->cstar >= 3))) {
// if we go over the boundary and have a shifted boundary condition,
// we shift Nx/2 ranks in x-direction:
// shift_integer in { 0, 1, 2}
// (shift_integer - 1) in {-1, 0, 1}
shift_integer = (comm_coords(topo)[i] + displacement[i] + comm_dims(topo)[i]) / comm_dims(topo)[i];
Nx_displacement += (shift_integer - 1) * (comm_dims(topo)[0] / 2);
}
coords[i] = (i < topo->ndim) ?
mod(comm_coords(topo)[i] + displacement[i] + (i == 0 ? Nx_displacement : 0), comm_dims(topo)[i]) :
0;
}

return comm_rank_from_coords(topo, coords);
Expand Down Expand Up @@ -390,6 +408,12 @@ namespace quda
return comm_dims(topo)[dim];
}

bool comm_dim_cstar(int dim)
{
Topology *topo = comm_default_topology();
return (topo->cstar >= 2 && dim == 1) || (topo->cstar >= 3 && dim == 2);
}

int comm_coord(int dim)
{
Topology *topo = comm_default_topology();
Expand Down
2 changes: 2 additions & 0 deletions include/dirac_quda.h
Original file line number Diff line number Diff line change
Expand Up @@ -2606,6 +2606,8 @@ namespace quda {
&& (pc_type == QUDA_MATPC_EVEN_EVEN || pc_type == QUDA_MATPC_EVEN_EVEN_ASYMMETRIC))
return true;

if (dirac_type == QUDA_WILSON_DIRAC || dirac_type == QUDA_CLOVER_DIRAC) return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addition here looks bogus: the Wilson operator is not Hermitian. Is this addition intentional?

Copy link
Author

@chaoos chaoos Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in the class DiracG5M (i.e. gamma5 times the Dirac operator), which is Hermitian. I had to change this, since the eigensolver didn't accept a non-Hermitian operator else. So this should be correct (only for gamma5*D and D*gamma5 though).


return false;
}
};
Expand Down
6 changes: 6 additions & 0 deletions include/dslash_quda.h
Original file line number Diff line number Diff line change
Expand Up @@ -808,4 +808,10 @@ namespace quda
*/
void gamma5(ColorSpinorField &out, const ColorSpinorField &in);

/* RG: I have added these */
void gamma0(ColorSpinorField &out, const ColorSpinorField &in);
void gamma1(ColorSpinorField &out, const ColorSpinorField &in);
void gamma2(ColorSpinorField &out, const ColorSpinorField &in);
void gamma3(ColorSpinorField &out, const ColorSpinorField &in);

Comment on lines +811 to +816
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed gamma0 to gamma3 for tests in openQxD side. Let me know if there is an intended way to apply a gamma matrix other than gamm5 to a spinor field (I didn't find anything).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we've needed anything other in gamma5 in the past, so I never bothered to instantiate them. No problem adding them and this is the correct place to do so.

I do question the difference in notation here though, for C-style counting from zero for gamma_1..gamma_4 and Fortran-style / physics notation for gamma_5. Should we make these consistent?

} // namespace quda
7 changes: 4 additions & 3 deletions include/eigensolve_quda.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,11 @@ namespace quda

/**
@brief Computes Left/Right SVD from pre computed Right/Left
@param[in] evecs Computed eigenvectors of NormOp
@param[in] evals Computed eigenvalues of NormOp
@param[in,out] evecs Computed eigenvectors of NormOp
@param[in,out] evals Computed eigenvalues of NormOp
@param[in] dagger Whether NormOp was MdagM (false) or MMdag (true)
*/
void computeSVD(std::vector<ColorSpinorField> &evecs, std::vector<Complex> &evals);
void computeSVD(std::vector<ColorSpinorField> &evecs, std::vector<Complex> &evals, bool dagger = false);

/**
@brief Compute eigenvalues and their residiua
Expand Down
Loading