\chapter{\textsc{SWIG} python wrapper}
\index{SWIG@\textsc{SWIG}}
\index{PYTHON@python}
A python wrapper has been added to \pastix{} using \textsc{SWIG}.
It gives access to the whole original sequential and distributed
interface.

The \murge{} interface is not available yet for python.

It should be possible to had wrapper to all available \textsc{SWIG}
outputs.

\section{Requirement}

To build the python interface, you need \textsc{SWIG} to generate the
interface and \textsc{MPI4PY} to be abble to use MPI in python.

\section{Building the python wrapper}

\textsc{SWIG} python wrapper requires librairies
compiled with the \texttt{position-independent code} option (\texttt{-fPIC} in
\texttt{gcc}, \texttt{gfortran}, \texttt{icc} or \texttt{ifort}).\\
Thus, \textsc{MPI}, \scotch{} (or \metis{}) and \pastix{} must be
compiled with \texttt{-fPIC}

To compile PaStiX with this option and to compile the python wrapper,
uncomment the corresponding section of the config.in file.

\textbf{NB~}: All used libraries must also be build with the
\texttt{position-independent} option.
 
\section{Example}

An example using \pastix{} in python as been written in
\texttt{example/src/pastix\_python.c}.\\
You can call it by running \texttt{make python} or the command
\texttt{PYTHONPATH=\$(MPI4PY\_LIBDIR):\$(PASTIX\_LIBDIR) python
  example/src/pastix\_python.py}.

