MATLAB#
TIGRE for MATLAB is compiled on your machine with Compile.m.
Requirements#
MATLAB R2016b or newer
An NVIDIA GPU
The CUDA toolkit
Visual Studio 2013, 2015, 2017, 2019 or 2022, with the C++ workload (latest, older versions)
Note
Your Windows user name must not contain spaces.
MATLAB R2016b or newer
An NVIDIA GPU
The CUDA toolkit; follow NVIDIA’s Linux installation guide carefully
gcc, in a version supported by both your MATLAB release and your CUDA toolkit
Install#
Get TIGRE, with
git clone https://github.com/CERN/TIGRE.gitor by downloading the zip file.Linux only: make sure MATLAB can find CUDA. Add these lines to
~/.bashrc, open a new terminal, and start MATLAB from it:export PATH=$PATH:/usr/local/cuda/bin export LD_LIBRARY_PATH=/usr/local/cuda/lib64
Windows only: check that MATLAB sees Visual Studio’s C++ compiler. Run
mex -setup -vin MATLAB. Near the end, the lines that look for Visual C++ should end in Yes, and Visual Studio should be selected as the C/C++ compiler. If not, open the Visual Studio Installer, choose Modify, and add the C++ workload.In MATLAB, go to the
TIGRE/MATLABfolder and run:CompileOn Windows,
Compilepicks the configuration file matching your Visual Studio version (mex_CUDA_win64_MVS20XX.xml). To force a specific one, runCompile -mex_xml mex_CUDA_win64_MVS2019.xml.Add TIGRE to the MATLAB path. From the
TIGRE/MATLABfolder, run:InitTIGREInitTIGREadds folders relative to the current folder, so run it fromTIGRE/MATLABat the start of every MATLAB session that uses TIGRE.Check the installation by running
Demos/d03_generateData.m. If it runs without errors, TIGRE is installed.
Advanced: disable pinned memory#
TIGRE uses pinned (page-locked) host memory to overlap memory transfers with computation. If you reconstruct datasets larger than your RAM and rely on swap, compile without pinned memory. The operators will be slower.
Compile -no_pinned_mem
Getting help#
If installation fails, search the GitHub issues and Discussions, then ask there, including your OS, GPU, CUDA version, compiler version and MATLAB release. You can also email tigre.toolbox@gmail.com.