Skip to content

Commit db20abd

Browse files
Acorn updates; go fetcher (#1623)
This PR: adds oneAPI 2024.2.1 on Acorn adds util/fetch_go_deps.py adds platform-specific logic for setup.sh (for loading modules, etc.)
1 parent 12f6423 commit db20abd

File tree

8 files changed

+162
-5
lines changed

8 files changed

+162
-5
lines changed

configs/sites/tier1/acorn/compilers.yaml

+43
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,46 @@ compilers:
8888
# which confuses some packages.
8989
CONFIG_SITE: ''
9090
extra_rpaths: []
91+
- compiler:
92+
93+
paths:
94+
cc: cc
95+
cxx: CC
96+
f77: ftn
97+
fc: ftn
98+
flags: {}
99+
operating_system: sles15
100+
modules:
101+
- PrgEnv-intel/8.5.0
102+
- craype/2.7.17
103+
- intel-oneapi/2024.2
104+
- libfabric
105+
environment:
106+
prepend_path:
107+
PATH: /opt/cray/pe/gcc/12.1.0/bin
108+
LD_LIBRARY_PATH: /opt/cray/pe/gcc/12.1.0/snos/lib64
109+
LIBRARY_PATH: /opt/cray/pe/gcc/12.1.0/snos/lib64
110+
CPATH: /opt/cray/pe/gcc/12.1.0/snos/include
111+
set:
112+
# OpenSUSE on WCOSS2 machines sets CONFIG_SITE so
113+
# Automake-based builds are installed in lib64
114+
# which confuses some packages.
115+
CONFIG_SITE: ''
116+
extra_rpaths: []
117+
- compiler:
118+
119+
paths:
120+
cc: /opt/cray/pe/gcc/12.1.0/bin/gcc
121+
cxx: /opt/cray/pe/gcc/12.1.0/bin/g++
122+
f77: /opt/cray/pe/gcc/12.1.0/bin/gfortran
123+
fc: /opt/cray/pe/gcc/12.1.0/bin/gfortran
124+
flags: {}
125+
operating_system: sles15
126+
modules: []
127+
environment:
128+
set:
129+
# OpenSUSE on WCOSS2 machines sets CONFIG_SITE so
130+
# Automake-based builds are installed in lib64
131+
# which confuses some packages.
132+
CONFIG_SITE: ''
133+
extra_rpaths: []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
packages:
2+
all:
3+
compiler:: [[email protected]]
4+
providers:
5+
6+
# Remove the next three lines to switch to intel-oneapi-mkl
7+
blas:: [openblas]
8+
fftw-api:: [fftw]
9+
lapack:: [openblas]
10+
gcc-runtime:
11+
require: '%[email protected]'
12+
mpi:
13+
buildable: False
14+
cray-mpich:
15+
externals:
16+
- spec: [email protected]~wrappers
17+
modules:
18+
- libfabric
19+
- craype-network-ofi
20+
- cray-mpich/8.1.29
21+
- cray-pals
22+
intel-oneapi-mkl:
23+
# Remove buildable: False and configure+uncomment externals section below to use intel-oneapi-mkl
24+
buildable: False
25+
#externals:
26+
27+
# prefix: /apps/oneapi
28+
# DH* Remove this section to switch to intel-oneapi-mkl
29+
ectrans:
30+
require::
31+
- '@1.2.0 ~mkl +fftw'
32+
gsibec:
33+
require::
34+
- '@1.2.1 ~mkl'
35+
py-numpy:
36+
require::
37+
- '^[virtuals=lapack,blas] openblas'

configs/sites/tier1/acorn/setup.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Load modules to avoid various issues with old Python versions
2+
module load gcc/10.3.0 python/3.11.7
3+
4+
## Go, Rust repo setup for fetcher scripts
5+
export GOMODCACHE=${SPACK_STACK_DIR}/cache/go
6+
export CARGO_HOME=${SPACK_STACK_DIR}/cache/cargo

doc/source/Utilities.rst

+8
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ This utility downloads Rust/Cargo package dependencies and stores them in a loca
6060

6161
Run this script in an active, concretized Spack environment to fetch Rust dependencies and store them in ``${CARGO_HOME}. You must either run it with ``spack-python`` or have ``spack-python`` in your ``${PATH}``. Ensure ``${CARGO_HOME}`` has the same value when ``spack install`` is run. For each spec that is a CargoPackage or a PythonPackage with a rust dependency, the script will attempt to fetch all of its cargo dependencies using ``cargo`` if available in the user's environment, but will fall back to installing ``cargo``/``rustup`` from the internet using ``install_rust.sh`` (located in in the same directory as this script).
6262

63+
.. _Fetch_Go_Dependencies:
64+
65+
----------------
66+
fetch_go_deps.py
67+
----------------
68+
69+
The ``fetch_go_deps.py`` utility prefetches Go dependencies, storing them in a local directory for later use during ``spack install``. This is required for installing on systems that do no have access to the internet during the ``spack install`` phase and complements other mirrors such as the spack source mirror. The ``$GOMODCACHE`` variable must be set, and the utility must be run in an active, concretized environment. It will fetch Spack packages of type GoPackage, and fetch all dependencies based on the dependency listings found in those packages. The utilities will attempt to use each package's ``go`` dependency, in which case these utilities must be run after ``go`` is installed. It will revert to using system-installed ``go`` if available.
70+
6371
.. _Acorn_Utilities:
6472

6573
------------------------------

setup.sh

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
# Portable way to get current directory
33
SPACK_STACK_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
44

5+
hostname=$(hostname)
6+
case $hostname in
7+
alogin*)
8+
. ${SPACK_STACK_DIR}/configs/sites/tier1/acorn/setup.sh
9+
;;
10+
esac
11+
512
export SPACK_STACK_DIR
613
echo "Setting environment variable SPACK_STACK_DIR to ${SPACK_STACK_DIR}"
714

