Hoppa till huvudinnehållet
Till KTH:s startsida Till KTH:s startsida

Tips on running parallel python programs on PDC

This applies to python programs which make use of mpi4py and Cythonized extensions for dependent packages such as FFTW3.


In Beskow, the differences are:
- MPI: cray-mpich: 
customized package derived from MPICH2 standard. It provides wrappers like cc and aprun to compile and run respectively.

- Non standard FFTW locations:
Not mentioned in /sbin/ldconfig. To be located via $FFTW_DIR and $FFTW_INC commands.

- anaconda/py27/2.3 :
No virtualenv command available.
Installing virtualenv with anaconda is a tricky procedure. I followed:
http://people.kth.se/~michs/notes/customising-the-anaconda-environment-on-beskow.html
Most of the packages are available through conda command. If not resort to pip.
For eg., in anaconda pyfftw is a user maintained package. It installs fftw along with it.


$ conda install -c https://conda.anaconda.org/richli pyfftw

pyfftw installed through pip could not access the custom FFTW locations, even after playing with CFLAGS and LDFLAGS and LD_LIBRARY_PATH env variables.
subprocess32 could be installed using pip, another user maintained repo in anaconda.
mpi4py in anaconda installs its own version of mpich as a dependency. Instead I used:

$ MPICC=cc pip install mpi4py

- Deploying your python project in development mode
You can create a Makefile with the following text, so that your Cython extensions are built using the cc wrapper and not the default gcc or icc compiler command.
develop:
        CC="cc"   \
        LDSHARED="cc -shared" \
        python setup.py develop

Alternatively one could have used something like:
develop:
        CC="cc"   \
        CFLAGS="-I/path/to/include"  \
        LDFLAGS="-L/path/to/lib"    \
        LDSHARED="cc -shared" \
        python setup.py develop

to include more shared libraries and header files while building the Cython extensions.


Profilbild av Ashwin Vishnu Mohanan

Portfolio