diff --git a/build_stack.sh b/build_stack.sh index 882dc2f0..672d55b1 100755 --- a/build_stack.sh +++ b/build_stack.sh @@ -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 diff --git a/libs/build_scotch.sh b/libs/build_scotch.sh new file mode 100755 index 00000000..cef78b31 --- /dev/null +++ b/libs/build_scotch.sh @@ -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 diff --git a/modulefiles/compiler/compilerName/compilerVersion/scotch/scotch.lua b/modulefiles/compiler/compilerName/compilerVersion/scotch/scotch.lua new file mode 100644 index 00000000..c3f19099 --- /dev/null +++ b/modulefiles/compiler/compilerName/compilerVersion/scotch/scotch.lua @@ -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") diff --git a/modulefiles/mpi/compilerName/compilerVersion/mpiName/mpiVersion/scotch/scotch.lua b/modulefiles/mpi/compilerName/compilerVersion/mpiName/mpiVersion/scotch/scotch.lua new file mode 100644 index 00000000..07e529d3 --- /dev/null +++ b/modulefiles/mpi/compilerName/compilerVersion/mpiName/mpiVersion/scotch/scotch.lua @@ -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")