Installation of Python bindings on Cray

I have successfully installed preCICE and its python bindings on Ubuntu a couple of times. I now need to do the same on a Cray system. I’m not root on the Cray system, so everything needs to be installed in my $HOME directory. I prefer to use v1.5.2 because that is the version on my development machine. The installation of preCICE went fairly smoothly. I ran into an issue where the PETSc tests failed, so I turned on the PETSC_EXECUTABLE_RUNS flag. I know that the installation of PETSc works fine because I’ve used it many times with other programs. I was also getting some problems with the python actions, so I turned that off. I think that I read somewhere in the docs that, the python actions aren’t required to use the python bindings. My final cmake configuration looked like below.

cmake -DCMAKE_INSTALL_PREFIX=/p/home/mnucci/install/precice/1.5.2 -DCMAKE_BUILD_TYPE=release -DBUILD_SHARED_LIBS=ON -DBOOST_ROOT=$BOOST_ROOT -DEIGEN3_INCLUDE_DIR=/p/home/mnucci/software/eigen-git-mirror-3.3.7 -DPETSC_DIR=$PETSC_DIR -DPETSC_EXECUTABLE_RUNS=YES -DPYTHON=NO /p/home/mnucci/software/precice-1.5.2

The system python on the Cray system doesn’t have numpy or cython, so I use an anaconda distribution of python 3.5 that I installed. The Cray system is using MPICH, but it’s MPI wrappers are CC (for C++) and cc (for C). These wrappers don’t support the -compile-info or -link-info options that are called out in setup.py for the python bindings. To get past this problem I changed check_mpi_implementation in setup.py to always return MPICH. Similarly, I changed determine_mpi_args to return empty lists for mpi_compile_args and mpi_link_args. Since I installed preCICE to my $HOME directory, I followed the instructions in the README and tried the command below to build the bindings, where $PRECICE_DIR points to my installation directory.

python setup.py build_ext --mpicompiler=CC --include-dirs=$PRECICE_DIR/include --library-dirs=$PRECICE_DIR/lib

This resulted in the error below.

running build_ext
#####
calling my_build_ext
using --mpicompiler=CC
adding extension
Compiling /p/home/mnucci/software/precice-1.5.2/src/precice/bindings/python/precice.pyx because it changed.
[1/1] Cythonizing /p/home/mnucci/software/precice-1.5.2/src/precice/bindings/python/precice.pyx
#####
#####
calling my_build
using --mpicompiler=CC
#####
building ‘precice’ extension
creating build
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/p
creating build/temp.linux-x86_64-3.5/p/home
creating build/temp.linux-x86_64-3.5/p/home/mnucci
creating build/temp.linux-x86_64-3.5/p/home/mnucci/software
creating build/temp.linux-x86_64-3.5/p/home/mnucci/software/precice-1.5.2
creating build/temp.linux-x86_64-3.5/p/home/mnucci/software/precice-1.5.2/src
creating build/temp.linux-x86_64-3.5/p/home/mnucci/software/precice-1.5.2/src/precice
creating build/temp.linux-x86_64-3.5/p/home/mnucci/software/precice-1.5.2/src/precice/bindings
creating build/temp.linux-x86_64-3.5/p/home/mnucci/software/precice-1.5.2/src/precice/bindings/python
cc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/p/home/mnucci/install/precice/1.5.2/include -I/p/home/mnucci/software/python/anaconda3/include/python3.5m -c /p/home/mnucci/software/precice-1.5.2/src/precice/bindings/python/precice.cpp -o build/temp.linux-x86_64-3.5/p/home/mnucci/software/precice-1.5.2/src/precice/bindings/python/precice.o -Wall -std=c++11
gcc: error: =: No such file or directory
error: command ‘cc’ failed with exit status 1

This error is especially puzzling since if I try to execute the last command that the build process was running, it works (see below). It prints a warning, but the precice.o file is created. The error message above seems to be complaining about a missing precice.cpp file, but that file is in the directory, and the path given in the -c option is correct.

cc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/p/home/mnucci/install/precice/1.5.2/include -I/p/home/mnucci/software/python/anaconda3/include/python3.5m -c /p/home/mnucci/software/precice-1.5.2/src/precice/bindings/python/precice.cpp -o build/temp.linux-x86_64-3.5/p/home/mnucci/software/precice-1.5.2/src/precice/bindings/python/precice.o -Wall -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++

Do you have any ideas why I am getting this error, or any suggestions for installing the python bindings?

1 Like

Hi!

We do not have a lot of experience with the preCICE python bindings on HPC systems, yet. Additionally, we have not completely figured out how much of MPI is actually required to get the python bindings running for a parallel setup (see https://github.com/precice/python-bindings/issues/12#issuecomment-576753966).

I cannot find any obvious errors in your configuration. Therefore, I would suggest the following: Try to get rid of everything related to MPI within the python bindings. If we are lucky, this works for you. I already prepared a branch. I assume that the setup.py from this branch should also work with v1.5.2. If not, I can help you to get it working for v1.5.2.

Using the python bindings version from the branch the installation and the unit tests work well. I also checked one of the tutorials and it worked, as well. However, due to our limited experience with the python bindings in parallel setups, our tests for parallel cases are also very limited/non-existent.

Feel free to leave a comment in https://github.com/precice/python-bindings/issues/12, since this might help us understand better whether MPI is really relevant for the python bindings.

Best,
Benjamin

I just found a possibly useful resource in our wiki: https://github.com/precice/precice/wiki/Dependencies#installing-the-python-bindings-for-python-2717

edit moved to precice/python-bindings: https://github.com/precice/python-bindings#installing-the-python-bindings-for-python-2717

Many thanks for the helpful links! I attempted to install the no_mpi branch of the python bindings as you suggested. However, I did get some errors that seemed to be related to API changes between v1.5.2 and v2.0.0. Since I saw that v2.0.0 was released today, I decided to give that a try. It installed with the same cmake configuration I used above. I was then able to install the no_mpi branch of the python bindings with the commands below.

python setup.py build_ext --include-dirs=$PRECICE_DIR/include --library-dirs=$PRECICE_DIR/lib64
python setup.py install --user

I then confirmed that I was able to import the precice module in python. I will have to update my application to conform to the v2.0.0 API, but I am optimistic that I will get everything working.

Thanks again!

1 Like

In case you haven’t seen it yet: We created a guide on how to update adapters / applications.