questions about building with mpi4py support
Closed this issue ยท 3 comments
Dear Pynamic developers,
I noticed you recently added some Python3 and mpi4py support ๐ and I've been trying to build Pynamic with mpi4py. I saw that you don't have a release yet and this is probably work in progress, so I hope my questions and feedback are appropriate. Some background for this request-- I'm at NERSC and we'd like to use Pynamic to help benchmark Podman on Perlmutter as we did with Shifter on Cori.
I've run into a few snags. The first minor issue is that for Python 3, the python-config file doesn't appear to exist in OpenSUSE or in Ubuntu-- I had to edit the Makefile.mpi4py
to
PYTHON_CONFIG = $(PYTHON_EXE_DIR)/python3-config
The second minor issue is that I had to add -fPIE
to the compiler args as suggested during the Pynamic build, so I adjusted Makefile.mpi4py
.
Once I made these adjustments, my build failed with these errors:
#11 3.493 /opt/pynamic-master/pynamic-pyMPI-2.6a1/mpi4py_main.c:35: undefined reference to `Py_Initialize'
#11 3.493 /usr/bin/ld: /opt/pynamic-master/pynamic-pyMPI-2.6a1/mpi4py_main.c:36: undefined reference to `PyRun_SimpleStringFlags'
#11 3.493 /usr/bin/ld: /opt/pynamic-master/pynamic-pyMPI-2.6a1/mpi4py_main.c:37: undefined reference to `Py_Finalize'
#11 3.493 collect2: error: ld returned 1 exit status
#11 3.495 make: *** [Makefile.mpi4py:41: pynamic-mpi4py] Error 1
Here is the Ubuntu 20.4 container in which I am attempting my build:
FROM docker.io/ubuntu:latest
WORKDIR /opt
#ubuntu 20.04 bugfix
ENV DEBIAN_FRONTEND noninteractive
RUN \
apt-get update && \
apt-get install --yes \
build-essential \
cmake \
gcc \
gfortran \
python3-dev \
python3-pip \
libzmq3-dev \
unzip \
vim \
wget && \
apt-get clean all
#install mpich
ARG mpich=3.3
ARG mpich_prefix=mpich-$mpich
RUN \
wget https://www.mpich.org/static/downloads/$mpich/$mpich_prefix.tar.gz && \
tar xvzf $mpich_prefix.tar.gz && \
cd $mpich_prefix && \
./configure && \
make -j 4 && \
make install && \
make clean && \
cd .. && \
rm -rf $mpich_prefix
RUN /sbin/ldconfig
RUN python3 -m pip install --upgrade pip && \
python3 -m pip install mpi4py
RUN wget https://github.com/LLNL/pynamic/archive/refs/heads/master.zip && \
unzip master.zip && \
cd pynamic-master && \
cd pynamic-pyMPI-2.6a1 && \
sed -i 's/python-config/python3-config/g' Makefile.mpi4py && \
sed -i 's/-Wall/-Wall -fPIE/g' Makefile.mpi4py && \
python3 config_pynamic.py 10 20 -c -e -j 4 --with-mpi4py --with-python=$(which python3) --with-cc=$(which mpicc)
Am I doing anything obviously wrong? I'd appreciate any help or pointers you can provide. If Pynamic+mpi4py is not yet ready, I am happy to switch back to Python 2.7/pyMPI, but I thought I would start here.
Thank you very much,
Laurie
Sorry for the very slow response. The undefined references are functions that should be defined in the python library. Can you attach the full output?
I can add that usually the python library is in the python-devel package, which is separate from the actual python package which installs the python executable.
Hi @lee218llnl
Thank you- sorry, now it's my turn to apologize for the slow reply. My colleague Shane Canon did get the older version of Pynamic working for our benchmarks. You can find more info here: https://github.com/NERSC/sc22-canopie-hpc-benchmarks/tree/main/pynamic
I'll go ahead and close this now.
Thank you,
Laurie