You have some options to install MicroMagnum. Everything you can find on download page:
- Get the source from Github (recommended)
- Use the precompiled binaries.
Install precompiled Ubuntu packages
When you downloaded the Ubuntu package you can install it with the command:
sudo dpkg -i micromagnum_0.2*.deb
If you do not have all dependencies, you will get an error message. To install missing packages type:
sudo apt-get -f install
Install precompiled Windows packages
Precompiled binaries for Microsoft Windows are available in download. The Windows version works with CUDA.
- Required: Python >= 2.7 or Python >= 3.3
- Installation: Run the according Windows Installer.
- Test: Open a python environment and run "from magnum import *" If you don't get an error your simulations should work now!
- Simulate: Run a script by executing e.g. "...\Python27\python.exe myScript.py"
Install MicroMagnum from source
Install prerequisite software libraries
You need the following software/libraries to compile MicroMagnum:
- Python >= 2.4
- FFTW >= 3.0.0
- CUDA >= 3 (optional)
- Python Imaging Library (optional)
- Numpy >= 1.3.0 (optional)
Furthermore you need the following build tools:
- C++ compiler
- cmake >= 2.8.8
- swig >= 1.3 (>= 2.0 recommended)
If you use a recent version of Ubuntu you can install the libraries (except CUDA) easily using apt-get:
sudo apt-get install python2.7-dev python-numpy python-imaging \ libfftw3-dev
And for the required build tools:
sudo apt-get install g++ cmake swig
Mac OS X
We had some success in creating a (CPU-only) build of MicroMagnum for Mac OS X.
The following packages where installed manually:
swig (download: http://prdownloads.sourceforge.net/swig/swig-2.0.11.tar.gz)
To compile swig we had to install the libpcre library before (download: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.tar.gz).
cd libpcre-8.32 ./configure make sudo make install cd swig-2.0.11 ./configure make sudo make install
FFTW (download: http://fftw.org/fftw-3.3.3.tar.gz)
cd fftw-3.3.3 ./configure --enable-shared --enable-threads make sudo make install
CMake was installed from the binary package (download: http://www.cmake.org/files/v2.8/cmake-188.8.131.52-Darwin64-universal.dmg).
Building MicroMagnum from source
This assumes that the source code is located in the "micromagnum" subdirectory. To build MicroMagnum, enter:
cd micromagnum # enter MicroMagnum base directory cd src/build # enter build directory cmake .. # to compile for CPU make # start the build process sudo make install # installs MicroMagnum as python package # (optional; will not work on Mac OS X)
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
If you did not "sudo make install", set the PYTHONPATH environment variable so the Python interpreter can load the magnum module, e.g.
This needs to be done each time you use MicroMagnum.
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.
You can run a test problem by typing:
cd <magnum-basedir>/magnum/examples/sp4 # With CPU ./sp4.py # With GPU (if enabled at compile time) ./sp4.py -g0