Home‎ > ‎How To's‎ > ‎


Precompiled binaries

Precompiled binaries are not available.

Building Warp

Warp can be built and installed on Linux and Mac OSX. It is not supported on Windows. Several packages are needed to install and run Warp. Below are instructions on how to install the various packages. This assumes that Python is already installed. Note that depending on where Python is installed, root privilege may be needed to install the packages. On Mac OSX, XCode and it's development package need to be installed, as well as XQuartz. Warp is compatible with Python versions 2 and 3. (Note that only the serial version is compatible with Python3.)

If you do not have root privileges, all of the packages can be installed in your home directory by adding the "--user" option when installing, i.e. using the command "python setup.py install --user". For how to do this with Warp, see the comments below. Note that with --user, there is no need to set PYTHONPATH.

On OSX, a recommended method of installation is to use the Python installed under HomeBrew, http://brew.sh. This offers a number of advantages, including not needing sudo, the Python includes pip for easy package installation, and allows easy install of gfortran (as part of the gcc package), openmpi, and git among other things. After installing brew, you will need to do the following (gcc includes gfortran and openmpi is only needed for running in parallel).

brew install python
brew install gcc
brew install openmpi

One can also do "brew install python3" as an alternate version of python.


Numpy is the numerics package for python. On most variants of Linux, this can be installed using the package manager, such as yum. It is pre-installed in the built in version of Python on Mac OSX. It can also be installed using the Python package managers, pip or easy_install. For example,

pip install numpy


Forthon provides the glue linking Fortran and python. It must be installed first before Warp can be built. It can be installed using pip:

pip install Forthon

Alternatively, it can be downloaded using git, "git clone https://github.com/dpgrote/Forthon.git". After downloading it, cd into the Forthon directory and run "python setup.py install", using the same Python that will be used with Warp.


Warp can be downloaded from bitbucket, https://bitbucket.org/berkeleylab/warp/downloads. Download and extract the tar ball from the most recent release (not the "Download repository" link). It is very likely that an update will be necessary. This can be done using git - cd into the warp directory created from the tar ball and run the following command:

git pull

This will connect to the Warp repository and download any updates that were not included in the tar file.

Inside of the warp directory will be pywarp90 which contains the Fortran source and scripts which contains the Python source. The installation is done in the pywarp90 directory.


The fortran backend of Warp is called pywarp90, which can be compiled for single- or multi-processor support. The compilation requires a fortran compiler - the recommended one is gfortran. The following will build the serial, single processor, version and install Warp into Python's site-packages directory, including the Warp scripts.

make install

Or similarly when using Python3:

make install3

If a modification of the make process is needed, create a file call Makefile.local (or Makefile.local3) and put the modifications there instead of changing Makefile.Forthon. For example, putting this line in Makefile.local will will set it so that Warp is installed in your home directory.


Parallel Warp

If you want to install the parallel version of Warp that uses MPI to support multiple CPUs you need to tell Warp where to find the necessary libraries (and have those installed), or specify an MPI aware compiler. The information should be put into a file called Makefile.local.pympi. To specify the libraries, set FARGS to point to the installation of MPI, for example:

 FARGS = --farg "-DMPIPARALLEL -I/usr/lib64/mpi/gcc/openmpi/include -L/usr/lib64/mpi/gcc/openmpi/lib64/"

and also create a file setup.local.py to add the include and library paths, by changing library_dirs. For example:

if parallel:
  library_dirs += ['/usr/lib64/mpi/gcc/openmpi/lib64/']
  libraries += ['mpi','mpi_f77']

Alternatively, to specify an MPI aware compiler, set FCOMP in Makefile.local.pympi. For example:

FCOMP = -F gfortran --fcompexec mpif90

After this you can compile and install the parallel version by using

make pinstall

This will build and install the warpCparallel.so file (as well as the scripts).

You will also need a python interface to MPI. Warp has traditionally been used with pyMPI, but will also work with mpi4py. (Warp with python3 only works with mpi4py.) pyMPI can be obtained from git at NERSC. (The sourceforge version will not work with Warp.)

git clone http://portal.nersc.gov/project/warp/git/pyMPI.git

To build, run the following commands, modifying the installation path as appropriate.

./configure --prefix=/place/to/install
make install

Both version of Warp can be installed on the same system at the same time from the same directory. The two directories build and buildparallel are created for the temporary compiler intermediate files.


These are the python modules that make up Warp. They would normally be installed when doing the install in the pywarp90 directory. If needed, they can be installed separately by running "python setup.py install" in the scripts directory.

updating an existing warp installation

Any updates to Warp can be downloaded using git. The following will update both the serial and the parallel versions (starting in the top directory of warp):

git pull
cd pywarp90
# serial
make install
# parallel
make pinstall


pygist is the plotting package that Warp uses. Note that while there are other available versions, they will likely not work with Warp, since some special coding is needed. Use the pygist that can be obtained from https://bitbucket.org/dpgrote/pygist. It can be downloaded using git, "git clone https://bitbucket.org/dpgrote/pygist.git".

For installation, the X11 header files need to be installed, for example by installing the X11 devel package under Linux.
This will install the python interface as well as the cgm file viewer, gist:

cd pygist
python setup.py config
python setup.py install

Opyndx (optional)

Opyndx is an optional package that provides 3-D visualization tools for Warp. It requires that the OpenDX libraries be installed. Opyndx can be obtained from git.

git clone http://portal.nersc.gov/project/warp/git/Opyndx.git

It is built with the usual installation method for Python packages. Note that the setup.py file may need to be edited in order to specify the location of the OpenDX installation.

python setup.py install

Posinst (optional)

Posinst provides routines for handling secondary emission of electrons from impact on surfaces, developed for electron-cloud physics. The source can be obtained by special request. There are several ways to build posinst. For Warp related usage, the following will compile the code and install it into the usual location for python modules.

make installpy

SciPy (optional)

SciPy is a full fledged scientific numeric package, which contains many useful tools. For Warp, it is only need for optional beam matching scripts.  It can be installed using the pip python manager:

pip install scipy

Testing Warp

After Warp is installed, there are test scripts that can be used to verify that it is functioning properly. Go into the directory warp/warp_tests and run the following command:

python runalltests.py

This will run the tests - it's output will be a list of each test as it runs, hopefully saying "OK". If there are any problems, there will be output showing the test that failed and the error. It shouldn't take more than a minute or so to run the tests.