diff --git a/build.sh b/build.sh index e4d061ce3e7d4e6589577ca6fd071abf3394a69c..90f1126c5c647f912d3f52fc8d1874c17451b8cb 100755 --- a/build.sh +++ b/build.sh @@ -39,9 +39,11 @@ cd "$1/openfpm_io" #rm -rf $HOME/openfpm_dependencies/openfpm_io/$branch/HDF5 #rm -rf $HOME/openfpm_dependencies/openfpm_io/$branch/BOOST +rm -rf $HOME/openfpm_dependencies/openfpm_io/$branch/ + if [ x"$hostname" == x"cifarm-centos-node.mpi-cbg.de" ]; then source /opt/rh/devtoolset-7/enable - ./install_MPI_mpich.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 + ./install_MPI.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 export PATH="$HOME/openfpm_dependencies/openfpm_io/$branch/MPI/bin/:$PATH" ./install_BOOST.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 ./install_HDF5.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 @@ -50,7 +52,7 @@ if [ x"$hostname" == x"cifarm-centos-node.mpi-cbg.de" ]; then fi if [ x"$hostname" == x"cifarm-ubuntu-node" ]; then - ./install_MPI_mpich.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 + ./install_MPI.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 export PATH="/opt/bin:$HOME/openfpm_dependencies/openfpm_io/$branch/MPI/bin/:$PATH" ./install_BOOST.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 ./install_HDF5.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 @@ -60,7 +62,7 @@ fi if [ x"$hostname" == x"cifarm-mac-node.mpi-cbg.de" ]; then export PATH="/usr/local/bin:$PATH" - ./install_MPI_mpich.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 + ./install_MPI.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 export PATH="$HOME/openfpm_dependencies/openfpm_io/$branch/MPI/bin/:$PATH" ./install_BOOST.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 ./install_HDF5.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4 diff --git a/install_MPI.sh b/install_MPI.sh new file mode 100755 index 0000000000000000000000000000000000000000..66fa52740360c63d247543d9664dc41d8006b642 --- /dev/null +++ b/install_MPI.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# check if the directory $1/MPI exist + +if [ -d "$1/MPI" ]; then + echo "MPI already installed" + exit 0 +fi + +./script/download_MPI.sh +cd openmpi-4.1.1 + +if [ -f ../mpi_add_options ]; then + mpi_options=$(cat ../mpi_add_options) + echo "Adding MPI options: $mpi_options" +fi + +if [ x"$3" == x"1" ]; then + echo "Installing MPI with GPU support" + + # Detect where is nvcc + cuda_location=$(dirname $(dirname $(which nvcc)) ) + + ./configure --with-hwloc=internal --with-libevent=internal $mpi_options --with-cuda=$cuda_location --prefix=$1/MPI --enable-mpi-fortran=yes CC=$4 CXX=$5 F77=$6 FC=$7 $8 +else + echo "Installing MPI without GPU support" + ./configure --with-hwloc=internal --with-libevent=internal $mpi_options --prefix=$1/MPI --enable-mpi-fortran=yes CC=$4 CXX=$5 F77=$6 FC=$7 $8 +fi +make -j $2 +make install + +# Mark the installation +echo 10 > $1/MPI/version +