Skip to content

Commit

Permalink
Merge pull request #14 from natalie-perlin/update_develop
Browse files Browse the repository at this point in the history
  • Loading branch information
natalie-perlin authored Nov 1, 2023
2 parents fa37037 + 1f47d35 commit 6f9e40d
Show file tree
Hide file tree
Showing 30 changed files with 1,555 additions and 138 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ S4 | David Huber

## Contributors

Mark Potts, Steve Lawrence, Ed Hartnett, Guoqing Ge, Raffaele Montuoro, David Huber
Mark Potts, Steve Lawrence, Ed Hartnett, Guoqing Ge, Raffaele Montuoro, David Huber, Natalie Perlin

## Prerequisites:

Expand Down
2 changes: 2 additions & 0 deletions build_stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ build_lib sqlite
build_lib libtiff
build_lib proj
build_lib geos
build_lib openblas

# Also build serial versions of HDF5 and netCDF, if using MODULES
if $MODULES; then
Expand Down Expand Up @@ -262,6 +263,7 @@ build_lib metplus
# UFS 3rd party dependencies

build_lib esmf
build_lib scotch
build_lib fms
build_lib cmakemodules
build_lib esma_cmake
Expand Down
14 changes: 9 additions & 5 deletions config/config_macos_gnu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ LMOD=$(brew --prefix lmod)
source $LMOD/init/profile

# Compiler/MPI combination
export HPC_COMPILER="gnu/11.3.0"
export HPC_MPI="openmpi/4.1.2"
export HPC_PYTHON="python/3.9.13"
export HPC_COMPILER="gnu/12.3.0"
export HPC_MPI="openmpi/4.1.5"
export HPC_PYTHON="python/3.11.6"

# Build options
export USE_SUDO=N
export PKGDIR=pkg
export LOGDIR=log
export OVERWRITE=N
export NTHREADS=8
export NTHREADS=4
export MAKE_CHECK=N
export MAKE_VERBOSE=Y
export MAKE_CLEAN=N
Expand All @@ -24,8 +24,12 @@ export WGET="wget -nv "

#
# gfortran-10 needs the following
export STACK_FFLAGS="-fallow-argument-mismatch -fallow-invalid-boz"
export STACK_FFLAGS="-fallow-argument-mismatch -fallow-invalid-boz -march=native "
export STACK_CFLAGS="-march=native"
export STACK_CXXFLAGS="-march=native"
export STACK_mpi_FFLAGS="-fopenmp"
export STACK_mpi_CFLAGS="-fopenmp"
export STACK_mpi_CXXFLAGS="-fopenmp"

BREW=$(brew --prefix)

Expand Down
2 changes: 2 additions & 0 deletions libs/build_esmf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ compiler=$(echo $HPC_COMPILER | sed 's/\//-/g')
mpi=$(echo $HPC_MPI | sed 's/\//-/g')

COMPILER=$(echo $HPC_COMPILER | cut -d/ -f1)
[[ "$COMPILER" = *"intel"* ]] && COMPILER="intel"
MPI=$(echo $HPC_MPI | cut -d/ -f1)
[[ "$MPI" = *"oneapi-mpi"* ]] && MPI="impi"

host=$(uname -s)
abi64=$(uname -m)
Expand Down
27 changes: 19 additions & 8 deletions libs/build_met.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ set -eux
name="met"
version=${1:-${STACK_met_version}}
release_date=${2:-${STACK_met_release_date}}
install_as=${STACK_met_install_as:-${version}}

# Hyphenated version used for install prefix
compiler=$(echo $HPC_COMPILER | sed 's/\//-/g')
mpi=$(echo $HPC_MPI | sed 's/\//-/g')

[[ ${STACK_met_enable_python:-} =~ [yYtT] ]] && enable_python=YES || enable_python=NO

if $MODULES; then
set +x
source $MODULESHOME/init/bash
module load hpc-$HPC_COMPILER
module load hpc-$HPC_PYTHON
[[ ! -z $mpi ]] && module load hpc-$HPC_MPI
[[ ${STACK_met_enable_python:-} =~ [yYtT] ]] && module load hpc-$HPC_PYTHON
module load gsl
module load bufr
module load zlib
Expand All @@ -29,6 +30,8 @@ if $MODULES; then
set -x

