-
Notifications
You must be signed in to change notification settings - Fork 27
Installation
To install GRASP you will need at least a Fortran and MPI compiler, and either Make or CMake. For this tutorial, we shall stick to the open-source and freely available gfortran
and open-mpi
compilers.
Before you do anything, make sure everything is up to date with brew update
.
-
Install gfortran with e.g. the Homebrew package manager.
brew install gfortran
Check version with gfortran --version and optionally define an alias as you see fit e.g. withalias gfortran=gfortran-11
in ~/bashrc. -
Install lapack and blas [optional, Mac OS typically comes with its own implementation].
brew install lapack, openblas
-
Before installing OpenMPI, set the following environment variables in e.g. ~/.bashrc to match your gfortran version above
export HOMEBREW_CC=gcc-11 export HOMEBREW_CXX=g++-11 export HOMEBREW_FC=gfortran-11
Then run
source ~/.bashrc
or restart your terminal. -
Install open-mpi (-build-from-source is optional, takes up to an hour to compile).
brew install openmpi --build-from-source
If you have a previous installation of open-mpi with brew, then rebuild and reinstall openmpi and its dependencies from source,
brew reinstall openmpi --build-from-source
-
Define which Fortran compiler/version mpifort should link to in
/usr/local/Cellar/open-mpi/X.X.X/share/openmpi/mpifort-wrapper-data.txt
. Edit the compiler line tocompiler=gfortran-11
.
Note that the code won't compile with gfortran-10 or 11 with the default flags due to some stricter rules concerning rank mismatches.
For Make, as a temporary fix if you're using gfortran-10 or 11 (and only then), using the regular non-cmake build system, append the FC_FLAG variable with this flag (directly in the terminal before making or in a new file Make.user, automatically read by the Makefile):
export FC_FLAGS="$FC_FLAGS -fallow-argument-mismatch"
For CMake you can try to add
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch")
in the CMakeLists.user.