Skip to content

Commit

Permalink
fix: Update setup scripts in top level directory and in
Browse files Browse the repository at this point in the history
cloud-microphysics subdir.
  • Loading branch information
ktras committed Jan 16, 2024
1 parent 2a12de7 commit 6c118aa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
16 changes: 6 additions & 10 deletions cloud-microphysics/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ if ! command -v brew > /dev/null ; then
fi
fi


brew tap fortran-lang/fortran # required for building fpm
brew install fortran-lang/fortran/fpm netcdf netcdf-fortran pkg-config coreutils # coreutils supports `realpath` below

Expand Down Expand Up @@ -120,19 +119,16 @@ if [ $CI = true ]; then
echo "---------------"
fi

if command -v fpm > /dev/null 2>&1; then
brew tap fortran-lang/fortran
brew install fortran-lang/fortran/fpm
fi

echo "$RUN_FPM_SH test"
$RUN_FPM_SH test

echo ""
echo "____________________ cloud-microphysics has been set up! _______________________"
echo ""
echo "To run one of the programs in the example subdirectory, enter a command of the"
echo "following form at a shell command prompt after replacing <example-base-name>"
echo "with the base name of a file in the example/ subdirectory:"
echo "Usage:"
echo ""
echo "./build/run-fpm.sh run train-cloud-microphysics -- \ "
echo " --base <string> --epochs <integer> \ "
echo " [--start <integer>] [--end <integer>] [--stride <integer>]"
echo ""
echo "./build/run-fpm.sh run train-cloud-microphysics"
echo "where angular brackets denote user-provided values and square brackets denote optional arguments"
42 changes: 25 additions & 17 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,40 @@ done

set -u # error on use of undefined variable

if ! command -v brew > /dev/null ; then
if ! command -v curl > /dev/null ; then
echo "Please install curl and then rerun ./setup.sh"
exit 1
fi
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [ $(uname) = "Linux" ]; then
if [ -z "$PATH" ]; then
PATH=/home/linuxbrew/.linuxbrew/bin/
else
PATH=/home/linuxbrew/.linuxbrew/bin/:"$PATH"
if ! command -v gfortran > /dev/null ; then
echo "This script assumes usage of gfortran to compile and build"
echo "When using other Fortran compilers, please ensure you have fpm downloaded and in your path"
echo "Then use the following command to install inference-engine: fpm build --flag \"-fcoarray=single\"."
echo "Please replace the coarray flag with appropriate coarray flag for your compiler"
exit 1
fi

if ! command -v fpm > /dev/null ; then
if ! command -v brew > /dev/null ; then
if ! command -v curl > /dev/null ; then
echo "Please install curl and then rerun ./setup.sh"
exit 1
fi
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [ $(uname) = "Linux" ]; then
if [ -z "$PATH" ]; then
PATH=/home/linuxbrew/.linuxbrew/bin/
else
PATH=/home/linuxbrew/.linuxbrew/bin/:"$PATH"
fi
fi
fi
brew tap fortran-lang/fortran # required for building fpm
brew install fortran-lang/fortran/fpm
fi


brew tap fortran-lang/fortran # required for building fpm
brew install fortran-lang/fortran/fpm

FPM_FLAG="-fcoarray=single -O3"
FPM_FC=${FC:-"gfortran-13"}
FPM_CC=${CC:-"gcc-13"}

mkdir -p build

fpm build --flag ${FPM_FLAG}
fpm build --flag "-fcoarray=single -O3"
fpm test

echo ""
echo "____________________ Inference-Engine has been set up! _______________________"
Expand Down

0 comments on commit 6c118aa

Please sign in to comment.