Release Notes for Mesh-based Monte Carlo 2.2 (v2024.2)

code name: Nougat, released on March 15, 2024

Click this link to download MMC/MMCLAB v2024.2

Acknowledgement: This software release is made possible with the funding support from the NIH/NIGMS under grant R01-GM114365.

1. What's New
2. Introduction
3. System requirements
4. Known issues
5. Reference

1. What's New

MMC v2024.2 (2.2.0) adds the below key features

  • support saving photon trajectories (-D M or cfg.debuglevel='M')
  • allow to use a single JSON input file to store mesh node, element and iMMC ROI data, along with other simulation settings
  • compute element face-neighbours (facenb) and volumes (evol) in C code, avoid needing preprocessing
  • support built-in benchmarks, use --bench to list and --bench name to run
  • accept pattern data in the JSON input file
  • store pattern pixel index for each photon in photon sharing
  • provide native Apple M1 binaries

Aside from these added new features, we have also fixed a number of bugs. All MATLAB scripts have been automatically formatted using miss_hit. The binary JSON library was also updated to the latest version.

2. Introduction

Mesh-based Monte Carlo (MMC) is a 3D Monte Carlo (MC) simulation software for photon transport in complex turbid media. MMC combines the strengths of the MC-based technique and the finite-element (FE) method: on the one hand, it can handle general media, including low-scattering ones, as in the MC method; on the other hand, it can use an FE-like tetrahedral mesh to represent curved boundaries and complex structures, making it even more accurate, flexible, and memory efficient. MMC uses the state-of-the-art ray-tracing techniques to simulate photon propagation in a mesh space. It has been extensively optimized for excellent computational efficiency and portability. MMC currently supports multi-threaded parallel computing via OpenMP, Single Instruction Multiple Data (SIMD) parallelism via SSE and, starting from v2019.10, OpenCL to support a wide range of CPUs/GPUs from nearly all vendors.

To run an MMC simulation, one has to prepare an FE mesh first to discretize the problem domain. Image-based 3D mesh generation has been a very challenging task only until recently. One can now use a powerful yet easy-to-use mesh generator, iso2mesh [1], to make tetrahedral meshes directly from volumetric medical images. You should download and install the latest iso2mesh toolbox in order to run the build-in examples in MMC.

The most relevant publication describing this work is the GPU-accelerated MMC paper:

Qianqian Fang and Shijie Yan, "GPU-accelerated mesh-based Monte Carlo photon transport simulations," J. of Biomedical Optics, in press, 2019. Preprint URL: https://www.biorxiv.org/content/10.1101/815977v1

Please keep in mind that MMC is only a partial implementation of the general Mesh-based Monte Carlo Method (MMCM). The limitations and issues you observed in the current software will likely be removed in the future version of the software. If you plan to perform comparison studies with other works, please communicate with the software author to make sure you have correctly understood the details of the implementation.

The details of MMCM can be found in the following paper:

Qianqian Fang, "Mesh-based Monte Carlo method using fast ray-tracing in Plücker coordinates," Biomed. Opt. Express 1, 165-175 (2010) URL: https://www.osapublishing.org/boe/abstract.cfm?uri=boe-1-1-165

While the original MMC paper was based on the Plücker coordinates, a number of more efficient SIMD-based ray-tracers, namely, Havel SSE4 ray-tracer, Badouel SSE ray-tracer and branchless-Badouel SSE ray-tracer (fastest) have been added since 2011. These methods can be selected by the -M flag. The details of these methods can be found in the below paper

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

and their key differences compared to another mesh-based MC simulator, TIM-OS, are discussed in

Qianqian Fang, "Comment on 'A study on tetrahedron-based inhomogeneous Monte-Carlo optical simulation'," Biomed. Opt. Express, vol. 2(5) 1258-1264, 2011. URL: https://www.osapublishing.org/boe/abstract.cfm?uri=boe-2-5-1258

In addition, the generalized MMC algorithm for wide-field sources and detectors are described in the following paper, and was made possible with the collaboration with Ruoyang Yao and Prof. Xavier Intes from RPI

Yao R, Intes X, Fang Q, "Generalized mesh-based Monte Carlo for wide-field illumination and detection via mesh retessellation," Biomed. Optics Express, 7(1), 171-184 (2016) URL: https://www.osapublishing.org/boe/abstract.cfm?uri=boe-7-1-171

In addition, we have been developing a fast approach to build the Jacobian matrix for solving inverse problems. The technique is called "photon replay", and is described in details in the below paper:

Yao R, Intes X, Fang Q, "A direct approach to compute Jacobians for diffuse optical tomography using perturbation Monte Carlo-based photon 'replay'," Biomed. Optics Express, in press, (2018)

In 2019, we published an improved MMC algorithm, named "dual-grid MMC", or DMMC, in the below JBO Letter. This method allows to use separate mesh for ray-tracing and fluence storage, and can be 2 to 3 fold faster than the original MMC without loss of accuracy.

Shijie Yan, Anh Phong Tran, Qianqian Fang*, "A dual-grid mesh-based Monte Carlo algorithm for efficient photon1transport simulations in complex 3-D media," J. of Biomedical Optics, 24(2), 020503 (2019).

The authors of the papers are greatly appreciated if you can cite the above papers as references if you use MMC and related software in your publication.

3. System requirements

Although MMC/MMCLAB can be executed independently if all input data (including mesh data) are provided, most pre- and post-processing scripts in both packages require the installation of Iso2Mesh Toolbox - a MATLAB based 3D mesh generator. Please browse http://iso2mesh.sf.net for download and installation information.

By default, MMC/MMCLAB uses OpenCL-based simulations to utilize all GPUs and CPUs installed on your system. If you have a GPU (NVIDIA, AMD or Inel), the OpenCL support is typically installed if you have correctly installed the latest version of the graphics driver. Please verify that the OpenCL library (libOpenCL.so* on Linux, OpenCL.dll on Windows or /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL on the Mac) must exist in your system.

Generally speaking, AMD and NVIDIA high-end dedicated GPU performs the best, about 20-60x faster than a multi-core CPU; Intel's integrated GPU is about 3-4 times faster than a multi-core CPU.

In addition, MMC has been fully tested with the open-source OpenCL runtime pocl (http://portablecl.org/) on the CPU. To install pocl on a Ubuntu/Debian system, please run

  sudo apt-get install pocl-opencl-icd

If you happen to use a system that does not have OpenCL support, you may still use MMC/MMCLAB by calling it in the CPU-only SSE4 mode, with -G -1 or cfg.gpuid=-1. To verify your CPU supports SSE4, please run

  grep 'sse4' /proc/cpuinfo 

or using a freeware "CPU-Z" on windows. If you attempt to run the SSE4 on an unsupported computer, you will get an error when executing the binary. In that case, you should recompile MMC using "make omp" command.

4. Known issues

  • One must use savemmcmesh.m to generate all mesh input files for MMC; otherwise, the element orientation is not guaranteed.
  • Currently, this code only supports element-based optical properties; nodal-based optical properties (for continuously varying media) will be added in a future release
  • The maximum photon number per MMC session is 2^32-1=4,294,967,295, if you need to run a large number of photons, we suggest you splitting the job into smaller jobs with each one running a smaller chunk of photons (for example 1E8). Each job should initialized with a different seed (-E).

5. Reference

Powered by Habitat