Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scotch library to EPIC's hpc-stack #7

Closed
wants to merge 10 commits into from
1 change: 1 addition & 0 deletions build_stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,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
60 changes: 60 additions & 0 deletions libs/build_scotch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

set -eux

name="scotch"
version=${1:-${STACK_scotch_version}}

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

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

prefix="${PREFIX:-"/opt/modules"}/$compiler/$mpi/$name/$id"
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=${SCOTCH_ROOT:-"/usr/local"}
fi

cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}

software=$name-$version
URL="https://gitlab.inria.fr/scotch/scotch/-/archive/$version/scotch-$version.tar.gz"
[[ -f $software.tar.gz ]] || ( $WGET $URL )
[[ ${DOWNLOAD_ONLY} =~ [yYtT] ]] && exit 0

[[ -f $software.tar.gz ]] && tar -xvf $software.tar.gz || ( echo "$software tarfile does not exist, ABORT!"; exit 1 )
[[ -d $software ]] && cd $software || ( echo "$software does not exist, ABORT!"; exit 1 )

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

# Compile & Install Scotch/PTscotch
cmake VERBOSE=1 -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=icc -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_BUILD_TYPE=Release ..

make VERBOSE=1
make install
make scotch
make ptscotch

# generate modulefile from template
[[ -z $mpi ]] && modpath=compiler || modpath=mpi
$MODULES && update_modules $modpath $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,34 @@
help([[Scotch is a software package for graph and mesh/hypergraph partitioning,
graph clustering, and sparse matrix ordering.]])

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

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

conflict(pkgName)

depends_on("zlib")

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

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

prepend_path("PATH", pathJoin(base,"bin"))
prepend_path("MANPATH", pathJoin(base,"man"))
prepend_path("LIBRARY_PATH", pathJoin(base,"lib"))
prepend_path("LD_LIBRARY_PATH", pathJoin(base,"lib"))
prepend_path("DYLD_LIBRARY_PATH", pathJoin(base,"lib"))
prepend_path("CPATH", pathJoin(base,"include"))
prepend_path("CMAKE_PREFIX_PATH", base)

setenv("scotch_ROOT", base)
setenv("scotch_VERSION", pkgVersion)

whatis("Name: ".. pkgName)
whatis("Version: " .. pkgVersion)
whatis("Category: library")
whatis("Description: " .. pkgName .. " library")
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
help([[Scotch is a software package for graph and mesh/hypergraph partitioning,
graph clustering, and sparse matrix ordering.]])

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)

depends_on("zlib")

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

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

prepend_path("PATH", pathJoin(base,"bin"))
prepend_path("MANPATH", pathJoin(base,"man"))
prepend_path("LIBRARY_PATH", pathJoin(base,"lib"))
prepend_path("LD_LIBRARY_PATH", pathJoin(base,"lib"))
prepend_path("DYLD_LIBRARY_PATH", pathJoin(base,"lib"))
prepend_path("CPATH", pathJoin(base,"include"))
prepend_path("CMAKE_PREFIX_PATH", base)

setenv("scotch_ROOT", base)
setenv("scotch_VERSION", pkgVersion)

whatis("Name: ".. pkgName)
whatis("Version: " .. pkgVersion)
whatis("Category: library")
whatis("Description: " .. pkgName .. " library")