Created
June 16, 2017 20:21
-
-
Save zbeekman/56ef0c3ca4e98831d31839e8524bec9b to your computer and use it in GitHub Desktop.
A script that will automatically install OpenCoarrays using Homebrew. MPICH and OpenCoarrays will be compiled and installed with GCC-7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o nounset | |
set -o pipefail | |
set -o errexit | |
set -o errtrace | |
msg="Press Ctrl-C to abort, or enter to continue" | |
echo "Tapping homebrew-bundle" | |
read -rp "${msg}" | |
brew tap homebrew/bundle | |
echo "Writing Brewfile for use with \`brew bundle\`" | |
read -rp "${msg}" | |
cat <<-EOF > Brewfile | |
brew 'cmake' | |
brew 'gcc' | |
brew 'mpich', args: ['cc=gcc-7'] | |
brew 'opencoarrays', args: ['cc=gcc-7'] | |
EOF | |
echo "Uninstalling OpenCoarrays and MPICH if installed with Homebrew, unlinking openmpi if installed" | |
read -rp "${msg}" | |
brew uninstall opencoarrays || true | |
brew uninstall mpich || true | |
brew unlink openmpi || true | |
echo "Using \`brew bundle\` and previously written Brewfile to install OpenCoarrays and" | |
echo "MPICH using the latest GCC-7.x. GCC and CMake will also be installed or upgraded." | |
read -rp "${msg}" | |
brew bundle --verbose --file=./Brewfile | |
while true; do | |
read -rp "Update your global Brewfile, \`${HOME}/.Brewfile\`? (Recommended)" yn | |
case $yn in | |
[Yy]* ) cat ./Brewfile >> "${HOME}/.Brewfile"; break;; | |
[Nn]* ) exit;; | |
* ) echo "Please answer yes or no.";; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script will install MPICH built with GCC 7.x and the OpenCoarrays linked against MPICH and also built with GCC 7.x. OpenMPI will be unlinked, and previous installations of OpenCoarrays and MPICH will be removed. Here is a one liner you can use on MacOS to download and execute the script:
/usr/bin/env bash <(curl -fsSL https://gist.githubusercontent.com/zbeekman/56ef0c3ca4e98831d31839e8524bec9b/raw/f9256cecc20044ceaae163abb7bb4672cc431e49/brew-install-opencoarrays.sh)
I'll try to remember to update the SHA if I edit the script, but no guarantees; you should make sure you check it against the link to the raw version of this gist.