Skip to content

Commit

Permalink
fix -b 0 -B rrrrrr crash, thanks to @ShijieYan
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Jul 25, 2020
1 parent bf0840f commit 37793ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/mcx_core.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2107,7 +2107,11 @@ void mcx_run_simulation(Config *cfg,GPUInfo *gpu){
mcx_flush(cfg);

int isinternal=((cfg->internalsrc>0) || (param.mediaidorig && (cfg->srctype==MCX_SRC_PENCIL || cfg->srctype==MCX_SRC_CONE || cfg->srctype==MCX_SRC_ISOTROPIC)));
switch(isinternal*100 + (cfg->isreflect>0)*10+(cfg->mediabyte<=4)){
int isref=cfg->isreflect;
for(i=0;i<6;i++)
if(cfg->bc[i]==1)
isref=1;
switch(isinternal*100 + (isref>0)*10+(cfg->mediabyte<=4)){
case 0: mcx_main_loop<0,0,0> <<<mcgrid,mcblock,sharedbuf>>>(gmedia,gfield,genergy,gPseed,gPpos,gPdir,gPlen,gPdet,gdetected,gsrcpattern,greplayw,greplaytof,greplaydetid,gseeddata,gdebugdata,gprogress);break;
case 1: mcx_main_loop<0,0,1> <<<mcgrid,mcblock,sharedbuf>>>(gmedia,gfield,genergy,gPseed,gPpos,gPdir,gPlen,gPdet,gdetected,gsrcpattern,greplayw,greplaytof,greplaydetid,gseeddata,gdebugdata,gprogress);break;
case 10: mcx_main_loop<0,1,0> <<<mcgrid,mcblock,sharedbuf>>>(gmedia,gfield,genergy,gPseed,gPpos,gPdir,gPlen,gPdet,gdetected,gsrcpattern,greplayw,greplaytof,greplaydetid,gseeddata,gdebugdata,gprogress);break;
Expand Down
2 changes: 1 addition & 1 deletion test/testmcx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ temp=`$MCX --bench cube60 -b 1 | grep -o -E 'absorbed:.*27\.[0-9]+%'`
if [ -z "$temp" ]; then echo "fail to use -b 1 flag to enable reflection"; fail=$((fail+1)); else echo "ok"; fi

echo "test boundary condition flag -B ... "
temp=`$MCX --bench cube60 -b 1 -B aarraa | grep -o -E 'absorbed:.*27\.[0-9]+%'`
temp=`$MCX --bench cube60 -b 0 -B aarraa | grep -o -E 'absorbed:.*27\.[0-9]+%'`
if [ -z "$temp" ]; then echo "fail to use -B flag to set facet based boundary condition"; fail=$((fail+1)); else echo "ok"; fi

echo "test photon detection ... "
Expand Down

0 comments on commit 37793ae

Please sign in to comment.