Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions build_stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ build_lib atlas

build_lib esmf
build_lib fms
build_lib cmakemodules
build_lib esma_cmake
build_lib gftl_shared
build_lib yafyaml
build_lib mapl

# ==============================================================================
# optionally clean up
Expand Down
40 changes: 40 additions & 0 deletions libs/build_cmakemodules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

set -eux

name="cmakemodules"
repo="NOAA-EMC"
version=${2:-${STACK_cmakemodules_version:-"develop"}}
id=${version//\//-}

if $MODULES; then
set +x
source $MODULESHOME/init/bash
module list
set -x

prefix="${PREFIX:-"/opt/modules"}/core/$name/$id"
if [[ -d $prefix ]]; then
[[ $OVERWRITE =~ [yYtT] ]] && ( echo "WARNING: $prefix EXISTS: OVERWRITING!"; $SUDO rm -rf $prefix; $SUDO mkdir $prefix ) \
|| ( echo "WARNING: $prefix EXISTS, SKIPPING"; exit 1 )
fi
else
prefix=${CMAKEMODULES_ROOT:-"/usr/local"}
fi

software=$name-$id
cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
URL="https://github.com/$repo/$name.git"
[[ -d $software ]] || git clone $URL $software
[[ -d $software ]] && cd $software || ( echo "$software does not exist, ABORT!"; exit 1 )

git fetch --tags
git checkout $version
[[ ${DOWNLOAD_ONLY} =~ [yYtT] ]] && exit 0

cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
mkdir -p $prefix && cp -r $software/* $prefix

# generate modulefile from template
$MODULES && update_modules core $name $id
echo $name $id $URL >> ${HPC_STACK_ROOT}/hpc-stack-contents.log
40 changes: 40 additions & 0 deletions libs/build_esma_cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

set -eux

name="esma_cmake"
repo="GEOS-ESM"
version=${2:-${STACK_esma_cmake_version:-"main"}}
id=${version//\//-}

if $MODULES; then
set +x
source $MODULESHOME/init/bash
module list
set -x

prefix="${PREFIX:-"/opt/modules"}/core/$name/$id"
if [[ -d $prefix ]]; then
[[ $OVERWRITE =~ [yYtT] ]] && ( echo "WARNING: $prefix EXISTS: OVERWRITING!"; $SUDO rm -rf $prefix; $SUDO mkdir $prefix ) \
|| ( echo "WARNING: $prefix EXISTS, SKIPPING"; exit 1 )
fi
else
prefix=${ESMA_CMAKE_ROOT:-"/usr/local"}
fi

software=$name-$id
cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
URL="https://github.com/$repo/$name.git"
[[ -d $software ]] || git clone $URL $software
[[ -d $software ]] && cd $software || ( echo "$software does not exist, ABORT!"; exit 1 )

git fetch --tags
git checkout $version
[[ ${DOWNLOAD_ONLY} =~ [yYtT] ]] && exit 0

cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
mkdir -p $prefix && cp -r $software/* $prefix

# generate modulefile from template
$MODULES && update_modules core $name $id
echo $name $id $URL >> ${HPC_STACK_ROOT}/hpc-stack-contents.log
47 changes: 47 additions & 0 deletions libs/build_gftl_shared.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

set -eux

name="gftl-shared"
repo="Goddard-Fortran-Ecosystem"
version=${2:-${STACK_gftl_shared_version:-"main"}}

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

if $MODULES; then
set +x
source $MODULESHOME/init/bash
module load hpc-$HPC_COMPILER
module try-load cmake
module list
set -x

prefix="${PREFIX:-"/opt/modules"}/$compiler/$name/$id"
if [[ -d $prefix ]]; then
[[ $OVERWRITE =~ [yYtT] ]] && ( echo "WARNING: $prefix EXISTS: OVERWRITING!"; $SUDO rm -rf $prefix; $SUDO mkdir $prefix ) \
|| ( echo "WARNING: $prefix EXISTS, SKIPPING"; exit 1 )
fi
else
prefix=${GFTL_SHARED_ROOT:-"/usr/local"}
fi

software=$name-$id
cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
URL="https://github.com/$repo/$name.git"
[[ -d $software ]] || git clone $URL $software
[[ -d $software ]] && cd $software || ( echo "$software does not exist, ABORT!"; exit 1 )

git fetch --tags
git checkout $version
[[ ${DOWNLOAD_ONLY} =~ [yYtT] ]] && exit 0

[[ -d build ]] && $SUDO rm -rf build
mkdir -p build && cd build
cmake -DCMAKE_INSTALL_PREFIX=$prefix ..
VERBOSE=$MAKE_VERBOSE make -j${NTHREADS:-4} install

# generate modulefile from template
$MODULES && update_modules compiler $name $id
echo $name $URL >> ${HPC_STACK_ROOT}/hpc-stack-contents.log
78 changes: 78 additions & 0 deletions libs/build_mapl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash

set -eux

name="mapl"
repo="GEOS-ESM"
version=${2:-${STACK_mapl_version:-"main"}}

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

if $MODULES; then
set +x
source $MODULESHOME/init/bash
module load hpc-$HPC_COMPILER
module load hpc-$HPC_MPI
module load hpc-$HPC_PYTHON
module try-load cmake
module load esma_cmake
module load cmakemodules
module load ecbuild
# module exports ecbuild_ROOT, but when building without modules ECBUILD_ROOT is set
export ECBUILD_ROOT=$ecbuild_ROOT
module load gftl-shared
module load yafyaml
module load netcdf
module load esmf
module list

set -x

prefix="${PREFIX:-"/opt/modules"}/$compiler/$mpi/$name/$id"
if [[ -d $prefix ]]; then
[[ $OVERWRITE =~ [yYtT] ]] && ( echo "WARNING: $prefix EXISTS: OVERWRITING!"; $SUDO rm -rf $prefix; $SUDO mkdir $prefix ) \
|| ( echo "WARNING: $prefix EXISTS, SKIPPING"; exit 1 )
fi
else
prefix=${MAPL_ROOT:-"/usr/local"}
export ESMFMKFILE=$ESMF_ROOT/lib/esmf.mk
fi

export FC=$MPI_FC
export CC=$MPI_CC
export CXX=$MPI_CXX

software=$name-$id
cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
URL="https://github.com/$repo/$name.git"
[[ -d $software ]] || git clone $URL $software
[[ -d $software ]] && cd $software || ( echo "$software does not exist, ABORT!"; exit 1 )

git fetch --tags
git checkout $version
[[ ${DOWNLOAD_ONLY} =~ [yYtT] ]] && exit 0

[[ -d build ]] && $SUDO rm -rf build
mkdir -p build && cd build

CMAKE_OPTS=${STACK_mapl_cmake_opts:-""}

cmake .. \
-DCMAKE_INSTALL_PREFIX=$prefix \
-DCMAKE_MODULE_PATH="${ESMA_CMAKE_ROOT};${CMAKEMODULES_ROOT}/Modules;${ECBUILD_ROOT}/share/ecbuild/cmake" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_WITH_FLAP=OFF \
-DBUILD_WITH_PFLOGGER=OFF \
-DESMA_USE_GFE_NAMESPACE=ON \
-DBUILD_SHARED_MAPL=OFF \
${CMAKE_OPTS}

VERBOSE=$MAKE_VERBOSE make -j${NTHREADS:-4} install

# generate modulefile from template
modpath=mpi
$MODULES && update_modules $modpath $name $id
echo $name $id $URL >> ${HPC_STACK_ROOT}/hpc-stack-contents.log
48 changes: 48 additions & 0 deletions libs/build_yafyaml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

set -eux

name="yafyaml"
repo="Goddard-Fortran-Ecosystem"
version=${2:-${STACK_yafyaml_version:-"main"}}

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

if $MODULES; then
set +x
source $MODULESHOME/init/bash
module load hpc-$HPC_COMPILER
module try-load cmake
module load gftl-shared
module list
set -x

prefix="${PREFIX:-"/opt/modules"}/$compiler/$name/$id"
if [[ -d $prefix ]]; then
[[ $OVERWRITE =~ [yYtT] ]] && ( echo "WARNING: $prefix EXISTS: OVERWRITING!"; $SUDO rm -rf $prefix; $SUDO mkdir $prefix ) \
|| ( echo "WARNING: $prefix EXISTS, SKIPPING"; exit 1 )
fi
else
prefix=${YAFYAML_ROOT:-"/usr/local"}
fi

software=$name-$id
cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
URL="https://github.com/$repo/$name.git"
[[ -d $software ]] || git clone $URL $software
[[ -d $software ]] && cd $software || ( echo "$software does not exist, ABORT!"; exit 1 )

git fetch --tags
git checkout $version
[[ ${DOWNLOAD_ONLY} =~ [yYtT] ]] && exit 0

[[ -d build ]] && $SUDO rm -rf build
mkdir -p build && cd build
cmake -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH ..
VERBOSE=$MAKE_VERBOSE make -j${NTHREADS:-4} install

# generate modulefile from template
$MODULES && update_modules compiler $name $id
echo $name $id $URL >> ${HPC_STACK_ROOT}/hpc-stack-contents.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
help([[
]])

local pkgName = myModuleName()
local pkgVersion = myModuleVersion()
local pkgNameVer = myModuleFullName()

local hierA = hierarchyA(pkgNameVer,1)
local compNameVer = hierA[1]
local compNameVerD = compNameVer:gsub("/","-")

conflict(pkgName)

local opt = os.getenv("HPC_OPT") or os.getenv("OPT") or "/opt/modules"

local base = pathJoin(opt,compNameVerD,pkgName,pkgVersion)

setenv("GFTL_SHARED_ROOT", base)
setenv("GFTL_ROOT", base)

whatis("Name: ".. pkgName)
whatis("Version: " .. pkgVersion)
whatis("Category: library")
whatis("Description: gFTL-shared provides common gFTL containers of Fortran intrinsic types")
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
help([[
]])

local pkgName = myModuleName()
local pkgVersion = myModuleVersion()
local pkgNameVer = myModuleFullName()

local hierA = hierarchyA(pkgNameVer,1)
local compNameVer = hierA[1]
local compNameVerD = compNameVer:gsub("/","-")

conflict(pkgName)

local opt = os.getenv("HPC_OPT") or os.getenv("OPT") or "/opt/modules"

local base = pathJoin(opt,compNameVerD,pkgName,pkgVersion)

setenv("YAFYAML_ROOT", base)

whatis("Name: ".. pkgName)
whatis("Version: " .. pkgVersion)
whatis("Category: library")
whatis("Description: yet another Fortran (implementation of) YAML")
19 changes: 19 additions & 0 deletions modulefiles/core/cmakemodules/cmakemodules.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
help([[
]])

local pkgName = myModuleName()
local pkgVersion = myModuleVersion()
local pkgNameVer = myModuleFullName()

conflict(pkgName)

local opt = os.getenv("HPC_OPT") or os.getenv("OPT") or "/opt/modules"

local base = pathJoin(opt,"core",pkgName,pkgVersion)

setenv("CMAKEMODULES_ROOT", base)

whatis("Name: ".. pkgName)
whatis("Version: " .. pkgVersion)
whatis("Category: Software")
whatis("Description: CMakeModules (A collection of CMake modules)")
19 changes: 19 additions & 0 deletions modulefiles/core/esma_cmake/esma_cmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
help([[
]])

local pkgName = myModuleName()
local pkgVersion = myModuleVersion()
local pkgNameVer = myModuleFullName()

conflict(pkgName)

local opt = os.getenv("HPC_OPT") or os.getenv("OPT") or "/opt/modules"

local base = pathJoin(opt,"core",pkgName,pkgVersion)

setenv("ESMA_CMAKE_ROOT", base)

whatis("Name: ".. pkgName)
whatis("Version: " .. pkgVersion)
whatis("Category: Software")
whatis("Description: ESMA (NASA GEOS CMake configuration files)")
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
help([[
]])

local pkgName = myModuleName()
local pkgVersion = myModuleVersion()
local pkgNameVer = myModuleFullName()

local hierA = hierarchyA(pkgNameVer,2)
local mpiNameVer = hierA[1]
local compNameVer = hierA[2]
local mpiNameVerD = mpiNameVer:gsub("/","-")
local compNameVerD = compNameVer:gsub("/","-")

conflict(pkgName)

local opt = os.getenv("HPC_OPT") or os.getenv("OPT") or "/opt/modules"

local base = pathJoin(opt,compNameVerD,mpiNameVerD,pkgName,pkgVersion)

setenv("MAPL_ROOT", base)

whatis("Name: ".. pkgName)
whatis("Version: " .. pkgVersion)
whatis("Category: library")
whatis("Description: MAPL is a foundation layer of the GEOS architecture")
Loading