util/fetch_cargo_deps.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,4 @@
112112
for root, dirs, files in os.walk(pkg.stage.source_path):
113113
if "Cargo.toml" in files:
114114
with working_dir(root):
115-
cargo_exe("fetch")
115+
cargo_exe("fetch")

util/fetch_go_deps.py

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env spack-python
2+
#
3+
# Run this script in an active, concretized Spack environment to fetch Go
4+
# dependencies and store them in $GOMODCACHE. You must either run it with
5+
# 'spack-python' or have 'spack-python' in your $PATH. Ensure $GOMODCACHE has
6+
# the same value when 'spack install' is run.
7+
#
8+
# For each spec that is a GoPackage, it will attempt to use that spec's 'go'
9+
# dependency to execute '', but will fall back to searching $PATH if that
10+
# dependency has not already been installed.
11+
#
12+
# Alex Richert, Apr 2025
13+
#
14+
15+
import os
16+
17+
from spack.environment import active_environment
18+
from spack.build_systems.go import GoPackage
19+
from spack.package_base import PackageBase
20+
from spack.util.executable import Executable, which
21+
from llnl.util.filesystem import working_dir
22+
from spack.store import find
23+
from spack.error import SpackError
24+
25+
# Load the current environment
26+
env = active_environment()
27+
if not env:
28+
raise SpackError("No active Spack environment")
29+
30+
gomodcache = os.getenv("GOMODCACHE")
31+
if not gomodcache:
32+
raise SpackError("GOMODCACHE must be set")
33+
34+
# Find each spec that is a GoPackage
35+
# and fetch its dependencies to $GOMODCACHE
36+
for spec in env.all_specs():
37+
if not spec.concrete:
38+
continue
39+
pkg_cls = spec.package.__class__
40+
if issubclass(pkg_cls, GoPackage):
41+
print(f"Found spec with GoPackage: {spec.name}@{spec.version}/{spec.dag_hash()}")
42+
else:
43+
continue
44+
pkg = spec.package
45+
pkg.do_stage()
46+
47+
dep_go_path = os.path.join(spec["go"].prefix.bin, "go")
48+
if which(dep_go_path):
49+
go_exe = Executable(dep_go_path)
50+
elif which("go"):
51+
go_exe = Executable("go")
52+
else:
53+
raise SpackError("Could not find 'go' executable")
54+
55+
with working_dir(pkg.stage.source_path):
56+
go_exe("mod", "download")

util/weekly_build/sites/acorn.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
module load gcc/11.2.0 python/3.8.6
1+
. ${SPACK_STACK_DIR}/configs/sites/tier1/acorn/setup.sh
22
COMPILERS=${COMPILERS:-"[email protected] [email protected]"}
33
TEMPLATES=${TEMPLATES:-"unified-dev"}
44
function spack_install_wrapper {
55
logfile=$1
66
shift 2
77
spack fetch --missing ${PACKAGES_TO_INSTALL} &> log.fetch
8-
if [[ " $* " =~ " global-workflow-env " ]]; then
9-
spack config add "config:build_stage:${SPACK_ENV:?}/stage"
10-
spack install $INSTALL_OPTS gh
8+
if [[ " $($(which spack) dependencies --transitive ${PACKAGES_TO_INSTALL}) " =~ " go " ]]; then
9+
/opt/pbs/bin/qsub -N spack-build-cache-$RUNID -j oe -A NCEPLIBS-DEV -l "select=1:ncpus=8:mem=20GB,walltime=$walltime" -q dev -V -Wblock=true -- $(which spack) install go
10+
${SPACK_SPACK_DIR}/util/fetch_go_deps.py
1111
fi
1212
spack config add 'config:build_stage:$tempdir/$user/spack-stage'
1313
if [[ " $* " =~ "-env " ]]; then # for the "real" install step

0 commit comments

Comments
 (0)