install_MPI.sh 784 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
i-bird's avatar
i-bird committed
11
cd openmpi-4.0.4
12

incardon's avatar
Fixing  
incardon committed
13 14
if [ -f ../mpi_add_options ]; then
	mpi_options=$(cat ../mpi_add_options)
incardon's avatar
incardon committed
15
	echo "Adding MPI options: $mpi_options"
incardon's avatar
incardon committed
16 17
fi

incardon's avatar
incardon committed
18
if [ x"$3" == x"1" ]; then
incardon's avatar
incardon committed
19
   echo "Installing MPI with GPU support"
incardon's avatar
incardon committed
20 21 22 23

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

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

# Mark the installation
i-bird's avatar
i-bird committed
33
echo 8 > $1/MPI/version
Pietro Incardona's avatar
Pietro Incardona committed
34