Installation¶
The easiest way to install magpy is using the conda repositories. The only requirement is that you have anaconda or miniconda installed on your system. Alternatively, you can build the C++ and python code from source. You might want to do this if you only want the C++ library or if you would like to access the Intel accelerated code.
Conda¶
Note packages only exist for Linux and Mac OSX.
Go to https://conda.io/miniconda.html and download the Miniconda package manager
Create a new conda environment and install magpy into it:
$ conda create -n <env_name> python=3 $ source activate <env_name> $ conda install -c owlas magpy
Launch python and import magpy
$ python $ >>> import magpy
From source¶
The instructions below will guide you through the process of building the code from source on Linux.
Clone the magpy code
$ git clone https://github.com/owlas/magpy
You’ll need a C++11 compatible compiler (g++>=4.9 recommended)
You will also the LAPACK and BLAS libraries. On Debian systems these can be obtained through the apt repositories
$ apt install liblapacke-dev
Build the magpy C++ library with with your compiler as
<CXX>
$ cd magpy $ make CXX=<CXX> libmoma.so
You can build and run the tests from the same makefile
$ cd magpy $ make CXX=<CXX> run-tests
To build the python interface you’ll need to obtain all the python dependencies in the
environment.yml
file. Install miniconda (see Conda, above)$ conda create env -f environment.yml $ source activate magpy
Once you have all of the dependencies you can install magpy
$ CXX=<CXX> pip install . $ python $ >>> import magpy
From source (Intel compilers)¶
Magpy has been optimised for Intel architectures and you can take advantage of this by taking a few extra steps:
Clone the magpy code
$ git clone https://github.com/owlas/magpy
Ensure you have the Intel compilers in your path (
icc
andicpc
)Tell magpy where to find your MKL files
$ export MKLROOT=/path/to/mkl/install/directory
You will also the LAPACK and BLAS libraries. On Debian systems these can be obtained through the apt repositories
$ apt install liblapacke-dev
Build the magpy C++ library with the intel compilers. The correct build flags should be taken care of for you
$ cd magpy $ make CXX=icpc libmoma.so
You can build and run the tests from the same makefile
$ cd magpy $ make CXX=icpc run-tests
To build the python interface you’ll need to obtain all the python dependencies in the
environment.yml
file. Install miniconda (see Conda, above)$ conda create env -f environment.yml $ source activate magpy
Once you have all of the dependencies you can install magpy
$ cd magpy $ CC=icc CXX=icpc pip install . $ python $ >>> import magpy