InverseLight / ValoMC

Monte Carlo software for simulating light propagation
https://inverselight.github.io/ValoMC/
Other
43 stars 14 forks source link

Parallel Computing - ValoMC #9

Open ErwinCX opened 3 years ago

ErwinCX commented 3 years ago

I was trying to apply the Parallel Computing Toolbox of MATLAB to the solution provided by ValoMC to a 3D model. Needless to say, I'm struggling with it.

Does anyone happen to know a way of using multiple cores (or clusters of computers) to accelerate the computation from ValoMC?

aaleino commented 3 years ago

For multiple cores, you need to ensure OpenMP is enabled when compiling ValoMC. This can be done using either CMake (at command prompt)

cmake .

cmake --build .

or by compiling the mex files manually. For example:

mex -DUSE_OMP cpp/3d/MC3Dmex.cpp COMPFLAGS='\$COMPFLAGS -fopenmp' CXXFLAGS='\$CXXFLAGS -fopenmp' LDFLAGS='\$LDFLAGS -fopenmp'

To utilize a computing cluster, you could sum up the solutions from several independent computations and divide the result by the number of computations. Just make sure that the seed number is different in each computation.