Skip to content

Compiling MMC (Mesh-based Monte Carlo)

Mesh-based Monte Carlo (MMC 0.95 Wasabi Peas) is a "Monte Carlo (MC) solver for photon migration in 3D turbid media."[1]

The binary distribution depends on a version of GLIBC later than installed on Proteus, so the software has to be compiled from source.

Download

The source may be downloaded from Sourceforge -- this is version 0.95 Wasabi Peas; navigate to parent directories for other versions:

http://sourceforge.net/projects/mcx/files/mmc/mmc%20source/0.9.5%20%28Wasabi%20Peas%29/

The source package is: mmc-0.9.5-src.tar.gz

Place the file in your home directory, i.e. ~/mmc-0.9.5-src.tar.gz

Expand:

[juser@proteusi01 ~]$ tar xf mmc-0.9.5-src.tar.gz

This creates the directory:

~/mmc

Using GCC

See the official documentation:

http://mcx.sourceforge.net/cgi-bin/index.cgi?MMC/Doc/MMCLAB#How_to_compile_MMCLAB

Environment

These modules are loaded:

Currently Loaded Modulefiles: 1) shared      2) proteus     3) gcc/4.8.1   4) sge/univa  5) matlab/2014b

Modify Makefile_common.mk

Modify the file

mmc/src/commons/Makefile_common.mk

Edit the line starting with "CCFLAGS" and add "-fPIC" to the options:

CCFLAGS    += -c -Wall -g -fno-strict-aliasing -fPIC #-pedantic -std=c99 -mfpmath=sse -ffast-math -mtune=core2

Compile

[juser@proteusi01 ~]$ cd mmc/src [juser@proteusi01 ~/mmc/src]$ make ssemath -f makefile_sfmt CC=gcc > Make.out 2>&1 wait`` ``till`` ``make`` ``is`` ``done [juser@proteusi01] ~/mmc/src]$ make mexsse -f makefile_sfmt CC=gcc >> Make.out 2>&1

Edit .bash_profile

Near the end of ~/.bash_profile, add:

export PATH=~/mmc/src/bin:${PATH}

Then, only during this process (it will be automatic the next time you log in):

[juser@proteusi01 ~/mmc]$ . ~/.bash_profile

Edit MATLAB Startup Script

The default personal MATLAB path is ~/Documents/MATLAB. If that directory does not exist, create it:

[juser@proteusi01 ~]$ mkdir -p ~/Documents/MATLAB

Create a file named "startup.m" in that directory, containing this line:

addpath ~/mmc/mmclab

Running MMC/MMClab

This program is multithreaded, so job submissions will need to request multiple slots using the "shm" PE.

References

[1] MCX and MMC official website