Skip to content

Commit

Permalink
Fix the cudaErrorIllegalAddress error in computeCloverForce.
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyChiang committed Nov 22, 2022
1 parent b9764df commit 8e15042
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
17 changes: 7 additions & 10 deletions lib/clover_outer_product.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <enum_quda.h>
#include <dslash_quda.h>
#include <tunable_nd.h>
#include <instantiate.h>
Expand Down Expand Up @@ -46,10 +47,10 @@ namespace quda {
if (!commDimPartitioned(i)) continue;
strcpy(aux, aux2);
strcat(aux, ",exterior");
if (dir==0) strcat(aux, ",dir=0");
else if (dir==1) strcat(aux, ",dir=1");
else if (dir==2) strcat(aux, ",dir=2");
else if (dir==3) strcat(aux, ",dir=3");
if (i==0) strcat(aux, ",dir=0");
else if (i==1) strcat(aux, ",dir=1");
else if (i==2) strcat(aux, ",dir=2");
else if (i==3) strcat(aux, ",dir=3");
kernel = EXTERIOR;
dir = i;
apply(device::get_default_stream());
Expand Down Expand Up @@ -142,19 +143,15 @@ namespace quda {
int dag = 1;

for (unsigned int i=0; i<x.size(); i++) {
x[i]->Even().allocateGhostBuffer(1);
x[i]->Odd().allocateGhostBuffer(1);
p[i]->Even().allocateGhostBuffer(1);
p[i]->Odd().allocateGhostBuffer(1);

for (int parity=0; parity<2; parity++) {
ColorSpinorField& inA = (parity&1) ? p[i]->Odd() : p[i]->Even();
ColorSpinorField& inB = (parity&1) ? x[i]->Even(): x[i]->Odd();
ColorSpinorField& inC = (parity&1) ? x[i]->Odd() : x[i]->Even();
ColorSpinorField& inD = (parity&1) ? p[i]->Even(): p[i]->Odd();

exchangeGhost(inB, parity, dag);
exchangeGhost(inD, parity, 1-dag);
inB.exchangeGhost(parity ? QUDA_ODD_PARITY : QUDA_EVEN_PARITY, 1, dag);
inD.exchangeGhost(parity ? QUDA_ODD_PARITY : QUDA_EVEN_PARITY, 1, 1 - dag);

instantiate<CloverForce, ReconstructNo12>(U, force, inA, inB, inC, inD, parity, coeff[i]);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/interface_quda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4876,8 +4876,6 @@ void computeCloverForceQuda(void *h_mom, double dt, void **h_x, void **, double
cloverDerivative(cudaForce, *u, *oprodEx, 1.0, QUDA_ODD_PARITY);
cloverDerivative(cudaForce, *u, *oprodEx, 1.0, QUDA_EVEN_PARITY);

if (u != &gaugeEx) delete u;

updateMomentum(*cudaMom, -1.0, cudaForce, "clover");
profileCloverForce.TPSTOP(QUDA_PROFILE_COMPUTE);

Expand All @@ -4887,6 +4885,9 @@ void computeCloverForceQuda(void *h_mom, double dt, void **h_x, void **, double

profileCloverForce.TPSTART(QUDA_PROFILE_FREE);

if (u != &gaugeEx) delete u;
delete oprodEx;

if (gauge_param->make_resident_mom) {
if (momResident != nullptr && momResident != cudaMom) delete momResident;
momResident = cudaMom;
Expand Down

0 comments on commit 8e15042

Please sign in to comment.