Skip to content

Commit

Permalink
[bug] ensure to clear shared mem buffer regardless of weight, #222
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Jun 8, 2024
1 parent b41c915 commit 026eebf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/mcx_core.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ __device__ inline int launchnewphoton(MCXpos* p, MCXdir* v, Stokes* s, MCXtime*
}
}

if (*mediaid == 0 && *idx1d != OUTSIDE_VOLUME_MIN && *idx1d != OUTSIDE_VOLUME_MAX && gcfg->issaveref) {
if (*mediaid == 0 && *idx1d != OUTSIDE_VOLUME_MIN && *idx1d != OUTSIDE_VOLUME_MAX && gcfg->issaveref && p->w > 0.f) {
if (gcfg->issaveref == 1) {
int tshift = MIN(gcfg->maxgate - 1, (int)(floorf((f->t - gcfg->twin0) * gcfg->Rtstep)));

Expand Down Expand Up @@ -1154,13 +1154,19 @@ __device__ inline int launchnewphoton(MCXpos* p, MCXdir* v, Stokes* s, MCXtime*
(nuvox->sv.isupper ? nuvox->sv.upper : nuvox->sv.lower) == 0)) && gcfg->issaveref < 2) {
savedetphoton(n_det, dpnum, ppath, p, v, s, photonseed, seeddata, isdet);
}

clearpath(ppath, gcfg->partialdata);
}

#endif
}

#ifdef SAVE_DETECTORS

if (gcfg->savedet) {
clearpath(ppath, gcfg->partialdata);
}

#endif

/**
* If the thread completes all assigned photons, terminate this thread.
*/
Expand Down

0 comments on commit 026eebf

Please sign in to comment.