Skip to content

How to run matRad with Octave

Niklas Wahl edited this page Aug 24, 2023 · 5 revisions

All matRad core functionalities except the graphical user interface are compatible with GNU Octave. However, an interface to Ipopt should be compiled from source with Octave since the MEX file for the Ipopt interface distributed with matRad is linked to MATLAB-specific libraries. The steps to compile the Ipopt interface with Octave are presented below.

Installing GNU Octave

It is recommended to use matRad with the latest stable release of GNU Octave. matRad has been tested with GNU Octave versions 6 & 7 in Linux. When installing Octave from the package manager of a Linux distribution, it is necessary to also install the development files to provide the command mkoctfile required to build the interface to Ipopt.

By default, Octave is distributed with 32-bit indexing. GNU Octave can also be compiled from source with 64-bit indexing. However, building Octave with 64-bit indexing is rather laborious requiring the compilation of several external libraries to enable 64-bit indexing. Click here for further details on how to compile GNU Octave with 64-bit indexing. Notice that the 64-bit indexing option of Octave is still experimental and that special care should be taken when linking the libraries to avoid segmentation faults.

While matRad can be used with Octave compiled either with 32-bit or 64-bit indexing, some clinically relevant treatment planning scenarios may require an influence matrix, which exceeds the maximum array size available with 32-bit indexing.

Installing Ipopt

The MATLAB interface of Ipopt distributed with matRad is linked against a MATLAB-specific library for the linear solver MA57. An equivalent interface of Ipopt for GNU Octave should be compiled from source. It requires the installation of the Ipopt library along with the corresponding header files. Since the linear solvers are not distributed along with Ipopt, they should be obtained from third-party software. Different linear solvers libraries can be used including HSL_MA57, MUMPS and others. In addition to compiling Ipopt and the linear solvers from source, Ipopt linked to MUMPS is typically available from the package manager of the Linux distributions. Ipopt version 3.12.8 linked with the linear solvers HSL_MA57 and MUMPS has been successfully applied in matRad with GNU Octave.

Compiling Octave interface of Ipopt

The source code of Ipopt provides the source files to compile the original MATLAB interface of Ipopt distributed with matRad. In order to compile the equivalent interface for GNU Octave, it is recommended to use the interface rewritten by Enrico Bertolazzi. The rewritten interface requires GNU Octave version 4.2 or above. The Octave interface of Ipopt can be complied using the mkoctfile command with the option to produce MEX files. Notice that after compiling the Ipopt interface, the corresponding MEX file should be place inside matRad/optimization, and the correct linear solver used with Ipopt should be specified with the option options.ipopt.linear_solver in the file matRad/optimization/matRad_ipoptOptions.m.