prefix="${PREFIX:-"/opt/modules"}/$compiler/$name/$version"
[[ ! -z $mpi ]] && prefix="${PREFIX:-"/opt/modules"}/$compiler/$mpi/$name/$version"

if [[ -d $prefix ]]; then
if [[ $OVERWRITE =~ [yYtT] ]]; then
echo "WARNING: $prefix EXISTS: OVERWRITING!"
Expand All @@ -44,20 +47,27 @@ else

fi

if [[ ! -z $mpi ]]; then
export FC=$MPI_FC
export CC=$MPI_CC
export CXX=$MPI_CXX
else
export FC=$SERIAL_FC
export CC=$SERIAL_CC
export CXX=$SERIAL_CXX
fi

cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
software=MET-$version
software=$name-$version.$release_date
pkg_name=$name-$version
URL="https://github.com/dtcenter/MET/releases/download/v$version/$software.tar.gz"
[[ -d $software ]] || ( $WGET $URL; tar -xf $software.tar.gz )
[[ -d $pkg_name || -f $software.tar.gz ]] || ( $WGET $URL )
[[ -d $pkg_name ]] || tar -xf $software.tar.gz
[[ ${DOWNLOAD_ONLY} =~ [yYtT] ]] && exit 0

export MET_BASE=$prefix/share/met

export FC=$SERIAL_FC
export CC=$SERIAL_CC
export CXX=$SERIAL_CXX

export F77=$FC
export FFLAGS="${STACK_FFLAGS:-} ${STACK_met_FFLAGS:-}"
export CFLAGS="${STACK_CFLAGS:-} ${STACK_met_CFLAGS:-}"
Expand Down Expand Up @@ -119,5 +129,6 @@ make
$SUDO make install

# generate modulefile from template
$MODULES && update_modules compiler $name $install_as
[[ -z $mpi ]] && modpath=compiler || modpath=mpi
$MODULES && update_modules $modpath $name $version
echo $name $version $URL >> ${HPC_STACK_ROOT}/hpc-stack-contents.log
121 changes: 121 additions & 0 deletions libs/build_met.sh_11.0.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/bin/bash

set -eux

name="met"
version=${1:-${STACK_met_version}}
install_as=${STACK_met_install_as:-${version}}

# Hyphenated version used for install prefix
compiler=$(echo $HPC_COMPILER | sed 's/\//-/g')

[[ ${STACK_met_enable_python:-} =~ [yYtT] ]] && enable_python=YES || enable_python=NO

if $MODULES; then
set +x
source $MODULESHOME/init/bash
module load hpc-$HPC_COMPILER
[[ ${STACK_met_enable_python:-} =~ [yYtT] ]] && module load hpc-$HPC_PYTHON
module load gsl
module load bufr
module load zlib
module load jasper
module try-load libpng
module load g2c
module load hdf5
module load netcdf
module list
set -x

prefix="${PREFIX:-"/opt/modules"}/$compiler/$name/$version"
if [[ -d $prefix ]]; then
if [[ $OVERWRITE =~ [yYtT] ]]; then
echo "WARNING: $prefix EXISTS: OVERWRITING!"
$SUDO rm -rf $prefix
else
echo "WARNING: $prefix EXISTS, SKIPPING"
exit 0
fi
fi
else

prefix=${MET_ROOT:-"/usr/local"}

fi


cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
software=MET-$version
URL="https://github.com/dtcenter/MET/archive/refs/tags/v$version.tar.gz"
[[ -d $software ]] || ( $WGET $URL; tar -xf v$version.tar.gz )
[[ ${DOWNLOAD_ONLY} =~ [yYtT] ]] && exit 0

export MET_BASE=$prefix/share/met

export FC=$SERIAL_FC
export CC=$SERIAL_CC
export CXX=$SERIAL_CXX

