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

Mods to allow copy in/out of full QDP-JIT spinors #1504

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
8 changes: 4 additions & 4 deletions include/color_spinor_field_order.h
Original file line number Diff line number Diff line change
Expand Up @@ -1799,8 +1799,8 @@ namespace quda
{
for (int s = 0; s < Ns; s++) {
for (int c = 0; c < Nc; c++) {
v[s * Nc + c] = complex(field[(((0 * Nc + c) * Ns + s) * 2 + (1 - parity)) * volumeCB + x],
field[(((1 * Nc + c) * Ns + s) * 2 + (1 - parity)) * volumeCB + x]);
v[s * Nc + c] = complex(field[(((0 * Nc + c) * Ns + s) * 2 + parity) * volumeCB + x],
field[(((1 * Nc + c) * Ns + s) * 2 + parity) * volumeCB + x]);
}
}
}
Expand All @@ -1809,8 +1809,8 @@ namespace quda
{
for (int s = 0; s < Ns; s++) {
for (int c = 0; c < Nc; c++) {
field[(((0 * Nc + c) * Ns + s) * 2 + (1 - parity)) * volumeCB + x] = v[s * Nc + c].real();
field[(((1 * Nc + c) * Ns + s) * 2 + (1 - parity)) * volumeCB + x] = v[s * Nc + c].imag();
field[(((0 * Nc + c) * Ns + s) * 2 + parity) * volumeCB + x] = v[s * Nc + c].real();
field[(((1 * Nc + c) * Ns + s) * 2 + parity) * volumeCB + x] = v[s * Nc + c].imag();
}
}
}
Expand Down
19 changes: 17 additions & 2 deletions include/kernels/copy_color_spinor.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ namespace quda

using namespace colorspinor;

/** Helper function for parity computation */
bjoo marked this conversation as resolved.
Show resolved Hide resolved
inline int computeParity(const ColorSpinorField &f)
{

// Account for odd-even vs. even-odd site orders
int ret_val = f.SiteOrder() == QUDA_ODD_EVEN_SITE_ORDER ? 1 : 0;

// Account for potential parity flip to access single parity subset QDP-JIT fields
if (f.FieldOrder() == QUDA_QDPJIT_FIELD_ORDER && f.SiteSubset() == QUDA_PARITY_SITE_SUBSET) {
bjoo marked this conversation as resolved.
Show resolved Hide resolved
ret_val = 1 - ret_val;
}

return ret_val;
}

template <typename FloatOut, typename FloatIn, int nSpin_, int nColor_, typename Out, typename In,
template <int, int> class Basis_>
struct CopyColorSpinorArg : kernel_param<> {
Expand All @@ -32,8 +47,8 @@ namespace quda
kernel_param(dim3(in.VolumeCB(), in.SiteSubset(), 1)),
out(out, 1, Out_),
in(in, 1, const_cast<FloatIn *>(In_)),
outParity(out.SiteOrder() == QUDA_ODD_EVEN_SITE_ORDER ? 1 : 0),
inParity(in.SiteOrder() == QUDA_ODD_EVEN_SITE_ORDER ? 1 : 0)
outParity(computeParity(out)),
inParity(computeParity(in))
{
}
};
Expand Down
5 changes: 0 additions & 5 deletions lib/copy_color_spinor.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,6 @@ namespace quda
errorQuda("Copying to full fields with lexicographical ordering is not currently supported");
}

if (dst.SiteSubset() == QUDA_FULL_SITE_SUBSET
&& (src.FieldOrder() == QUDA_QDPJIT_FIELD_ORDER || dst.FieldOrder() == QUDA_QDPJIT_FIELD_ORDER)) {
errorQuda("QDPJIT field ordering not supported for full site fields");
}

genericCopyColorSpinor<Ns, Nc>(param);
}

Expand Down
Loading