Skip to content

Using MatConvNet

Here is the procedure to be done on the first use. Since MatConvNet is no longer supported, some extra patching steps are required to make it work on Maestro.

  1. Download and unpack MatConvNet at http://www.vlfeat.org/matconvnet/download/matconvnet-1.0-beta25.tar.gz

Code Block (bash)

login@maestro ~ $ wget https://www.vlfeat.org/matconvnet/download/matconvnet-1.0-beta25.tar.gz
login@maestro ~ $ tar zxf matconvnet-1.0-beta25.tar.gz
  1. Go to the MatConvNet directory

Code Block (bash)

login@maestro ~ $ cd matconvnet-1.0-beta25
  1. Then copy the file in the MatConvNet directory and use it to patch the MatConvNet Makefile

Code Block (bash)

login@maestro matconvnet-1.0-beta25 $ patch -p 0 -i ./fix_matconvnet_makefile.patch
  1. Put the right libjpeg in your PATH.

Code Block (bash)

login@maestro matconvnet-1.0-beta25 $ module load libjpeg-turbo/2.0.6
  1. Load  Cuda 10.2 or Cuda 11.1 with the corresponding GCC version and Matlab :

Code Block (bash)

login@maestro matconvnet-1.0-beta25 $ module load gcc/8.4.0 cuda/10.2 matlab/R2020b

or

Code Block (bash)

login@maestro matconvnet-1.0-beta25 $ module load gcc/9.3.0 cuda/11.1 matlab/R2021a
  1. Then launch your Matlab on a GPU node

Code Block (bash)

login@maestro matconvnet-1.0-beta25 $ srun -p gpu --qos=gpu --gres=gpu:1 -L matlab@licserv --pty --x11 matlab
  1. and compile with the GPU support inside it

Code Block (bash)

> vl_compilenn('enableGpu',true)

It should end with

Code Block (bash)

MEX completed successfully.
  1. Close your Matlab and patch mex files regarding libjpeg

Code Block (bash)

login@maestro matconvnet-1.0-beta25 $ module load patchelf libjpeg-turbo/2.0.6
login@maestro matconvnet-1.0-beta25 $ $MEXDIR=./matlab/mex/
login@maestro matconvnet-1.0-beta25 $ for mexfile in ${MEXDIR}/*.mexa64; do 
> patchelf --set-rpath ${LIBJPEGTURBO_ROOT}/lib:$(patchelf --print-rpath ${mexfile}) ${mexfile};
> done
  1. Then start a Matlab session again

Code Block (bash)

login@maestro matconvnet-1.0-beta25 $ srun -p gpu --qos=gpu --gres=gpu:1 -L matlab@licserv --pty --x11 matlab
  1. and try the Quick Start http://www.vlfeat.org/matconvnet/quick/ to check that everything is ok. Do not forget to download the Matrix  http://www.vlfeat.org/matconvnet/models/imagenet-vgg-f.mat and the following peppers.png picture outside of Matlab since the compute nodes don't have access to the Internet.

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.

false5FAQAfalsemodifiedtruepagelabel in ("gpu","matconvnet") and type = "page" and space = "FAQA"matConvNet gpu

true

Related issues