export F77=$FC
export FFLAGS="${STACK_FFLAGS:-} ${STACK_met_FFLAGS:-}"
export CFLAGS="${STACK_CFLAGS:-} ${STACK_met_CFLAGS:-}"

export CFLAGS+="-D__64BIT__"
export CXXFLAGS+="-D__64BIT__"

export MET_NETCDF=${NETCDF_ROOT}
export MET_HDF5=${HDF5_ROOT}

bufr_libdir=`find ${bufr_ROOT:-${BUFR_ROOT}} -name libbufr_4.a -exec dirname {} \;`
export MET_BUFRLIB=$bufr_libdir
g2c_libdir=`find ${g2c_ROOT:-${G2C_ROOT}} -name libg2c.a -exec dirname {} \;`
export MET_GRIB2CLIB=$g2c_libdir
export MET_GRIB2CINC=${G2C_ROOT:-${g2c_ROOT}}/include
export MET_GSL=${GSL_ROOT}
export BUFRLIB_NAME=-lbufr_4
export GRIB2CLIB_NAME=-lg2c
jasper_libdir=`find ${JASPER_ROOT} -name libjasper.a -exec dirname {} \;`
export LIB_JASPER=$jasper_libdir

export LIB_LIBPNG=${PNG_LIBRARIES}
export LIB_Z=${ZLIB_ROOT}/lib

if [[ $enable_python =~ [yYtT] ]]; then
export MET_PYTHON=${MET_PYTHON:-`which python3`}

if [[ -z ${MET_PYTHON_CC+x} ]]; then
#export MET_PYTHON_CC=`$MET_PYTHON_CONFIG --cflags`
echo "Set MET_PYTHON_CC to include 'Python.h' usually found through 'python3-config --cflfags'"
exit 1
fi

if [[ -z ${MET_PYTHON_LD+x} ]]; then
#export MET_PYTHON_LD=`$MET_PYTHON_CONFIG --ldflags`
echo "Set MET_PYTHON_LD to to link to libpython found through 'python3-config --ldflags"
exit 1
fi
fi

LDFLAGS2="-L${MET_NETCDF}/lib -L${MET_HDF5}/lib -L${MET_BUFRLIB}"
LDFLAGS3="-L${MET_GRIB2CLIB} -L${MET_GSL}/lib"
LDFLAGS4="-L${LIB_JASPER} -L${MET_HDF5}/lib -L${LIB_LIBPNG} -L${LIB_Z}"

export LDFLAGS="-fPIE ${LDFLAGS2:-} ${LDFLAGS3:-} ${LDFLAGS4:-}"
export LIBS="-lhdf5_hl -lhdf5 -lz -ldl"

[[ -d $software ]] && cd $software || ( echo "$software does not exist, ABORT!"; exit 1 )

cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}/${software}
curr_dir=$(pwd)

extra_flags="--enable-grib2 "
[[ $enable_python =~ [yYtT] ]] && extra_flags+="--enable-python "
./configure --prefix=$prefix BUFRLIB_NAME=${BUFRLIB_NAME} GRIB2CLIB_NAME=${GRIB2CLIB_NAME} ${extra_flags:-}

make
[[ $MAKE_CHECK =~ [yYtT] ]] && make check
$SUDO make install

# generate modulefile from template
$MODULES && update_modules compiler $name $install_as
echo $name $version $URL >> ${HPC_STACK_ROOT}/hpc-stack-contents.log
24 changes: 18 additions & 6 deletions libs/build_metplus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,30 @@ version=${1:-${STACK_metplus_version}}

# Hyphenated version used for install prefix
compiler=$(echo $HPC_COMPILER | sed 's/\//-/g')
mpi=$(echo $HPC_MPI | sed 's/\//-/g')

cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
software="v"$version
pkg_name=METplus-$version
met_version=${1:-${STACK_met_version}}
URL="https://github.com/dtcenter/METplus/archive/$software.tar.gz"
[[ -d $software ]] || ( $WGET $URL; tar -xf $software.tar.gz )
[[ -d $software || -f $software.tar.gz ]] || ( $WGET $URL )
[[ -d $software ]] || tar -xf $software.tar.gz
[[ -d $pkg_name ]] && cd $pkg_name || ( echo "$pkg_name does not exist, ABORT!"; exit 1 )

