MULTEM is a collection of routines written in C++ with CUDA (and soon also OpenCL) to simulate (S)TEM experiments. Currently, there are two supported ways to use MULTEM:
- Matlab: using the mex interface
- C++: using the library itself The library is under heavy development and subject to change. The Matlab interface is the recommended way
The following steps work using Matlab R2014a, GCC 4.9, and CUDA 6.5, Linux 64-bit, assuming nvcc/gcc is in PATH:
-
copy the
mex_CUDA_glnxa64.xml
file from/usr/local/MATLAB/R2014a/toolbox/distcomp/gpu/extern/src/mex/glnxa64/
to~/.matlab/R2014a
-
Edit the file with a text editor so that the LINKLIBS line points to you CUDA SDK libraries instead of MATLAB's own versions: As an example:
LINKLIBS="-Wl,-rpath-link,$MATLABROOT/bin/$ARCH -L"$MATLABROOT/bin/$ARCH" -lmx -lmex -lmat -lm -lmwgpu -L/opt/cuda/lib64 -lcufft -lcudart"
-
run the
compileMULTEM.m
script. This will createMULTEMMat.mexa64
andCreateCrystalbyLayers.mexa64
, which need to be copied alongside the files using the functions. -
To run the examples, copy
MULTEMMat.mexa64
to theMultislice examples
directory andCreateCrystalbyLayers.mexa64
to theBuild Crystal
directory so the scripts in those directories can call the respective functions.