Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >

install on linux
https://sites.google.com/site/rangsiman1993/comp-env/program-install/install-openmpi
brief: download and build
https://edu.itp.phys.ethz.ch/hs12/programming_techniques/openmpi.pdf

The following instructions will help you installing OpenMPI on your machine. It takes about 5-10min.

  1. Create a temporary directory for compiling OpenMPI. You can do this in a terminal by typing
    mkdir $HOME/built/src

  2. Download openmpi-4.1.5.tar.bz2 from http://www.open-mpi.org

  3. Move the openmpi-4.1.5.tar.bz2 to the directory just created:
    mv $HOME/Downloads/openmpi-4.1.5.tar.bz2 $HOME/built/src/

  4. Change to the directory and extract the package using
    cd $HOME/built/src
    tar -jxf openmpi-4.1.5.tar.bz2
    如果是.tar.gz的话
    tar -zxvf openmpi-4.1.5.tar.gz

  5. Go into the source directory
    cd openmpi-4.1.5

  6. Configure, compile and install by executing the following commands
    ./configure –prefix=$HOME/local/openmpi-4.1.5
    make all -j && make install
    This will install OpenMPI in your home directory in the $HOME/local/openmpi-4.1.5/

  7. Remove the temporary directories:
    rm $HOME/built/src/openmpi-4.1.5.tar.bz2
    rm -r $HOME/built/src/openmpi-4.1.5

  8. To use MPI you will have to adapt your PATH and LD_LIBRARY_PATH environment variable:
    echo “export PATH=$PATH:$HOME/local/openmpi-4.1.5/bin” >> $HOME/.bashrc
    echo “export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/local/openmpi-4.1.5/lib” \

    $HOME/.bashrc
    This appends the two lines to your .bashrc file which is executed when starting a terminal session.
    或者vim ~/.bashrc然后添加

export PATH=$PATH:$HOME/local/openmpi-4.1.5/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/local/openmpi-4.1.5/lib
  1. To compile your MPI C++ programs you have to use mpicxx with the same arguments as you would use for g++. To run a program PRG with N MPI processes, you would then use mpirun -np N PRG.

  2. To uninstall OpenMPI just delete the folder opt/openmpi in your home directory and remove the last two lines from the .bashrc file in your home directory.

You can find more information on http://www.open-mpi.org

评论