if $MODULES; then
prefix="${PREFIX:-"/opt/modules"}/$compiler/$name/$version"
met_prefix="${PREFIX:-"/opt/modules"}/$compiler"
source $MODULESHOME/init/bash
module load hpc-$HPC_COMPILER
[[ ! -z $mpi ]] && module load hpc-$HPC_MPI
module try-load met
echo "Using module met version (none if blank) = ${MET_VERSION:-:}"
if [[ -z $mpi ]]; then
prefix="${PREFIX:-"/opt/modules"}/$compiler/$name/$version"
met_prefix=${MET_ROOT:-"${PREFIX:-"/opt/modules"}/$compiler"}
else
prefix="${PREFIX:-"/opt/modules"}/$compiler/$mpi/$name/$version"
met_prefix=${MET_ROOT:-"${PREFIX:-"/opt/modules"}/$compiler/$mpi"}
fi
else
prefix=${MET_ROOT:-"/usr/local"}
met_prefix=$prefix
Expand All @@ -43,12 +55,12 @@ curr_dir=$(pwd)

# Update the path to the MET tools for the users
cd ${curr_dir}/parm/metplus_config
cat metplus_system.conf | \
cat defaults.conf | \
sed "s%MET_INSTALL_DIR = /path/to%MET_INSTALL_DIR = $met_prefix/met/$met_version%g" \
> metplus_system_new.conf
mv metplus_system_new.conf metplus_system.conf


# generate modulefile from template
$MODULES && update_modules compiler $name $version
[[ -z $mpi ]] && modpath=compiler || modpath=mpi
$MODULES && update_modules $modpath $name $version
echo $name $version $URL >> ${HPC_STACK_ROOT}/hpc-stack-contents.log
58 changes: 58 additions & 0 deletions libs/build_metplus.sh_5.0.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

set -eux

name="metplus"
version=${1:-${STACK_metplus_version}}

# Hyphenated version used for install prefix
compiler=$(echo $HPC_COMPILER | sed 's/\//-/g')

cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
software="v"$version
pkg_name=METplus-$version
met_version=${1:-${STACK_met_version}}
URL="https://github.com/dtcenter/METplus/archive/$software.tar.gz"
[[ -d $software ]] || ( $WGET $URL; tar -xf $software.tar.gz )
[[ -d $pkg_name ]] && cd $pkg_name || ( echo "$pkg_name does not exist, ABORT!"; exit 1 )

if $MODULES; then
source $MODULESHOME/init/bash
module load hpc-$HPC_COMPILER
module try-load met
echo "Using module met version (none if blank) = ${MET_VERSION:-:}"
prefix="${PREFIX:-"/opt/modules"}/$compiler/$name/$version"
met_prefix=${MET_ROOT:-"${PREFIX:-"/opt/modules"}/$compiler"}
else
prefix=${MET_ROOT:-"/usr/local"}
met_prefix=$prefix
fi

if [[ -d $prefix ]]; then
if [[ $OVERWRITE =~ [yYtT] ]]; then
echo "WARNING: $prefix EXISTS: OVERWRITING!"
$SUDO rm -rf $prefix
else
echo "WARNING: $prefix EXISTS, SKIPPING"
exit 0
fi
fi

mkdir -p $prefix

# Install is simply copying over the unpacked package to the install location
cp -r ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}/${pkg_name}/* $prefix
cd $prefix
curr_dir=$(pwd)

# Update the path to the MET tools for the users
cd ${curr_dir}/parm/metplus_config
cat defaults.conf | \
sed "s%MET_INSTALL_DIR = /path/to%MET_INSTALL_DIR = $met_prefix/met/$met_version%g" \
> metplus_system_new.conf
mv metplus_system_new.conf metplus_system.conf


# generate modulefile from template
$MODULES && update_modules compiler $name $version
echo $name $version $URL >> ${HPC_STACK_ROOT}/hpc-stack-contents.log
Loading

0 comments on commit 6f9e40d

Please sign in to comment.