SPM Toolbox
The Statistical Parametric Mapping (SPM) toolbox for MATLAB is available as an Lmod module on Klone compute nodes.
Use with Lmod
Like all Lmod modules, the spm module is available only on Klone compute nodes, and these commands will not work on the login node.
Checking available versions
Because the module for SPM is installed in the escience hierarchy, its name is prefixed with escience/.
You can check the installed versions as follows:
module spider escience/spmThe output should look a bit like this:
---------------------------------------
escience/spm: escience/spm/12
---------------------------------------
This module can be loaded directly: module load escience/spm/12
Help:
spm12
Running SPM
Load the default version with module load escience/spm or load a specific version with module load escience/spm/version.
After loading the module, start matlab and run spm in the MATLAB command window.
Installing different versions via Lmod
You can install different versions of SPM by following the instructions below.
Go to https://www.fil.ion.ucl.ac.uk/spm/software/download, choose the version of SPM you want to install, copy the download link to the file, and download the file by running the following command on a Klone login or compute node. We’ll use version 8 as an example:
mkdir -p "/gscratch/scrubbed/$USER/downloads" && cd "$_" curl -LO https://www.fil.ion.ucl.ac.uk/spm/download/restricted/dyll/spm8.zip- 1
-
Create the target directory if it does not exist and navigate to it (
$_is a special variable that expands to the last argument of the previous command). - 2
-
curlis a program you can use to download files from the web. Replace the URL with the URL for the version of SPM you want to install. The-Loption tellscurlto follow redirects, and the-Ooption tells it to save the file to the current directory.
Extract the archive and copy the contents to
/sw/contrib/mylabname-src/spm/8(replacingmylabnamewith the name of your lab):unzip spm8.zip -d spm8.zip # Make sure you include the parentheses around the commands below. Replace "mylabname" with your lab name! (umask 002 && mkdir -p /sw/contrib/mylabname-src/spm/8 && rsync -rlHP --chmod=a+rwX spm8/spm8/ $_) rm -rfv spm8.zip spm8- 1
-
Extract the SPM archive to a new directory called
spm8. - 2
-
In bash, parentheses create a [subshell]((https://tldp.org/LDP/abs/html/subshells.html), which runs the enclosed commands in a new shell session. We want to use it here so that we can temporarily modify the default permissions for new files and directories with the
umaskcommand. Your current settings will remain intact when the commands in the subshell are completed. - 3
- We’re running a series of commands here in a [subshell]((https://tldp.org/LDP/abs/html/subshells.html). Let’s break it down:
- 4
- Remove the downloaded file and the extracted directory.
Use a text editor to create an Lmod
.luamodule file for the new release with a text editor, using8.luaas the filename:/sw/contrib/modulefiles/mylabname/spm8.lua
help(myModuleName()) local base = pathJoin( "/sw/contrib", string.gsub(myModuleName(), "/.*$", "-src"), string.gsub(myModuleName(), "^.*/", ""), myModuleVersion() ) whatis("Name: " .. string.gsub(myModuleName(), "^.*/", "")) whatis("Version: " .. myModuleVersion()) depends_on("matlab") append_path("MATLABPATH", base)Check that the module is available and load it:
module -I spider mylabname/spm module load mylabname/spm/8- 1
-
Lmod takes some time to cache available modules. You can use the
-Ioption to force Lmod to check for new modules.