Release Notes for Mesh-based Monte Carlo 1.9 (v2020)

code name: Moon Cake beta, released on September 06, 2020

Click this link to download MMC/MMCLAB v2020

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 v2020 (1.9) is a major update to MMC. For the first time, MMC adds GPU support via the newly implemented OpenCL version. The released package simultaneously supports CPU-only multi-threading with SSE4 (standard MMC) and OpenCL-based MMC on a wide variety of CPU/GPU devices across vendors. Using up-to-date GPU hardware, the MMC simulation speed was increased by 100x to 400x compared to single-threaded SSE4-based MMC simulation. The detailed description of the GPU accelerated MMC can be found in the below paper [Fang2019].

One can choose between the SSE4 and OpenCL based simulation modes using the -G or cfg.gpuid input options. A device ID of -1 enables SSE4 CPU based MMC, and a number 1 or above chooses the supported OpenCL device (using mmc -L or mmclab('gpuinfo') to list).

A detailed (long) list of updates can be found in the ChangeLog or the Github commit history:

To highlight a few most important updates:

  • Supported GPU using OpenCL in both binary and mmclab
  • Supported using multiple NVIDIA GPUs
  • GPU MMC (or MMCL) had been rigorously validated across a range of benchmarks
  • Supported photon sharing for multiple patterns
  • Characterized the speed improvement of MMCL simulations over standard MMC
  • Created mmc and octave-mmclab official Fedora packages and disseminate via Fedora repositories
  • Implemented xorshift128+ RNG unit and used as default for both CPU/GPU MMC
  • Fixed a list of bugs in both SSE4/OpenCL MMC
  • Created 6 standard benchmarks (B1:cube60, B1D:d-cube60, B2:sphshells, B2D:d-sphshells, B3:colin27, B4:skin-vessel) for comparisons

Please file bug reports to

Moreover, over the past year, we have also published a high-quality brain 3D mesh generation pipeline and rigorously compared mmc with voxel based MCX, and showed improvement in modeling accuracy. The detail of the mesh generation software (Brain2mesh: and the benchmarks can be found in the below [Brain2Mesh2020] paper.

Lastly, we also implemented the photon sharing algorithm to simultaneously simulate multiple pattern sources. This paper is detailed in the recently published OL paper, see [Yan2020].


  1. [Fang2019] Qianqian Fang* and Shijie Yan, "GPU-accelerated mesh-based Monte Carlo photon transport simulations," J. of Biomedical Optics, 24(11), 115002 (2019) URL:

  1. [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:

  1. [Yan2020] Yan S, Yao R, Intes X, and Fang Q*, "Accelerating Monte Carlo modeling
of structured-light-based diffuse optical imaging via 'photon sharing'," Opt. Lett. 45, 2842-2845 (2020) URL:

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) parallism via SSE and, starting from v2020, OpenCL to support a wide range of CPUs/GPUs from nearly all vendors.

MMCLAB is the MATLAB mex version of the MMC software. It can be directly called inside MATLAB. This makes it easy to use with streamlined pre-processing (mesh generation using the Iso2Mesh toolbox) and post processing (visualization and data analysis).

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 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 (* 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 ( 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