From c6463445eca370b0c7a5d75239ea809bc45ba61b Mon Sep 17 00:00:00 2001 From: Qianqian Fang Date: Wed, 16 Oct 2024 10:08:51 -0400 Subject: [PATCH] [bug] fix incorrect normalization for GPU mmc, fix #100 --- src/mmc_core.cl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mmc_core.cl b/src/mmc_core.cl index 0bc30ba..4c797b5 100644 --- a/src/mmc_core.cl +++ b/src/mmc_core.cl @@ -1704,8 +1704,12 @@ __device__ void onephoton(unsigned int id, __local float* ppath, __constant MCXP savedebugdata(&r, id, reporter, gdebugdata, gcfg); } - for (oldeid = 0; oldeid < GPU_PARAM(gcfg, srcnum); oldeid++) { - energyesc[oldeid] += r.weight * ppath[GPU_PARAM(gcfg, reclen) + oldeid]; + if (GPU_PARAM(gcfg, srcnum) == 1) { + *energyesc += r.weight; + } else { + for (oldeid = 0; oldeid < GPU_PARAM(gcfg, srcnum); oldeid++) { + energyesc[oldeid] += r.weight * ppath[GPU_PARAM(gcfg, reclen) + oldeid]; + } } }