|
| 1 | +============================== |
| 2 | +Installation |
| 3 | +============================== |
| 4 | + |
| 5 | +Overview |
| 6 | +-------- |
| 7 | + |
| 8 | +`shmem4py` provides Python bindings for `OpenSHMEM <http://openshmem.org/>`_, hence |
| 9 | +a working OpenSHMEM installation is a prerequisite. |
| 10 | +`Cray OpenSHMEMX <https://cray-openshmemx.readthedocs.io/>`_, |
| 11 | +`Open Source Software Solutions (OSSS) OpenSHMEM <https://github.com/openshmem-org/osss-ucx>`_, |
| 12 | +`Open MPI OpenSHMEM <https://www.open-mpi.org/doc/v3.1/man3/OpenSHMEM.3.php>`_, |
| 13 | +`OSHMPI <https://pmodels.github.io/oshmpi-www/>`_, and |
| 14 | +`Sandia OpenSHMEM <https://github.com/Sandia-OpenSHMEM/SOS>`_ |
| 15 | +are supported at the moment. Generally speaking, ``shmem4py`` will be installed using |
| 16 | +the OpenSHMEM implementation's ``oshcc`` wrapper found in the ``$PATH``. |
| 17 | + |
| 18 | +For detailed installation instructions, please refer to the `Installation <https://shmem4py.readthedocs.io/en/latest/installation.html>`_ |
| 19 | +page in the documentation. |
| 20 | + |
| 21 | +Below, we provide an example of how to install `shmem4py` with OHMPI on Ubuntu and Fedora. |
| 22 | + |
| 23 | +Containers |
| 24 | +---------- |
| 25 | + |
| 26 | +We encourage users to use Docker/Podman containers or follow the steps executed in the |
| 27 | +`Dockerfiles <https://github.com/mpi4py/shmem4py/tree/master/docker>`_. Containers |
| 28 | +based on those files are meant to show minimal configurations for building and running |
| 29 | +`shmem4py` with different OpenSHMEM implementations. Those images are used in GitHub |
| 30 | +Actions CI/CD and we consider them tested configurations. |
| 31 | +Currently, we test with OSSS OpenSHMEM, Open MPI OpenSHMEM, OSHMPI and Sandia OpenSHMEM |
| 32 | +on the latest releases of Fedora and Ubuntu. |
| 33 | + |
| 34 | + |
| 35 | +shmem4py with OSHMPI (Ubuntu) |
| 36 | +----------------------------- |
| 37 | + |
| 38 | +Install necessary prerequisites including MPICH using the package manager:: |
| 39 | + |
| 40 | + sudo apt-get update |
| 41 | + sudo apt-get install git build-essential wget automake libtool mpich python3 python3-pip python-is-python3 |
| 42 | + |
| 43 | + |
| 44 | +Define ``$INSTALL_DIR`` to be used in the following steps, such as:: |
| 45 | + |
| 46 | + export INSTALL_DIR="/home/$(whoami)/shmem" |
| 47 | + |
| 48 | + |
| 49 | +Install OSHMPI:: |
| 50 | + |
| 51 | + mkdir -p $INSTALL_DIR |
| 52 | + cd $INSTALL_DIR |
| 53 | + git clone https://github.com/pmodels/oshmpi --recurse-submodules |
| 54 | + cd oshmpi |
| 55 | + ./autogen.sh |
| 56 | + ./configure CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx --prefix=$INSTALL_DIR/oshmpi/install |
| 57 | + make -j |
| 58 | + make install |
| 59 | + cd .. |
| 60 | + |
| 61 | + |
| 62 | +Update ``$PATH``. It might also be beneficial to add this line in one's ``.bashrc`` file:: |
| 63 | + |
| 64 | + export PATH="${INSTALL_DIR}/oshmpi/install/bin/:${PATH}" |
| 65 | + |
| 66 | + |
| 67 | +Install ``numpy`` and ``cffi`` modules:: |
| 68 | + |
| 69 | + python -m pip install numpy cffi |
| 70 | + |
| 71 | + |
| 72 | +With all the prerequisites in place, we can install ``shmem4py``:: |
| 73 | + |
| 74 | + git clone https://github.com/mpi4py/shmem4py |
| 75 | + cd shmem4py |
| 76 | + python -m pip install . |
| 77 | + |
| 78 | + |
| 79 | +Test if everything works as expected:: |
| 80 | + |
| 81 | + make test-1 |
| 82 | + make test-2 |
| 83 | + |
| 84 | + |
| 85 | +shmem4py with OSHMPI (Fedora) |
| 86 | +----------------------------- |
| 87 | + |
| 88 | +Install necessary prerequisites including MPICH using the package manager:: |
| 89 | + |
| 90 | + sudo dnf update |
| 91 | + sudo dnf install git pkg-config make automake gcc gcc-c++ kernel-devel libtool \ |
| 92 | + lbzip2 hwloc hwloc-devel libevent libevent-devel \ |
| 93 | + python3 python3-devel python3-pip mpich mpich-devel |
| 94 | + |
| 95 | +Define ``$INSTALL_DIR`` to be used in the following steps, such as:: |
| 96 | + |
| 97 | + export INSTALL_DIR="/home/$(whoami)/shmem" |
| 98 | + |
| 99 | + |
| 100 | +Install OSHMPI:: |
| 101 | + |
| 102 | + mkdir -p $INSTALL_DIR |
| 103 | + cd $INSTALL_DIR |
| 104 | + git clone https://github.com/pmodels/oshmpi --recurse-submodules |
| 105 | + cd oshmpi |
| 106 | + ./autogen.sh |
| 107 | + ./configure CC=/usr/lib64/mpich/bin/mpicc CXX=/usr/lib64/mpich/bin/mpicxx --prefix=$INSTALL_DIR/oshmpi/install |
| 108 | + make -j |
| 109 | + make install |
| 110 | + cd .. |
| 111 | + |
| 112 | + |
| 113 | +Update ``$PATH``. It might also be beneficial to add the below line in one's ``.bashrc`` file. |
| 114 | +Alternatively, Fedora's ``mpi/mpich-x86_64`` module can be used instead of adding MPICH to the ``$PATH``. Run:: |
| 115 | + |
| 116 | + export PATH="${INSTALL_DIR}/oshmpi/install/bin/:/usr/lib64/mpich/bin/:${PATH}" |
| 117 | + |
| 118 | +If ``python`` does not exist or points to a Python 2 interpreter, it might be |
| 119 | +necessary to either use ``python3`` instead of ``python`` in the following commands or create a symbolic link:: |
| 120 | + |
| 121 | + ln -s /usr/bin/python3 /usr/bin/python |
| 122 | + |
| 123 | +Install ``numpy`` and ``cffi`` modules:: |
| 124 | + |
| 125 | + python -m pip install numpy cffi |
| 126 | + |
| 127 | + |
| 128 | +With all the prerequisites in place, we can install ``shmem4py``:: |
| 129 | + |
| 130 | + git clone https://github.com/mpi4py/shmem4py |
| 131 | + cd shmem4py |
| 132 | + python -m pip install . |
| 133 | + |
| 134 | + |
| 135 | +Test if everything works as expected:: |
| 136 | + |
| 137 | + make test-1 |
| 138 | + make test-2 |
| 139 | + |
| 140 | +Next steps |
| 141 | +---------- |
| 142 | + |
| 143 | +With the installation complete, you can now proceed to run the `Examples <https://shmem4py.readthedocs.io/en/latest/examples.html>`_ |
| 144 | +and try to base your code on them. |
0 commit comments