In this section the following tasks are described:

  • Installing required libraries
  • Building magnum.fd from source
  • Testing the magnum.fd installation

Required libraries

Required runtime libraries:

Library Should work with version Recommended version Remarks URL Ubuntu/Debian package
Python developer package 2.4 2.6,2.7,3.2 Python 3.x works python-dev
FFTW 3.0.0 3.3.2+ Get the highest version libfftw3-dev
CUDA (if GPU is enabled) CUDA 3 highest Tested with CUDA 4 (n/a)
Numpy (optional) 1.3.0 1.3.0+ Needed to convert scalar/vector field objects to numpy arrays python-numpy
Python Imaging Library (optional) any recent any recent Needed for the ImageShapeCreator class (optional) python-imaging
Sundials CVode (optional) sundials-2.5.0 cvode-2.7.0 cvode-2.7.0 Needed for using implicit CVode evolver (optional) (n/a)

Ubuntu/Debian apt-get command:

sudo apt-get install python-dev python-numpy python-imaging libfftw3-dev

Additional software that is required to build magnum.fd from source:

Software “should work” Recommended Remarks URL Ubuntu/Debian package
g++ build chain any newest g++
cmake 2.8.8 2.8.8+ Build system cmake
swig 1.3 2.0.1+ Python wrapper generator swig1.3, swig2.0
Sphinx any recent 0.6.6+ Python documentation generator python-sphinx
bzr any recent any recent Bazaar version control system bzr

Ubuntu/Debian apt-get command:

sudo apt-get install g++ cmake python-sphinx bzr
sudo apt-get install swig2.0
sudo apt-get install swig1.3 # if swig2.0 is not available

Building magnum.fd from source

Clone the git repository

git clone

Now the magnum.fd source code is located in the “magnum.fd” subdirectory. To build magnum.fd, enter:

cd magnum.fd                    # enter magnum.fd base directory
cd src/build                    # enter build directory
cmake ..                        # to compile for CPU
make                            # start the build process
sudo make install               # installs magnum.fd as python package

You can use the following parameters to customize your installation:

cmake .. [parameters]
-DENABLE_CUDA_32=on  # to compile for cuda 32 bit
-DENABLE_CUDA_64=on  # to compile for cuda 64 bit
-DUSE_PYTHON2=on     # force compile for python2
-DUSE_PYTHON3=on     # force compile for python3
-DUSE_CVODE=on       # compile with CVode

If you don’t want to install magnum.fd, then set PYTHONPATH to <micromagnum-basedir>/src

To check the installation, start the Python interactive shell by entering “python” and type “import magnum”. If everything went ok, you should see no errors like this:

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import magnum
[   INFO] - magnum.fd 0.0.1
[   INFO] - Copyright (C) 2012-2014 by the MicroMagnum team.
[   INFO] - Copyright (C) 2014 by the magnum.fd team.
[   INFO] - This program comes with ABSOLUTELY NO WARRANTY.
[   INFO] - This is free software, and you are welcome to redistribute it
[   INFO] - under certain conditions; see the file COPYING in the distribution package.

You can then enter the examples directory in the magnum.fd base directory and try out the examples, like:

cd examples/sp4
./sp4 -l0           # add -g0 to run on GPU
                    #(this works only when GPU support was enabled at compile time)

Building with CVode evolver

If you want to use magnum.fd with the implicit CVode evolver you can get it on the sundials download page.

Or get the package directly:

tar -xvf cvode-2.7.0.tar.gz

To build and install you can use:

cd cvode-2.7.0          # change to the source directory
./configure --with-pic  # the PIC option is important to use it with magnum.fd.
make                    # build
sudo make install       # and install cvode

Now you can build magnum.fd and activate CVode with the toggle:

cmake .. -DUSE_CVODE=on   # to enable CVode

If you do not have the permission to install globally, use these Cmake parameters:


FFTW download and building

If you want a custom build of FFTW.

FFTW download, version 3.2.2 at, see for newer versions such as the latest alpha version.

Suggested configure parameters:

./configure --with-pic --prefix=/home/gselke/fftw --enable-openmp --enable-sse2