mpi4py / shmem4py

Python bindings for OpenSHMEM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building on a Mac

gonsie opened this issue · comments

I'm moving the conversation from openjournals/joss-reviews#5444 to this thread... which may be useful to others in the future.

I'm using these instructions from @mrogowski:

  brew install gcc autoconf automake libtool mpich
  git clone https://github.com/pmodels/oshmpi --recurse-submodules
  cd oshmpi
  ./autogen.sh
  mkdir build && cd build
  ../configure CC=/opt/homebrew/bin/mpicc CXX=/opt/homebrew/bin/mpicxx --prefix=/Users/XXXXXXXX/SHMEM/install-oshmpi
  make -j
  make install
  export PATH=/Users/XXXXXXXX/SHMEM/install-oshmpi/bin/:$PATH
  export FI_PROVIDER=tcp
  git clone https://github.com/mpi4py/shmem4py/
  cd shmem4py
  python -m pip install .
  cd demo
  mpiexec -n 3 python hello.py
  mpiexec -n 8 python race_winner.py

First error, see #18

Now I'm getting the following error in the pip-install step:

fatal error: 'shmem.h' file not found
      #include <shmem.h>

Note that I'm using clang instead of GCC

I suspect that something went wrong with your PATH. Is oshcc in the PATH?

That was it, thank you.

I'm able to build with pip, and now I'm getting this error when trying to run the demo hello.py:

Abort(1615247) on node 0 (rank 0 in comm 0): Fatal error in MPI_Init_thread: Other MPI error, error stack:
MPIR_Init_thread(159).......: 
MPID_Init(597)..............: 
MPIDI_OFI_mpi_init_hook(674): 
create_vni_context(965).....: OFI EP enable failed (ofi_init.c:965:create_vni_context:No message available on STREAM)
Abort(1615247) on node 0 (rank 0 in comm 0): Fatal error in MPI_Init_thread: Other MPI error, error stack:
MPIR_Init_thread(159).......: 
MPID_Init(597)..............: 
MPIDI_OFI_mpi_init_hook(674): 
create_vni_context(965).....: OFI EP enable failed (ofi_init.c:965:create_vni_context:No message available on STREAM)
Abort(1615247) on node 0 (rank 0 in comm 0): Fatal error in MPI_Init_thread: Other MPI error, error stack:
MPIR_Init_thread(159).......: 
MPID_Init(597)..............: 
MPIDI_OFI_mpi_init_hook(674): 
create_vni_context(965).....: OFI EP enable failed (ofi_init.c:965:create_vni_context:No message available on STREAM)

I had similar issues due to version mismatches between MPICH and libfabric... Can you try to set those before running?

export MPIR_CVAR_OFI_SKIP_IPV6=0
export FI_PROVIDER=tcp

Seems like it's an issue with my local MPI install

Another solution suggests export MPIR_CVAR_OFI_USE_PROVIDER=sockets and/or export FI_PROVIDER=sockets.

The export FI_PROVIDER=tcp was breaking things. now the demos are working! 🎉

For posterity, these are the steps that worked for me:

# mpich previously installed without fortran, thus negating the need to install gcc
 brew install autoconf automake libtool
  git clone https://github.com/pmodels/oshmpi --recurse-submodules
  cd oshmpi
  ./autogen.sh
  mkdir install
  mkdir build && cd build
  ../configure CC=/opt/homebrew/bin/mpicc CXX=/opt/homebrew/bin/mpicxx --prefix=/Users/XXXXXXXX/oshmpi/install/
  make -j
  make install
  export PATH=/Users/XXXXXXXX/oshmpi/install/bin/:$PATH
  git clone https://github.com/mpi4py/shmem4py/
  cd shmem4py
# create a virtual environment if you prefer
  python -m pip install .
  cd demo
  mpiexec -n 3 python hello.py
  mpiexec -n 8 python race_winner.py