Skip to content

Commit

Permalink
using container of fields, instead of pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstrel committed Dec 4, 2023
1 parent 92e6bf8 commit 227a56d
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions lib/make_4d_prop_quda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ namespace quda
void *VLs2 = in.data<char*>() + (Ls / 2) * vol4D * spin * col * data_size;

// Create wrappers around the (Ls/2)-1 and Ls/2 4D fields
std::vector<ColorSpinorField *> Ls2m1;
std::vector<ColorSpinorField> Ls2m1;
param4D.v = VLs2m1;
param4D.create = QUDA_REFERENCE_FIELD_CREATE;
Ls2m1.push_back(ColorSpinorField::Create(param4D));
Ls2m1.push_back(ColorSpinorField(param4D));

std::vector<ColorSpinorField *> Ls2;
std::vector<ColorSpinorField> Ls2;
param4D.v = VLs2;
param4D.create = QUDA_REFERENCE_FIELD_CREATE;
Ls2.push_back(ColorSpinorField::Create(param4D));
Ls2.push_back(ColorSpinorField(param4D));

// Ensure out is zeroed
qudaMemsetAsync(out.data(), 0, vol4D * spin * col * data_size, device::get_default_stream());

// out(x) = P_L L0(x) + P_R Lsm1(x)
ApplyChiralProj(out, *Ls2m1[0], 1);
ApplyChiralProj(out, *Ls2[0], -1);
ApplyChiralProj(out, Ls2m1[0], 1);
ApplyChiralProj(out, Ls2[0], -1);
}

void make4DChiralProp(ColorSpinorField &out, ColorSpinorField &in)
Expand All @@ -65,24 +65,21 @@ namespace quda
void *VLsm1 = in.data<char*>() + (Ls - 1) * vol4D * spin * col * data_size;

// Create wrappers around the 0 and Ls-1 4D fields
std::vector<ColorSpinorField *> L0;
std::vector<ColorSpinorField> L0;
param4D.v = V0;
param4D.create = QUDA_REFERENCE_FIELD_CREATE;
L0.push_back(ColorSpinorField::Create(param4D));
L0.push_back(ColorSpinorField(param4D));

std::vector<ColorSpinorField *> Lsm1;
std::vector<ColorSpinorField> Lsm1;
param4D.v = VLsm1;
param4D.create = QUDA_REFERENCE_FIELD_CREATE;
Lsm1.push_back(ColorSpinorField::Create(param4D));
Lsm1.push_back(ColorSpinorField(param4D));

// Ensure out is zeroed
qudaMemsetAsync(out.data(), 0, vol4D * spin * col * data_size, device::get_default_stream());

// out(x) = P_L L0(x) + P_R Lsm1(x)
ApplyChiralProj(out, *L0[0], -1);
ApplyChiralProj(out, *Lsm1[0], 1);

delete Lsm1[0];
delete L0[0];
ApplyChiralProj(out, L0[0], -1);
ApplyChiralProj(out, Lsm1[0], 1);
}
} // namespace quda

0 comments on commit 227a56d

Please sign in to comment.