Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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=${1:-${STACK_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/$repo-$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-$repo-$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 $repo-$id
echo $name $repo-$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=${1:-${STACK_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/$repo-$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-$repo-$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 $repo-$id
echo $name $repo-$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=${1:-${STACK_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/$repo-$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-$repo-$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 $repo-$id
echo $name $repo-$id $URL >> ${HPC_STACK_ROOT}/hpc-stack-contents.log
82 changes: 82 additions & 0 deletions libs/build_mapl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/bin/bash

set -eux

name="mapl"
repo=${1:-${STACK_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//\//-}
version_install=$repo-$id

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 load gftl-shared
module load yafyaml
module load esmf
module load netcdf
module list

set -x

prefix="${PREFIX:-"/opt/modules"}/$compiler/$mpi/$name/$version_install"
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

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

software=$name-$version_install
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=$CMAKE_MODULE_PATH \
-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
[[ -z $mpi ]] && modpath=compiler || modpath=mpi
$MODULES && update_modules $modpath $name $version_install
echo $name $version_install $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=${1:-${STACK_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/$repo-$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-$repo-$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 $repo-$id
echo $name $repo-$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")
21 changes: 21 additions & 0 deletions modulefiles/core/cmakemodules/cmakemodules.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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)

prepend_path("CMAKE_MODULE_PATH", pathJoin(base,"Modules"), ";")

setenv("cmakemodules_ROOT", base)

whatis("Name: ".. pkgName)
whatis("Version: " .. pkgVersion)
whatis("Category: Software")
whatis("Description: CMakeModules (A collection of ECMWF CMake modules)")
21 changes: 21 additions & 0 deletions modulefiles/core/esma_cmake/esma_cmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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)

prepend_path("CMAKE_MODULE_PATH", base, ";")

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,28 @@
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)
prepend_path("CMAKE_MODULE_PATH", pathJoin(base, "share/MAPL/cmake"), ";")

setenv("I_MPI_FABRICS", "shm:ofa")

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