install_MPI.sh 639 Bytes
Newer Older
1
#!/bin/bash
incardon's avatar
incardon committed
2

incardon's avatar
incardon committed
3
# check if the directory $1/MPI exist
incardon's avatar
incardon committed
4

incardon's avatar
incardon committed
5 6 7 8 9
if [ -d "$1/MPI" ]; then
  echo "MPI already installed"
  exit 0
fi

incardon's avatar
incardon committed
10
./script/download_MPI.sh
incardon's avatar
incardon committed
11
cd openmpi-4.0.2
12

incardon's avatar
incardon committed
13
if [ x"$3" == x"1" ]; then
14
   echo "Installing MPI with GPU support"
15 16 17 18 19

   # Detect where is nvcc
   cuda_location=$(dirname $(dirname $(which nvcc)) )

   ./configure --with-cuda=$cuda_location --prefix=$1/MPI --enable-mpi-fortran=yes CC=$4 CXX=$5 F77=$6 FC=$7 $8
20
else
21
   echo "Installing MPI without GPU support"
22
   ./configure --prefix=$1/MPI --enable-mpi-fortran=yes CC=$4 CXX=$5 F77=$6 FC=$7 $8
23
fi
incardon's avatar
incardon committed
24
make -j $2
incardon's avatar
incardon committed
25
make install
Pietro Incardona's avatar
Pietro Incardona committed
26 27

# Mark the installation
incardon's avatar
incardon committed
28
echo 5 > $1/MPI/version
Pietro Incardona's avatar
Pietro Incardona committed
29