fangq / mmc

Mesh-based Monte Carlo (MMC)
Other
40 stars 32 forks source link

mmc error at quicktest demo #74

Closed tlsvc closed 2 years ago

tlsvc commented 2 years ago

Hi Qianqian Fang,

I get an error trying to execute the demo code presented in your first video tutorial (http://mcx.space/tutorials/mcxstudio/3_How_to_use_mcxstudio_to_run_builtin_examples.html).

I am using MCXStudio-linux64-nightlybuild.zip (2022-01-10) on an Arch Linux Machine witch CPU-only mode (MMC).

The complete log is:

=='References'==
If you use MCX/MMC/MCX-CL in your research, we appreciate
if you can cite our relevant papers in your publications.

 -- "MCX" --

# [Yan2020b] Shijie Yan and Qianqian Fang* (2020), "Hybrid mesh and voxel based Monte Carlo algorithm for accurate and efficient photon transport modeling in complex bio-tissues," Biomed. Opt. Express, 11(11) pp. 6262-6270.
$Summary: Hybrid voxel/mesh based MC - SVMC
$Download: https://www.osapublishing.org/boe/abstract.cfm?uri=boe-11-11-6262

# [Fang2009] Qianqian Fang and David Boas, "Monte Carlo Simulation of Photon Migration in 3D Turbid Media Accelerated by Graphics Processing Units," Opt. Express, vol. 17, issue 22, pp. 20178-20190 (2009).
$Summary:  original MCX paper
$Download: http://www.osapublishing.org/oe/abstract.cfm?uri=oe-17-22-20178

 -- "MCX-CL" --
# [Yu2018] Leiming Yu, Fanny Nina-Paravecino, David Kaeli, Qianqian Fang, "Scalable and massively parallel Monte Carlo photon transport simulations for heterogeneous computing platforms," J. Biomed. Opt. 23(1), 010504 (2018).
$Summary:  original MCX-CL (OpenCL) paper
$Download: https://www.spiedigitallibrary.org/journals/journal-of-biomedical-optics/volume-23/issue-01/010504/Scalable-and-massively-parallel-Monte-Carlo-photon-transport-simulations-for/10.1117/1.JBO.23.1.010504.full?SSO=1#ArticleLink

 -- "MMC" --

# [Yuan2021] Yaoshen Yuan, Shijie Yan, and Qianqian Fang*, "Light transport modeling in highly complex tissues using the implicit mesh-based Monte Carlo algorithm," Biomed. Optics Express, 12(1), 147-161, (2021)
$Summary:  Implicit MMC (iMMC)
$Download: https://www.osapublishing.org/boe/fulltext.cfm?uri=boe-12-1-147

# [Fang2019] Qianqian Fang*, Shijie Yan, ““Graphics processing unit-accelerated mesh-based Monte Carlo photon transport simulations,” J. of Biomedical Optics, 24(11), 115002 (2019)
$Summary:  GPU-based MMC
$Download: http://dx.doi.org/10.1117/1.JBO.24.11.115002

# [Yan2019] Shijie Yan, Anh Phong Tran, Qianqian Fang*, “A dual-grid mesh-based Monte Carlo algorithm for efficient photon transport simulations in complex 3-D media,” J. of Biomedical Optics, 24(2), 020503 (2019).
$Summary: Dual-grid MMC for faster and more accurate mesh-based simulations
$Download: http://dx.doi.org/10.1117/1.JBO.24.2.020503

# [Yao2018] Ruoyang Yao, Xavier Intes, Qianqian Fang*, "A direct approach to compute Jacobians for diffuse optical tomography using perturbation Monte Carlo-based photon 'replay'," Biomed. Optics Express 9(10), 4588-4603 (2018)
$Summary:  Building Jacobians with replay in MCX/MMC
$Download: https://www.osapublishing.org/boe/abstract.cfm?uri=boe-9-10-4588

# [Yao2016] Ruoyang Yao, Xavier Intes, Qianqian Fang*, "Generalized mesh-based Monte Carlo for wide-field illumination and detection via mesh retessellation," Biomed. Optics Express, 7(1), 171-184, (2016)
$Summary:  Widefield MMC
$Download: https://www.osapublishing.org/boe/abstract.cfm?uri=boe-7-1-171

# [Fang2012] Qianqian Fang and David R. Kaeli, "Accelerating mesh-based Monte Carlo method on modern CPU architectures ," Biomed. Opt. Express 3(12), 3223-3230 (2012)
$Summary:  SIMD MMC
$Download: https://www.osapublishing.org/boe/abstract.cfm?uri=boe-3-12-3223

# [Fang2011] Qianqian Fang, “Comment on ‘A study on tetrahedron-based inhomogeneous Monte-Carlo optical simulation’,” Biomed. Opt. Express, vol. 2, issue 5, pp. 1258-1264, 2011.
$Summary:  MMC ray-tracing comparisons
$Download: https://www.osapublishing.org/boe/abstract.cfm?uri=boe-2-5-1258

# [Fang2010] Qianqian Fang, "Mesh-based Monte Carlo method using fast ray-tracing in Plücker coordinates," Biomed. Opt. Express 1(1), 165-175 (2010)
$Summary:  original MMC paper
$Download: https://www.osapublishing.org/boe/abstract.cfm?uri=boe-1-1-165

 -- "Applications" --

# [Brain2Mesh2020] Anh Phong Tran† , Shijie Yan† , Qianqian Fang*, (2020) "Improving model-based fNIRS analysis using mesh-based anatomical and light-transport models," Neurophotonics, 7(1), 015008, URL: https://doi.org/10.1117/1.NPh.7.1.015008
$Summary: Brain2Mesh - a one-liner for brain mesh generator (http://mcx.space/brain2mesh)
$Download: https://doi.org/10.1117/1.NPh.7.1.015008

# [Yuan2020] Yaoshen Yuan, Paolo Cassano, Matthew Pias, Qianqian Fang*, (2020) "Transcranial photobiomodulation with near-infrared light from childhood to elderliness: simulation of dosimetry,", Neurophotonics, 7(1), 015009, URL: https://doi.org/10.1117/1.NPh.7.1.015009
$Summary: PBM dosage over lifespan
$Download: https://doi.org/10.1117/1.NPh.7.1.015009

Output:
EXEPATH=/tmp/MCXStudio/MCXSuite/mcx/bin/mcx
Successfully loaded project /tmp/MCXStudio/MCXSuite/mcx/example/mcx_demo.mcxp. Please double click on session list to edit.
"-- Run Command --"
EXEPATH=/tmp/MCXStudio/MCXSuite/mmc/bin/mmc
"/tmp/MCXStudio/MCXSuite/mmc/bin/mmc" -L
"-- Printing GPU Information --"
Platform [0] Name Clover
============ GPU device ID 0 [1 of 1]: AMD RENOIR (DRM 3.42.0, 5.15.11-arch2-1, LLVM 13.0.0)  ============
 Device 1 of 1:     AMD RENOIR (DRM 3.42.0, 5.15.11-arch2-1, LLVM 13.0.0)
 Compute units   :  27 core(s)
 Global memory   :  3221225472 B
 Local memory    :  32768 B
 Constant memory :  67108864 B
 Clock speed     :  1600 MHz
 Vendor name    :   Unknown
 Auto-thread    :   1728
 Auto-block     :   64

"-- Task completed --"
EXEPATH=/tmp/MCXStudio/MCXSuite/mmc/bin/mmc
"-- JSON Input: --"
{
  "Session" : {
    "Photons" : 1.0000000000000000E+007,
    "RNGSeed" : 29012392,
    "ID" : "quicktest",
    "DoMismatch" : 0,
    "DoNormalize" : 1,
    "DoPartialPath" : 1,
    "DoSaveSeed" : 0,
    "DoSaveRef" : 0,
    "OutputType" : "X",
    "RayTracer" : "g"
  },
  "Domain" : {
    "OriginType" : 1,
    "LengthUnit" : 1.0000000000000000E+000,
    "Media" : [
      {
        "mua" : 0.0000000000000000E+000,
        "mus" : 0.0000000000000000E+000,
        "g" : 1.0000000000000000E+000,
        "n" : 1.0000000000000000E+000
      },
      {
        "mua" : 5.0000000000000001E-003,
        "mus" : 1.0000000000000000E+000,
        "g" : 1.0000000000000000E-002,
        "n" : 1.0000000000000000E+000
      }
    ],
    "MeshID" : ""
  },
  "Optode" : {
    "Detector" : [
      {
        "Pos" : [
          2.9000000000000000E+001,
          1.9000000000000000E+001,
          0.0000000000000000E+000
        ],
        "R" : 1.0000000000000000E+000
      },
      {
        "Pos" : [
          2.9000000000000000E+001,
          3.9000000000000000E+001,
          0.0000000000000000E+000
        ],
        "R" : 1.0000000000000000E+000
      },
      {
        "Pos" : [
          1.9000000000000000E+001,
          2.9000000000000000E+001,
          0.0000000000000000E+000
        ],
        "R" : 1.0000000000000000E+000
      },
      {
        "Pos" : [
          3.9000000000000000E+001,
          2.9000000000000000E+001,
          0.0000000000000000E+000
        ],
        "R" : 1.0000000000000000E+000
      }
    ],
    "Source" : {
      "Pos" : [
        29,
        29,
        0
      ],
      "Dir" : [
        0,
        0,
        1
      ],
      "Type" : "pencil"
    }
  },
  "Forward" : {
    "T0" : 0.0000000000000000E+000,
    "T1" : 5.0000000000000001E-009,
    "Dt" : 5.0000000000000001E-009
  }
}
"-- Input is valid, please click [Run] to execute --"
/tmp/MCXStudio/MCXOutput/mmcsessions/quicktest
"-- JSON Input: --"
{
  "Session" : {
    "Photons" : 1.0000000000000000E+007,
    "RNGSeed" : 29012392,
    "ID" : "quicktest",
    "DoMismatch" : 0,
    "DoNormalize" : 1,
    "DoPartialPath" : 1,
    "DoSaveSeed" : 0,
    "DoSaveRef" : 0,
    "OutputType" : "X",
    "RayTracer" : "g"
  },
  "Domain" : {
    "OriginType" : 1,
    "LengthUnit" : 1.0000000000000000E+000,
    "Media" : [
      {
        "mua" : 0.0000000000000000E+000,
        "mus" : 0.0000000000000000E+000,
        "g" : 1.0000000000000000E+000,
        "n" : 1.0000000000000000E+000
      },
      {
        "mua" : 5.0000000000000001E-003,
        "mus" : 1.0000000000000000E+000,
        "g" : 1.0000000000000000E-002,
        "n" : 1.0000000000000000E+000
      }
    ],
    "MeshID" : ""
  },
  "Optode" : {
    "Detector" : [
      {
        "Pos" : [
          2.9000000000000000E+001,
          1.9000000000000000E+001,
          0.0000000000000000E+000
        ],
        "R" : 1.0000000000000000E+000
      },
      {
        "Pos" : [
          2.9000000000000000E+001,
          3.9000000000000000E+001,
          0.0000000000000000E+000
        ],
        "R" : 1.0000000000000000E+000
      },
      {
        "Pos" : [
          1.9000000000000000E+001,
          2.9000000000000000E+001,
          0.0000000000000000E+000
        ],
        "R" : 1.0000000000000000E+000
      },
      {
        "Pos" : [
          3.9000000000000000E+001,
          2.9000000000000000E+001,
          0.0000000000000000E+000
        ],
        "R" : 1.0000000000000000E+000
      }
    ],
    "Source" : {
      "Pos" : [
        29,
        29,
        0
      ],
      "Dir" : [
        0,
        0,
        1
      ],
      "Type" : "pencil"
    }
  },
  "Forward" : {
    "T0" : 0.0000000000000000E+000,
    "T1" : 5.0000000000000001E-009,
    "Dt" : 5.0000000000000001E-009
  }
}
"-- Command: --"
mmc --session quicktest --input /tmp/MCXStudio/MCXOutput/mmcsessions/quicktest/quicktest.json --root /tmp/MCXStudio/MCXOutput/mmcsessions/quicktest --outputformat ascii --gpu 1 --autopilot 1 --photon 10000000 --normalize 1 --save2pt 1 --reflect 0 --savedet 1 --unitinmm 1.00 --seed 29012392 --saveseed 0 --atomic 1 --specular 0 --basisorder 1
EXEPATH=/tmp/MCXStudio/MCXSuite/mmc/bin/mmc
EXEPATH=/tmp/MCXStudio/MCXSuite/mmc/bin/mmc
"-- Executing Simulation --"

MMC ERROR(-1):InitElem must be given in unit mcx_utils.c:1058

"-- Task completed --" 

What could be the reason for this kind of error? Any library I missed to install? Or is it a bug?

With best regards, Tristan

fangq commented 2 years ago

the actual error was printed at the bottom of your quoted message

MMC ERROR(-1):InitElem must be given in unit mcx_utils.c:1058

when you choose mmc in the device radio button, the 3rd row in the Additional Settings table becomes InitElem, where you should typed in an element ID where your source position is enclosed inside. currently, this only supports point sources (pencil or isotropic), and does not support wide-field sources (disk, planar, fourier etc).