Compare commits
1 Commits
v0.22.4
...
refactor-s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39c074ff79 |
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"image": "ghcr.io/spack/ubuntu20.04-runner-amd64-gcc-11.4:2023.08.01",
|
|
||||||
"postCreateCommand": "./.devcontainer/postCreateCommand.sh"
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Load spack environment at terminal startup
|
|
||||||
cat <<EOF >> /root/.bashrc
|
|
||||||
. /workspaces/spack/share/spack/setup-env.sh
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Load spack environment in this script
|
|
||||||
. /workspaces/spack/share/spack/setup-env.sh
|
|
||||||
|
|
||||||
# Ensure generic targets for maximum matching with buildcaches
|
|
||||||
spack config --scope site add "packages:all:require:[target=x86_64_v3]"
|
|
||||||
spack config --scope site add "concretizer:targets:granularity:generic"
|
|
||||||
|
|
||||||
# Find compiler and install gcc-runtime
|
|
||||||
spack compiler find --scope site
|
|
||||||
|
|
||||||
# Setup buildcaches
|
|
||||||
spack mirror add --scope site develop https://binaries.spack.io/develop
|
|
||||||
spack buildcache keys --install --trust
|
|
||||||
6
.github/pull_request_template.md
vendored
6
.github/pull_request_template.md
vendored
@@ -1,6 +0,0 @@
|
|||||||
<!--
|
|
||||||
Remember that `spackbot` can help with your PR in multiple ways:
|
|
||||||
- `@spackbot help` shows all the commands that are currently available
|
|
||||||
- `@spackbot fix style` tries to push a commit to fix style issues in this PR
|
|
||||||
- `@spackbot re-run pipeline` runs the pipelines again, if you have write access to the repository
|
|
||||||
-->
|
|
||||||
42
.github/workflows/audit.yaml
vendored
42
.github/workflows/audit.yaml
vendored
@@ -17,53 +17,33 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
# Run audits on all the packages in the built-in repository
|
# Run audits on all the packages in the built-in repository
|
||||||
package-audits:
|
package-audits:
|
||||||
runs-on: ${{ matrix.system.os }}
|
runs-on: ${{ matrix.operating_system }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
system:
|
operating_system: ["ubuntu-latest", "macos-latest"]
|
||||||
- { os: windows-latest, shell: 'powershell Invoke-Expression -Command "./share/spack/qa/windows_test_setup.ps1"; {0}' }
|
|
||||||
- { os: ubuntu-latest, shell: bash }
|
|
||||||
- { os: macos-latest, shell: bash }
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: ${{ matrix.system.shell }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2
|
||||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # @v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{inputs.python_version}}
|
python-version: ${{inputs.python_version}}
|
||||||
- name: Install Python packages
|
- name: Install Python packages
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip setuptools pytest coverage[toml]
|
pip install --upgrade pip setuptools pytest coverage[toml]
|
||||||
- name: Setup for Windows run
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pywin32
|
|
||||||
- name: Package audits (with coverage)
|
- name: Package audits (with coverage)
|
||||||
if: ${{ inputs.with_coverage == 'true' && runner.os != 'Windows' }}
|
if: ${{ inputs.with_coverage == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
. share/spack/setup-env.sh
|
. share/spack/setup-env.sh
|
||||||
coverage run $(which spack) audit packages
|
coverage run $(which spack) audit packages
|
||||||
coverage run $(which spack) -d audit externals
|
coverage run $(which spack) audit externals
|
||||||
coverage combine
|
coverage combine
|
||||||
coverage xml
|
coverage xml
|
||||||
- name: Package audits (without coverage)
|
- name: Package audits (without coverage)
|
||||||
if: ${{ inputs.with_coverage == 'false' && runner.os != 'Windows' }}
|
if: ${{ inputs.with_coverage == 'false' }}
|
||||||
run: |
|
run: |
|
||||||
. share/spack/setup-env.sh
|
. share/spack/setup-env.sh
|
||||||
spack -d audit packages
|
$(which spack) audit packages
|
||||||
spack -d audit externals
|
$(which spack) audit externals
|
||||||
- name: Package audits (without coverage)
|
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # @v2.1.0
|
||||||
if: ${{ runner.os == 'Windows' }}
|
|
||||||
run: |
|
|
||||||
. share/spack/setup-env.sh
|
|
||||||
spack -d audit packages
|
|
||||||
./share/spack/qa/validate_last_exit.ps1
|
|
||||||
spack -d audit externals
|
|
||||||
./share/spack/qa/validate_last_exit.ps1
|
|
||||||
- uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be
|
|
||||||
if: ${{ inputs.with_coverage == 'true' }}
|
if: ${{ inputs.with_coverage == 'true' }}
|
||||||
with:
|
with:
|
||||||
flags: unittests,audits
|
flags: unittests,audits
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
verbose: true
|
|
||||||
|
|||||||
5
.github/workflows/bootstrap-test.sh
vendored
5
.github/workflows/bootstrap-test.sh
vendored
@@ -1,8 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -ex
|
||||||
source share/spack/setup-env.sh
|
source share/spack/setup-env.sh
|
||||||
$PYTHON bin/spack bootstrap disable github-actions-v0.4
|
|
||||||
$PYTHON bin/spack bootstrap disable spack-install
|
$PYTHON bin/spack bootstrap disable spack-install
|
||||||
$PYTHON bin/spack $SPACK_FLAGS solve zlib
|
$PYTHON bin/spack -d solve zlib
|
||||||
tree $BOOTSTRAP/store
|
tree $BOOTSTRAP/store
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
352
.github/workflows/bootstrap.yml
vendored
352
.github/workflows/bootstrap.yml
vendored
@@ -13,22 +13,118 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
distros-clingo-sources:
|
fedora-clingo-sources:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ${{ matrix.image }}
|
container: "fedora:latest"
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
image: ["fedora:latest", "opensuse/leap:latest"]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Fedora
|
- name: Install dependencies
|
||||||
if: ${{ matrix.image == 'fedora:latest' }}
|
|
||||||
run: |
|
run: |
|
||||||
dnf install -y \
|
dnf install -y \
|
||||||
bzip2 curl file gcc-c++ gcc gcc-gfortran git gzip \
|
bzip2 curl file gcc-c++ gcc gcc-gfortran git gnupg2 gzip \
|
||||||
make patch unzip which xz python3 python3-devel tree \
|
make patch unzip which xz python3 python3-devel tree \
|
||||||
cmake bison bison-devel libstdc++-static
|
cmake bison bison-devel libstdc++-static
|
||||||
- name: Setup OpenSUSE
|
- name: Checkout
|
||||||
if: ${{ matrix.image == 'opensuse/leap:latest' }}
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup non-root user
|
||||||
|
run: |
|
||||||
|
# See [1] below
|
||||||
|
git config --global --add safe.directory /__w/spack/spack
|
||||||
|
useradd spack-test && mkdir -p ~spack-test
|
||||||
|
chown -R spack-test . ~spack-test
|
||||||
|
- name: Setup repo
|
||||||
|
shell: runuser -u spack-test -- bash {0}
|
||||||
|
run: |
|
||||||
|
git --version
|
||||||
|
. .github/workflows/setup_git.sh
|
||||||
|
- name: Bootstrap clingo
|
||||||
|
shell: runuser -u spack-test -- bash {0}
|
||||||
|
run: |
|
||||||
|
source share/spack/setup-env.sh
|
||||||
|
spack bootstrap disable github-actions-v0.5
|
||||||
|
spack bootstrap disable github-actions-v0.4
|
||||||
|
spack external find cmake bison
|
||||||
|
spack -d solve zlib
|
||||||
|
tree ~/.spack/bootstrap/store/
|
||||||
|
|
||||||
|
ubuntu-clingo-sources:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: "ubuntu:latest"
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
env:
|
||||||
|
DEBIAN_FRONTEND: noninteractive
|
||||||
|
run: |
|
||||||
|
apt-get update -y && apt-get upgrade -y
|
||||||
|
apt-get install -y \
|
||||||
|
bzip2 curl file g++ gcc gfortran git gnupg2 gzip \
|
||||||
|
make patch unzip xz-utils python3 python3-dev tree \
|
||||||
|
cmake bison
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup non-root user
|
||||||
|
run: |
|
||||||
|
# See [1] below
|
||||||
|
git config --global --add safe.directory /__w/spack/spack
|
||||||
|
useradd spack-test && mkdir -p ~spack-test
|
||||||
|
chown -R spack-test . ~spack-test
|
||||||
|
- name: Setup repo
|
||||||
|
shell: runuser -u spack-test -- bash {0}
|
||||||
|
run: |
|
||||||
|
git --version
|
||||||
|
. .github/workflows/setup_git.sh
|
||||||
|
- name: Bootstrap clingo
|
||||||
|
shell: runuser -u spack-test -- bash {0}
|
||||||
|
run: |
|
||||||
|
source share/spack/setup-env.sh
|
||||||
|
spack bootstrap disable github-actions-v0.5
|
||||||
|
spack bootstrap disable github-actions-v0.4
|
||||||
|
spack external find cmake bison
|
||||||
|
spack -d solve zlib
|
||||||
|
tree ~/.spack/bootstrap/store/
|
||||||
|
|
||||||
|
ubuntu-clingo-binaries-and-patchelf:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: "ubuntu:latest"
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
env:
|
||||||
|
DEBIAN_FRONTEND: noninteractive
|
||||||
|
run: |
|
||||||
|
apt-get update -y && apt-get upgrade -y
|
||||||
|
apt-get install -y \
|
||||||
|
bzip2 curl file g++ gcc gfortran git gnupg2 gzip \
|
||||||
|
make patch unzip xz-utils python3 python3-dev tree
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup non-root user
|
||||||
|
run: |
|
||||||
|
# See [1] below
|
||||||
|
git config --global --add safe.directory /__w/spack/spack
|
||||||
|
useradd spack-test && mkdir -p ~spack-test
|
||||||
|
chown -R spack-test . ~spack-test
|
||||||
|
- name: Setup repo
|
||||||
|
shell: runuser -u spack-test -- bash {0}
|
||||||
|
run: |
|
||||||
|
git --version
|
||||||
|
. .github/workflows/setup_git.sh
|
||||||
|
- name: Bootstrap clingo
|
||||||
|
shell: runuser -u spack-test -- bash {0}
|
||||||
|
run: |
|
||||||
|
source share/spack/setup-env.sh
|
||||||
|
spack -d solve zlib
|
||||||
|
tree ~/.spack/bootstrap/store/
|
||||||
|
|
||||||
|
opensuse-clingo-sources:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: "opensuse/leap:latest"
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
# Harden CI by applying the workaround described here: https://www.suse.com/support/kb/doc/?id=000019505
|
# Harden CI by applying the workaround described here: https://www.suse.com/support/kb/doc/?id=000019505
|
||||||
zypper update -y || zypper update -y
|
zypper update -y || zypper update -y
|
||||||
@@ -37,9 +133,15 @@ jobs:
|
|||||||
make patch unzip which xz python3 python3-devel tree \
|
make patch unzip which xz python3 python3-devel tree \
|
||||||
cmake bison
|
cmake bison
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- name: Setup repo
|
||||||
|
run: |
|
||||||
|
# See [1] below
|
||||||
|
git config --global --add safe.directory /__w/spack/spack
|
||||||
|
git --version
|
||||||
|
. .github/workflows/setup_git.sh
|
||||||
- name: Bootstrap clingo
|
- name: Bootstrap clingo
|
||||||
run: |
|
run: |
|
||||||
source share/spack/setup-env.sh
|
source share/spack/setup-env.sh
|
||||||
@@ -49,98 +151,77 @@ jobs:
|
|||||||
spack -d solve zlib
|
spack -d solve zlib
|
||||||
tree ~/.spack/bootstrap/store/
|
tree ~/.spack/bootstrap/store/
|
||||||
|
|
||||||
clingo-sources:
|
macos-clingo-sources:
|
||||||
runs-on: ${{ matrix.runner }}
|
runs-on: macos-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
runner: ['macos-13', 'macos-14', "ubuntu-latest"]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Setup macOS
|
- name: Install dependencies
|
||||||
if: ${{ matrix.runner != 'ubuntu-latest' }}
|
|
||||||
run: |
|
run: |
|
||||||
brew install cmake bison tree
|
brew install cmake bison@2.7 tree
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
with:
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # @v2
|
||||||
fetch-depth: 0
|
|
||||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
|
||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
- name: Bootstrap clingo
|
- name: Bootstrap clingo
|
||||||
run: |
|
run: |
|
||||||
source share/spack/setup-env.sh
|
source share/spack/setup-env.sh
|
||||||
|
export PATH=/usr/local/opt/bison@2.7/bin:$PATH
|
||||||
spack bootstrap disable github-actions-v0.5
|
spack bootstrap disable github-actions-v0.5
|
||||||
spack bootstrap disable github-actions-v0.4
|
spack bootstrap disable github-actions-v0.4
|
||||||
spack external find --not-buildable cmake bison
|
spack external find --not-buildable cmake bison
|
||||||
spack -d solve zlib
|
spack -d solve zlib
|
||||||
tree ~/.spack/bootstrap/store/
|
tree ~/.spack/bootstrap/store/
|
||||||
|
|
||||||
gnupg-sources:
|
macos-clingo-binaries:
|
||||||
runs-on: ${{ matrix.runner }}
|
runs-on: ${{ matrix.macos-version }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
runner: [ 'macos-13', 'macos-14', "ubuntu-latest" ]
|
macos-version: ['macos-11', 'macos-12']
|
||||||
steps:
|
steps:
|
||||||
- name: Setup macOS
|
- name: Install dependencies
|
||||||
if: ${{ matrix.runner != 'ubuntu-latest' }}
|
|
||||||
run: brew install tree gawk
|
|
||||||
- name: Remove system executables
|
|
||||||
run: |
|
run: |
|
||||||
while [ -n "$(command -v gpg gpg2 patchelf)" ]; do
|
brew install tree
|
||||||
sudo rm $(command -v gpg gpg2 patchelf)
|
|
||||||
done
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Bootstrap GnuPG
|
|
||||||
run: |
|
|
||||||
source share/spack/setup-env.sh
|
|
||||||
spack solve zlib
|
|
||||||
spack bootstrap disable github-actions-v0.5
|
|
||||||
spack bootstrap disable github-actions-v0.4
|
|
||||||
spack -d gpg list
|
|
||||||
tree ~/.spack/bootstrap/store/
|
|
||||||
|
|
||||||
from-binaries:
|
|
||||||
runs-on: ${{ matrix.runner }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
runner: ['macos-13', 'macos-14', "ubuntu-latest"]
|
|
||||||
steps:
|
|
||||||
- name: Setup macOS
|
|
||||||
if: ${{ matrix.runner != 'ubuntu-latest' }}
|
|
||||||
run: brew install tree
|
|
||||||
- name: Remove system executables
|
|
||||||
run: |
|
|
||||||
while [ -n "$(command -v gpg gpg2 patchelf)" ]; do
|
|
||||||
sudo rm $(command -v gpg gpg2 patchelf)
|
|
||||||
done
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
|
||||||
with:
|
|
||||||
python-version: |
|
|
||||||
3.8
|
|
||||||
3.9
|
|
||||||
3.10
|
|
||||||
3.11
|
|
||||||
3.12
|
|
||||||
- name: Set bootstrap sources
|
|
||||||
run: |
|
|
||||||
source share/spack/setup-env.sh
|
|
||||||
spack bootstrap disable github-actions-v0.4
|
|
||||||
spack bootstrap disable spack-install
|
|
||||||
- name: Bootstrap clingo
|
- name: Bootstrap clingo
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -ex
|
||||||
for ver in '3.8' '3.9' '3.10' '3.11' '3.12' ; do
|
for ver in '3.7' '3.8' '3.9' '3.10' '3.11' ; do
|
||||||
not_found=1
|
not_found=1
|
||||||
ver_dir="$(find $RUNNER_TOOL_CACHE/Python -wholename "*/${ver}.*/*/bin" | grep . || true)"
|
ver_dir="$(find $RUNNER_TOOL_CACHE/Python -wholename "*/${ver}.*/*/bin" | grep . || true)"
|
||||||
|
echo "Testing $ver_dir"
|
||||||
|
if [[ -d "$ver_dir" ]] ; then
|
||||||
|
if $ver_dir/python --version ; then
|
||||||
|
export PYTHON="$ver_dir/python"
|
||||||
|
not_found=0
|
||||||
|
old_path="$PATH"
|
||||||
|
export PATH="$ver_dir:$PATH"
|
||||||
|
./bin/spack-tmpconfig -b ./.github/workflows/bootstrap-test.sh
|
||||||
|
export PATH="$old_path"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# NOTE: test all pythons that exist, not all do on 12
|
||||||
|
done
|
||||||
|
|
||||||
|
ubuntu-clingo-binaries:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup repo
|
||||||
|
run: |
|
||||||
|
git --version
|
||||||
|
. .github/workflows/setup_git.sh
|
||||||
|
- name: Bootstrap clingo
|
||||||
|
run: |
|
||||||
|
set -ex
|
||||||
|
for ver in '3.7' '3.8' '3.9' '3.10' '3.11' ; do
|
||||||
|
not_found=1
|
||||||
|
ver_dir="$(find $RUNNER_TOOL_CACHE/Python -wholename "*/${ver}.*/*/bin" | grep . || true)"
|
||||||
|
echo "Testing $ver_dir"
|
||||||
if [[ -d "$ver_dir" ]] ; then
|
if [[ -d "$ver_dir" ]] ; then
|
||||||
echo "Testing $ver_dir"
|
|
||||||
if $ver_dir/python --version ; then
|
if $ver_dir/python --version ; then
|
||||||
export PYTHON="$ver_dir/python"
|
export PYTHON="$ver_dir/python"
|
||||||
not_found=0
|
not_found=0
|
||||||
@@ -155,9 +236,122 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
ubuntu-gnupg-binaries:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: "ubuntu:latest"
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
env:
|
||||||
|
DEBIAN_FRONTEND: noninteractive
|
||||||
|
run: |
|
||||||
|
apt-get update -y && apt-get upgrade -y
|
||||||
|
apt-get install -y \
|
||||||
|
bzip2 curl file g++ gcc patchelf gfortran git gzip \
|
||||||
|
make patch unzip xz-utils python3 python3-dev tree
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup non-root user
|
||||||
|
run: |
|
||||||
|
# See [1] below
|
||||||
|
git config --global --add safe.directory /__w/spack/spack
|
||||||
|
useradd spack-test && mkdir -p ~spack-test
|
||||||
|
chown -R spack-test . ~spack-test
|
||||||
|
- name: Setup repo
|
||||||
|
shell: runuser -u spack-test -- bash {0}
|
||||||
|
run: |
|
||||||
|
git --version
|
||||||
|
. .github/workflows/setup_git.sh
|
||||||
- name: Bootstrap GnuPG
|
- name: Bootstrap GnuPG
|
||||||
|
shell: runuser -u spack-test -- bash {0}
|
||||||
run: |
|
run: |
|
||||||
source share/spack/setup-env.sh
|
source share/spack/setup-env.sh
|
||||||
|
spack bootstrap disable github-actions-v0.4
|
||||||
|
spack bootstrap disable spack-install
|
||||||
spack -d gpg list
|
spack -d gpg list
|
||||||
tree ~/.spack/bootstrap/store/
|
tree ~/.spack/bootstrap/store/
|
||||||
|
|
||||||
|
ubuntu-gnupg-sources:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: "ubuntu:latest"
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
env:
|
||||||
|
DEBIAN_FRONTEND: noninteractive
|
||||||
|
run: |
|
||||||
|
apt-get update -y && apt-get upgrade -y
|
||||||
|
apt-get install -y \
|
||||||
|
bzip2 curl file g++ gcc patchelf gfortran git gzip \
|
||||||
|
make patch unzip xz-utils python3 python3-dev tree \
|
||||||
|
gawk
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup non-root user
|
||||||
|
run: |
|
||||||
|
# See [1] below
|
||||||
|
git config --global --add safe.directory /__w/spack/spack
|
||||||
|
useradd spack-test && mkdir -p ~spack-test
|
||||||
|
chown -R spack-test . ~spack-test
|
||||||
|
- name: Setup repo
|
||||||
|
shell: runuser -u spack-test -- bash {0}
|
||||||
|
run: |
|
||||||
|
git --version
|
||||||
|
. .github/workflows/setup_git.sh
|
||||||
|
- name: Bootstrap GnuPG
|
||||||
|
shell: runuser -u spack-test -- bash {0}
|
||||||
|
run: |
|
||||||
|
source share/spack/setup-env.sh
|
||||||
|
spack solve zlib
|
||||||
|
spack bootstrap disable github-actions-v0.5
|
||||||
|
spack bootstrap disable github-actions-v0.4
|
||||||
|
spack -d gpg list
|
||||||
|
tree ~/.spack/bootstrap/store/
|
||||||
|
|
||||||
|
macos-gnupg-binaries:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
brew install tree
|
||||||
|
# Remove GnuPG since we want to bootstrap it
|
||||||
|
sudo rm -rf /usr/local/bin/gpg
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
|
- name: Bootstrap GnuPG
|
||||||
|
run: |
|
||||||
|
source share/spack/setup-env.sh
|
||||||
|
spack bootstrap disable github-actions-v0.4
|
||||||
|
spack bootstrap disable spack-install
|
||||||
|
spack -d gpg list
|
||||||
|
tree ~/.spack/bootstrap/store/
|
||||||
|
|
||||||
|
macos-gnupg-sources:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
brew install gawk tree
|
||||||
|
# Remove GnuPG since we want to bootstrap it
|
||||||
|
sudo rm -rf /usr/local/bin/gpg
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
|
- name: Bootstrap GnuPG
|
||||||
|
run: |
|
||||||
|
source share/spack/setup-env.sh
|
||||||
|
spack solve zlib
|
||||||
|
spack bootstrap disable github-actions-v0.5
|
||||||
|
spack bootstrap disable github-actions-v0.4
|
||||||
|
spack -d gpg list
|
||||||
|
tree ~/.spack/bootstrap/store/
|
||||||
|
|
||||||
|
|
||||||
|
# [1] Distros that have patched git to resolve CVE-2022-24765 (e.g. Ubuntu patching v2.25.1)
|
||||||
|
# introduce breaking behaviorso we have to set `safe.directory` in gitconfig ourselves.
|
||||||
|
# See:
|
||||||
|
# - https://github.blog/2022-04-12-git-security-vulnerability-announced/
|
||||||
|
# - https://github.com/actions/checkout/issues/760
|
||||||
|
# - http://changelogs.ubuntu.com/changelogs/pool/main/g/git/git_2.25.1-1ubuntu3.3/changelog
|
||||||
|
|||||||
34
.github/workflows/build-containers.yml
vendored
34
.github/workflows/build-containers.yml
vendored
@@ -45,20 +45,19 @@ jobs:
|
|||||||
[leap15, 'linux/amd64,linux/arm64,linux/ppc64le', 'opensuse/leap:15'],
|
[leap15, 'linux/amd64,linux/arm64,linux/ppc64le', 'opensuse/leap:15'],
|
||||||
[ubuntu-focal, 'linux/amd64,linux/arm64,linux/ppc64le', 'ubuntu:20.04'],
|
[ubuntu-focal, 'linux/amd64,linux/arm64,linux/ppc64le', 'ubuntu:20.04'],
|
||||||
[ubuntu-jammy, 'linux/amd64,linux/arm64,linux/ppc64le', 'ubuntu:22.04'],
|
[ubuntu-jammy, 'linux/amd64,linux/arm64,linux/ppc64le', 'ubuntu:22.04'],
|
||||||
[ubuntu-noble, 'linux/amd64,linux/arm64,linux/ppc64le', 'ubuntu:24.04'],
|
|
||||||
[almalinux8, 'linux/amd64,linux/arm64,linux/ppc64le', 'almalinux:8'],
|
[almalinux8, 'linux/amd64,linux/arm64,linux/ppc64le', 'almalinux:8'],
|
||||||
[almalinux9, 'linux/amd64,linux/arm64,linux/ppc64le', 'almalinux:9'],
|
[almalinux9, 'linux/amd64,linux/arm64,linux/ppc64le', 'almalinux:9'],
|
||||||
[rockylinux8, 'linux/amd64,linux/arm64', 'rockylinux:8'],
|
[rockylinux8, 'linux/amd64,linux/arm64', 'rockylinux:8'],
|
||||||
[rockylinux9, 'linux/amd64,linux/arm64', 'rockylinux:9'],
|
[rockylinux9, 'linux/amd64,linux/arm64', 'rockylinux:9'],
|
||||||
[fedora39, 'linux/amd64,linux/arm64,linux/ppc64le', 'fedora:39'],
|
[fedora37, 'linux/amd64,linux/arm64,linux/ppc64le', 'fedora:37'],
|
||||||
[fedora40, 'linux/amd64,linux/arm64,linux/ppc64le', 'fedora:40']]
|
[fedora38, 'linux/amd64,linux/arm64,linux/ppc64le', 'fedora:38']]
|
||||||
name: Build ${{ matrix.dockerfile[0] }}
|
name: Build ${{ matrix.dockerfile[0] }}
|
||||||
if: github.repository == 'spack/spack'
|
if: github.repository == 'spack/spack'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2
|
||||||
|
|
||||||
- uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
|
- uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4
|
||||||
id: docker_meta
|
id: docker_meta
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
@@ -88,19 +87,19 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload Dockerfile
|
- name: Upload Dockerfile
|
||||||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
||||||
with:
|
with:
|
||||||
name: dockerfiles_${{ matrix.dockerfile[0] }}
|
name: dockerfiles
|
||||||
path: dockerfiles
|
path: dockerfiles
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3
|
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb
|
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
- name: Log in to GitHub Container Registry
|
||||||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
|
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
@@ -108,27 +107,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Log in to DockerHub
|
- name: Log in to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
|
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build & Deploy ${{ matrix.dockerfile[0] }}
|
- name: Build & Deploy ${{ matrix.dockerfile[0] }}
|
||||||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
|
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56
|
||||||
with:
|
with:
|
||||||
context: dockerfiles/${{ matrix.dockerfile[0] }}
|
context: dockerfiles/${{ matrix.dockerfile[0] }}
|
||||||
platforms: ${{ matrix.dockerfile[1] }}
|
platforms: ${{ matrix.dockerfile[1] }}
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||||
|
|
||||||
merge-dockerfiles:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: deploy-images
|
|
||||||
steps:
|
|
||||||
- name: Merge Artifacts
|
|
||||||
uses: actions/upload-artifact/merge@65462800fd760344b1a7b4382951275a0abb4808
|
|
||||||
with:
|
|
||||||
name: dockerfiles
|
|
||||||
pattern: dockerfiles_*
|
|
||||||
delete-merged: true
|
|
||||||
|
|||||||
13
.github/workflows/ci.yaml
vendored
13
.github/workflows/ci.yaml
vendored
@@ -18,7 +18,6 @@ jobs:
|
|||||||
prechecks:
|
prechecks:
|
||||||
needs: [ changes ]
|
needs: [ changes ]
|
||||||
uses: ./.github/workflows/valid-style.yml
|
uses: ./.github/workflows/valid-style.yml
|
||||||
secrets: inherit
|
|
||||||
with:
|
with:
|
||||||
with_coverage: ${{ needs.changes.outputs.core }}
|
with_coverage: ${{ needs.changes.outputs.core }}
|
||||||
all-prechecks:
|
all-prechecks:
|
||||||
@@ -36,12 +35,12 @@ jobs:
|
|||||||
core: ${{ steps.filter.outputs.core }}
|
core: ${{ steps.filter.outputs.core }}
|
||||||
packages: ${{ steps.filter.outputs.packages }}
|
packages: ${{ steps.filter.outputs.packages }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2
|
||||||
if: ${{ github.event_name == 'push' }}
|
if: ${{ github.event_name == 'push' }}
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
# For pull requests it's not necessary to checkout the code
|
# For pull requests it's not necessary to checkout the code
|
||||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
|
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
|
||||||
id: filter
|
id: filter
|
||||||
with:
|
with:
|
||||||
# See https://github.com/dorny/paths-filter/issues/56 for the syntax used below
|
# See https://github.com/dorny/paths-filter/issues/56 for the syntax used below
|
||||||
@@ -71,14 +70,16 @@ jobs:
|
|||||||
if: ${{ github.repository == 'spack/spack' && needs.changes.outputs.bootstrap == 'true' }}
|
if: ${{ github.repository == 'spack/spack' && needs.changes.outputs.bootstrap == 'true' }}
|
||||||
needs: [ prechecks, changes ]
|
needs: [ prechecks, changes ]
|
||||||
uses: ./.github/workflows/bootstrap.yml
|
uses: ./.github/workflows/bootstrap.yml
|
||||||
secrets: inherit
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
if: ${{ github.repository == 'spack/spack' && needs.changes.outputs.core == 'true' }}
|
if: ${{ github.repository == 'spack/spack' && needs.changes.outputs.core == 'true' }}
|
||||||
needs: [ prechecks, changes ]
|
needs: [ prechecks, changes ]
|
||||||
uses: ./.github/workflows/unit_tests.yaml
|
uses: ./.github/workflows/unit_tests.yaml
|
||||||
secrets: inherit
|
windows:
|
||||||
|
if: ${{ github.repository == 'spack/spack' && needs.changes.outputs.core == 'true' }}
|
||||||
|
needs: [ prechecks ]
|
||||||
|
uses: ./.github/workflows/windows_python.yml
|
||||||
all:
|
all:
|
||||||
needs: [ unit-tests, bootstrap ]
|
needs: [ windows, unit-tests, bootstrap ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Success
|
- name: Success
|
||||||
|
|||||||
4
.github/workflows/nightly-win-builds.yml
vendored
4
.github/workflows/nightly-win-builds.yml
vendored
@@ -14,10 +14,10 @@ jobs:
|
|||||||
build-paraview-deps:
|
build-paraview-deps:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: 3.9
|
||||||
- name: Install Python packages
|
- name: Install Python packages
|
||||||
|
|||||||
10
.github/workflows/style/requirements.txt
vendored
10
.github/workflows/style/requirements.txt
vendored
@@ -1,7 +1,7 @@
|
|||||||
black==24.4.2
|
black==23.11.0
|
||||||
clingo==5.7.1
|
clingo==5.6.2
|
||||||
flake8==7.0.0
|
flake8==6.1.0
|
||||||
isort==5.13.2
|
isort==5.12.0
|
||||||
mypy==1.8.0
|
mypy==1.7.1
|
||||||
types-six==1.16.21.9
|
types-six==1.16.21.9
|
||||||
vermin==1.6.0
|
vermin==1.6.0
|
||||||
|
|||||||
86
.github/workflows/unit_tests.yaml
vendored
86
.github/workflows/unit_tests.yaml
vendored
@@ -14,14 +14,14 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-22.04]
|
os: [ubuntu-latest]
|
||||||
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
|
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
|
||||||
concretizer: ['clingo']
|
concretizer: ['clingo']
|
||||||
on_develop:
|
on_develop:
|
||||||
- ${{ github.ref == 'refs/heads/develop' }}
|
- ${{ github.ref == 'refs/heads/develop' }}
|
||||||
include:
|
include:
|
||||||
- python-version: '3.11'
|
- python-version: '3.11'
|
||||||
os: ubuntu-20.04
|
os: ubuntu-latest
|
||||||
concretizer: original
|
concretizer: original
|
||||||
on_develop: ${{ github.ref == 'refs/heads/develop' }}
|
on_develop: ${{ github.ref == 'refs/heads/develop' }}
|
||||||
- python-version: '3.6'
|
- python-version: '3.6'
|
||||||
@@ -30,31 +30,31 @@ jobs:
|
|||||||
on_develop: ${{ github.ref == 'refs/heads/develop' }}
|
on_develop: ${{ github.ref == 'refs/heads/develop' }}
|
||||||
exclude:
|
exclude:
|
||||||
- python-version: '3.7'
|
- python-version: '3.7'
|
||||||
|
os: ubuntu-latest
|
||||||
concretizer: 'clingo'
|
concretizer: 'clingo'
|
||||||
os: ubuntu-22.04
|
|
||||||
on_develop: false
|
on_develop: false
|
||||||
- python-version: '3.8'
|
- python-version: '3.8'
|
||||||
|
os: ubuntu-latest
|
||||||
concretizer: 'clingo'
|
concretizer: 'clingo'
|
||||||
os: ubuntu-22.04
|
|
||||||
on_develop: false
|
on_develop: false
|
||||||
- python-version: '3.9'
|
- python-version: '3.9'
|
||||||
|
os: ubuntu-latest
|
||||||
concretizer: 'clingo'
|
concretizer: 'clingo'
|
||||||
os: ubuntu-22.04
|
|
||||||
on_develop: false
|
on_develop: false
|
||||||
- python-version: '3.10'
|
- python-version: '3.10'
|
||||||
|
os: ubuntu-latest
|
||||||
concretizer: 'clingo'
|
concretizer: 'clingo'
|
||||||
os: ubuntu-22.04
|
|
||||||
on_develop: false
|
on_develop: false
|
||||||
- python-version: '3.11'
|
- python-version: '3.11'
|
||||||
|
os: ubuntu-latest
|
||||||
concretizer: 'clingo'
|
concretizer: 'clingo'
|
||||||
os: ubuntu-22.04
|
|
||||||
on_develop: false
|
on_develop: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # @v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install System packages
|
- name: Install System packages
|
||||||
@@ -91,19 +91,17 @@ jobs:
|
|||||||
UNIT_TEST_COVERAGE: ${{ matrix.python-version == '3.11' }}
|
UNIT_TEST_COVERAGE: ${{ matrix.python-version == '3.11' }}
|
||||||
run: |
|
run: |
|
||||||
share/spack/qa/run-unit-tests
|
share/spack/qa/run-unit-tests
|
||||||
- uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be
|
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
|
||||||
with:
|
with:
|
||||||
flags: unittests,linux,${{ matrix.concretizer }}
|
flags: unittests,linux,${{ matrix.concretizer }}
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
verbose: true
|
|
||||||
# Test shell integration
|
# Test shell integration
|
||||||
shell:
|
shell:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # @v2
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
- name: Install System packages
|
- name: Install System packages
|
||||||
@@ -124,11 +122,9 @@ jobs:
|
|||||||
COVERAGE: true
|
COVERAGE: true
|
||||||
run: |
|
run: |
|
||||||
share/spack/qa/run-shell-tests
|
share/spack/qa/run-shell-tests
|
||||||
- uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be
|
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
|
||||||
with:
|
with:
|
||||||
flags: shelltests,linux
|
flags: shelltests,linux
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
verbose: true
|
|
||||||
|
|
||||||
# Test RHEL8 UBI with platform Python. This job is run
|
# Test RHEL8 UBI with platform Python. This job is run
|
||||||
# only on PRs modifying core Spack
|
# only on PRs modifying core Spack
|
||||||
@@ -141,7 +137,7 @@ jobs:
|
|||||||
dnf install -y \
|
dnf install -y \
|
||||||
bzip2 curl file gcc-c++ gcc gcc-gfortran git gnupg2 gzip \
|
bzip2 curl file gcc-c++ gcc gcc-gfortran git gnupg2 gzip \
|
||||||
make patch tcl unzip which xz
|
make patch tcl unzip which xz
|
||||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2
|
||||||
- name: Setup repo and non-root user
|
- name: Setup repo and non-root user
|
||||||
run: |
|
run: |
|
||||||
git --version
|
git --version
|
||||||
@@ -158,12 +154,12 @@ jobs:
|
|||||||
spack unit-test -k 'not cvs and not svn and not hg' -x --verbose
|
spack unit-test -k 'not cvs and not svn and not hg' -x --verbose
|
||||||
# Test for the clingo based solver (using clingo-cffi)
|
# Test for the clingo based solver (using clingo-cffi)
|
||||||
clingo-cffi:
|
clingo-cffi:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # @v2
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
- name: Install System packages
|
- name: Install System packages
|
||||||
@@ -185,23 +181,20 @@ jobs:
|
|||||||
SPACK_TEST_SOLVER: clingo
|
SPACK_TEST_SOLVER: clingo
|
||||||
run: |
|
run: |
|
||||||
share/spack/qa/run-unit-tests
|
share/spack/qa/run-unit-tests
|
||||||
- uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be
|
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # @v2.1.0
|
||||||
with:
|
with:
|
||||||
flags: unittests,linux,clingo
|
flags: unittests,linux,clingo
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
verbose: true
|
|
||||||
# Run unit tests on MacOS
|
# Run unit tests on MacOS
|
||||||
macos:
|
macos:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: macos-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-13, macos-14]
|
|
||||||
python-version: ["3.11"]
|
python-version: ["3.11"]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # @v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install Python packages
|
- name: Install Python packages
|
||||||
@@ -223,39 +216,6 @@ jobs:
|
|||||||
$(which spack) solve zlib
|
$(which spack) solve zlib
|
||||||
common_args=(--dist loadfile --tx '4*popen//python=./bin/spack-tmpconfig python -u ./bin/spack python' -x)
|
common_args=(--dist loadfile --tx '4*popen//python=./bin/spack-tmpconfig python -u ./bin/spack python' -x)
|
||||||
$(which spack) unit-test --verbose --cov --cov-config=pyproject.toml --cov-report=xml:coverage.xml "${common_args[@]}"
|
$(which spack) unit-test --verbose --cov --cov-config=pyproject.toml --cov-report=xml:coverage.xml "${common_args[@]}"
|
||||||
- uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be
|
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
|
||||||
with:
|
with:
|
||||||
flags: unittests,macos
|
flags: unittests,macos
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
verbose: true
|
|
||||||
# Run unit tests on Windows
|
|
||||||
windows:
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell:
|
|
||||||
powershell Invoke-Expression -Command "./share/spack/qa/windows_test_setup.ps1"; {0}
|
|
||||||
runs-on: windows-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
|
||||||
with:
|
|
||||||
python-version: 3.9
|
|
||||||
- name: Install Python packages
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip pywin32 setuptools pytest-cov clingo
|
|
||||||
- name: Create local develop
|
|
||||||
run: |
|
|
||||||
./.github/workflows/setup_git.ps1
|
|
||||||
- name: Unit Test
|
|
||||||
run: |
|
|
||||||
spack unit-test -x --verbose --cov --cov-config=pyproject.toml
|
|
||||||
./share/spack/qa/validate_last_exit.ps1
|
|
||||||
coverage combine -a
|
|
||||||
coverage xml
|
|
||||||
- uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c
|
|
||||||
with:
|
|
||||||
flags: unittests,windows
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
verbose: true
|
|
||||||
|
|||||||
11
.github/workflows/valid-style.yml
vendored
11
.github/workflows/valid-style.yml
vendored
@@ -18,8 +18,8 @@ jobs:
|
|||||||
validate:
|
validate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
@@ -35,10 +35,10 @@ jobs:
|
|||||||
style:
|
style:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
@@ -56,7 +56,6 @@ jobs:
|
|||||||
share/spack/qa/run-style-tests
|
share/spack/qa/run-style-tests
|
||||||
audit:
|
audit:
|
||||||
uses: ./.github/workflows/audit.yaml
|
uses: ./.github/workflows/audit.yaml
|
||||||
secrets: inherit
|
|
||||||
with:
|
with:
|
||||||
with_coverage: ${{ inputs.with_coverage }}
|
with_coverage: ${{ inputs.with_coverage }}
|
||||||
python_version: '3.11'
|
python_version: '3.11'
|
||||||
@@ -70,7 +69,7 @@ jobs:
|
|||||||
dnf install -y \
|
dnf install -y \
|
||||||
bzip2 curl file gcc-c++ gcc gcc-gfortran git gnupg2 gzip \
|
bzip2 curl file gcc-c++ gcc gcc-gfortran git gnupg2 gzip \
|
||||||
make patch tcl unzip which xz
|
make patch tcl unzip which xz
|
||||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2
|
||||||
- name: Setup repo and non-root user
|
- name: Setup repo and non-root user
|
||||||
run: |
|
run: |
|
||||||
git --version
|
git --version
|
||||||
|
|||||||
79
.github/workflows/windows_python.yml
vendored
Normal file
79
.github/workflows/windows_python.yml
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
name: windows
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: windows-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell:
|
||||||
|
powershell Invoke-Expression -Command "./share/spack/qa/windows_test_setup.ps1"; {0}
|
||||||
|
jobs:
|
||||||
|
unit-tests:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
|
||||||
|
with:
|
||||||
|
python-version: 3.9
|
||||||
|
- name: Install Python packages
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip pywin32 setuptools pytest-cov clingo
|
||||||
|
- name: Create local develop
|
||||||
|
run: |
|
||||||
|
./.github/workflows/setup_git.ps1
|
||||||
|
- name: Unit Test
|
||||||
|
run: |
|
||||||
|
spack unit-test -x --verbose --cov --cov-config=pyproject.toml --ignore=lib/spack/spack/test/cmd
|
||||||
|
./share/spack/qa/validate_last_exit.ps1
|
||||||
|
coverage combine -a
|
||||||
|
coverage xml
|
||||||
|
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
|
||||||
|
with:
|
||||||
|
flags: unittests,windows
|
||||||
|
unit-tests-cmd:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
|
||||||
|
with:
|
||||||
|
python-version: 3.9
|
||||||
|
- name: Install Python packages
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip pywin32 setuptools coverage pytest-cov clingo
|
||||||
|
- name: Create local develop
|
||||||
|
run: |
|
||||||
|
./.github/workflows/setup_git.ps1
|
||||||
|
- name: Command Unit Test
|
||||||
|
run: |
|
||||||
|
spack unit-test -x --verbose --cov --cov-config=pyproject.toml lib/spack/spack/test/cmd
|
||||||
|
./share/spack/qa/validate_last_exit.ps1
|
||||||
|
coverage combine -a
|
||||||
|
coverage xml
|
||||||
|
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
|
||||||
|
with:
|
||||||
|
flags: unittests,windows
|
||||||
|
build-abseil:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
|
||||||
|
with:
|
||||||
|
python-version: 3.9
|
||||||
|
- name: Install Python packages
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip pywin32 setuptools coverage
|
||||||
|
- name: Build Test
|
||||||
|
run: |
|
||||||
|
spack compiler find
|
||||||
|
spack -d external find cmake ninja
|
||||||
|
spack -d install abseil-cpp
|
||||||
@@ -14,26 +14,3 @@ sphinx:
|
|||||||
python:
|
python:
|
||||||
install:
|
install:
|
||||||
- requirements: lib/spack/docs/requirements.txt
|
- requirements: lib/spack/docs/requirements.txt
|
||||||
|
|
||||||
search:
|
|
||||||
ranking:
|
|
||||||
spack.html: -10
|
|
||||||
spack.*.html: -10
|
|
||||||
llnl.html: -10
|
|
||||||
llnl.*.html: -10
|
|
||||||
_modules/*: -10
|
|
||||||
command_index.html: -9
|
|
||||||
basic_usage.html: 5
|
|
||||||
configuration.html: 5
|
|
||||||
config_yaml.html: 5
|
|
||||||
packages_yaml.html: 5
|
|
||||||
build_settings.html: 5
|
|
||||||
environments.html: 5
|
|
||||||
containers.html: 5
|
|
||||||
mirrors.html: 5
|
|
||||||
module_file_support.html: 5
|
|
||||||
repositories.html: 5
|
|
||||||
binary_caches.html: 5
|
|
||||||
chain.html: 5
|
|
||||||
pipelines.html: 5
|
|
||||||
packaging_guide.html: 5
|
|
||||||
|
|||||||
463
CHANGELOG.md
463
CHANGELOG.md
@@ -1,466 +1,3 @@
|
|||||||
# v0.22.4 (2025-02-18)
|
|
||||||
|
|
||||||
## Bugfixes
|
|
||||||
- Continue to mark non-roots as implicitly installed on partial env installs (#47183)
|
|
||||||
|
|
||||||
# v0.22.3 (2024-11-18)
|
|
||||||
|
|
||||||
## Bugfixes
|
|
||||||
- Forward compatibility with Python 3.13 (#46775, #46983, #47035, #47175)
|
|
||||||
- `archspec` was updated to v0.2.5 (#46503, #46958)
|
|
||||||
- Fix path to Spack in `spack env depfile` makefile (#46966)
|
|
||||||
- Fix `glibc` detection in Chinese locales (#47434)
|
|
||||||
- Fix pickle round-trip of specs propagating variants (#47351)
|
|
||||||
- Fix a bug where concurrent spack install commands would not always update explicits correctly
|
|
||||||
(#47358)
|
|
||||||
- Fix a bug where autopush would run before all post install hooks modifying the install prefix
|
|
||||||
had run (#47329)
|
|
||||||
- Fix `spack find -u` (#47102)
|
|
||||||
- Fix a bug where sometimes the wrong Python interpreter was used for build dependencies such as
|
|
||||||
`py-setuptools` (#46980)
|
|
||||||
- Fix default config errors found by `spack audit externals` (#47308)
|
|
||||||
- Fix duplicate printing of external roots in installer (#44917)
|
|
||||||
- Fix modules schema in `compilers.yaml` (#47197)
|
|
||||||
- Reduce the size of generated YAML for Gitlab CI (#44995)
|
|
||||||
- Handle missing metadata file gracefully in bootstrap (#47278)
|
|
||||||
- Show underlying errors on fetch failure (#45714)
|
|
||||||
- Recognize `.` and `..` as paths instead of names in buildcache commands (#47105)
|
|
||||||
- Documentation and style (#46991, #47107, #47110, #47111, #47346, #47307, #47309, #47328, #47160,
|
|
||||||
#47402, #47557, #46709, #47080)
|
|
||||||
- Tests and CI fixes (#47165, #46711)
|
|
||||||
|
|
||||||
## Package updates
|
|
||||||
- ffmpeg: fix hash of patch (#45574)
|
|
||||||
|
|
||||||
# v0.22.2 (2024-09-21)
|
|
||||||
|
|
||||||
## Bugfixes
|
|
||||||
- Forward compatibility with Spack 0.23 packages with language dependencies (#45205, #45191)
|
|
||||||
- Forward compatibility with `urllib` from Python 3.12.6+ (#46453, #46483)
|
|
||||||
- Bump vendored `archspec` for better aarch64 support (#45721, #46445)
|
|
||||||
- Support macOS Sequoia (#45018, #45127)
|
|
||||||
- Fix regression in `{variants.X}` and `{variants.X.value}` format strings (#46206)
|
|
||||||
- Ensure shell escaping of environment variable values in load and activate commands (#42780)
|
|
||||||
- Fix an issue where `spec[pkg]` considers specs outside the current DAG (#45090)
|
|
||||||
- Do not halt concretization on unknown variants in externals (#45326)
|
|
||||||
- Improve validation of `develop` config section (#46485)
|
|
||||||
- Explicitly disable `ccache` if turned off in config, to avoid cache pollution (#45275)
|
|
||||||
- Improve backwards compatibility in `include_concrete` (#45766)
|
|
||||||
- Fix issue where package tags were sometimes repeated (#45160)
|
|
||||||
- Make `setup-env.sh` "sourced only" by dropping execution bits (#45641)
|
|
||||||
- Make certain source/binary fetch errors recoverable instead of a hard error (#45683)
|
|
||||||
- Remove debug statements in package hash computation (#45235)
|
|
||||||
- Remove redundant clingo warnings (#45269)
|
|
||||||
- Remove hard-coded layout version (#45645)
|
|
||||||
- Do not initialize previous store state in `use_store` (#45268)
|
|
||||||
- Docs improvements (#46475)
|
|
||||||
|
|
||||||
## Package updates
|
|
||||||
- `chapel` major update (#42197, #44931, #45304)
|
|
||||||
|
|
||||||
# v0.22.1 (2024-07-04)
|
|
||||||
|
|
||||||
## Bugfixes
|
|
||||||
- Fix reuse of externals on Linux (#44316)
|
|
||||||
- Ensure parent gcc-runtime version >= child (#44834, #44870)
|
|
||||||
- Ensure the latest gcc-runtime is rpath'ed when multiple exist among link deps (#44219)
|
|
||||||
- Improve version detection of glibc (#44154)
|
|
||||||
- Improve heuristics for solver (#44893, #44976, #45023)
|
|
||||||
- Make strong preferences override reuse (#44373)
|
|
||||||
- Reduce verbosity when C compiler is missing (#44182)
|
|
||||||
- Make missing ccache executable an error when required (#44740)
|
|
||||||
- Make every environment view containing `python` a `venv` (#44382)
|
|
||||||
- Fix external detection for compilers with os but no target (#44156)
|
|
||||||
- Fix version optimization for roots (#44272)
|
|
||||||
- Handle common implementations of pagination of tags in OCI build caches (#43136)
|
|
||||||
- Apply fetched patches to develop specs (#44950)
|
|
||||||
- Avoid Windows wrappers for filesystem utilities on non-Windows (#44126)
|
|
||||||
- Fix issue with long filenames in build caches on Windows (#43851)
|
|
||||||
- Fix formatting issue in `spack audit` (#45045)
|
|
||||||
- CI fixes (#44582, #43965, #43967, #44279, #44213)
|
|
||||||
|
|
||||||
## Package updates
|
|
||||||
- protobuf: fix 3.4:3.21 patch checksum (#44443)
|
|
||||||
- protobuf: update hash for patch needed when="@3.4:3.21" (#44210)
|
|
||||||
- git: bump v2.39 to 2.45; deprecate unsafe versions (#44248)
|
|
||||||
- gcc: use -rpath {rpath_dir} not -rpath={rpath dir} (#44315)
|
|
||||||
- Remove mesa18 and libosmesa (#44264)
|
|
||||||
- Enforce consistency of `gl` providers (#44307)
|
|
||||||
- Require libiconv for iconv (#44335, #45026).
|
|
||||||
Notice that glibc/musl also provide iconv, but are not guaranteed to be
|
|
||||||
complete. Set `packages:iconv:require:[glibc]` to restore the old behavior.
|
|
||||||
- py-matplotlib: qualify when to do a post install (#44191)
|
|
||||||
- rust: fix v1.78.0 instructions (#44127)
|
|
||||||
- suite-sparse: improve setting of the `libs` property (#44214)
|
|
||||||
- netlib-lapack: provide blas and lapack together (#44981)
|
|
||||||
|
|
||||||
|
|
||||||
# v0.22.0 (2024-05-12)
|
|
||||||
|
|
||||||
`v0.22.0` is a major feature release.
|
|
||||||
|
|
||||||
## Features in this release
|
|
||||||
|
|
||||||
1. **Compiler dependencies**
|
|
||||||
|
|
||||||
We are in the process of making compilers proper dependencies in Spack, and a number
|
|
||||||
of changes in `v0.22` support that effort. You may notice nodes in your dependency
|
|
||||||
graphs for compiler runtime libraries like `gcc-runtime` or `libgfortran`, and you
|
|
||||||
may notice that Spack graphs now include `libc`. We've also begun moving compiler
|
|
||||||
configuration from `compilers.yaml` to `packages.yaml` to make it consistent with
|
|
||||||
other externals. We are trying to do this with the least disruption possible, so
|
|
||||||
your existing `compilers.yaml` files should still work. We expect to be done with
|
|
||||||
this transition by the `v0.23` release in November.
|
|
||||||
|
|
||||||
* #41104: Packages compiled with `%gcc` on Linux, macOS and FreeBSD now depend on a
|
|
||||||
new package `gcc-runtime`, which contains a copy of the shared compiler runtime
|
|
||||||
libraries. This enables gcc runtime libraries to be installed and relocated when
|
|
||||||
using a build cache. When building minimal Spack-generated container images it is
|
|
||||||
no longer necessary to install libgfortran, libgomp etc. using the system package
|
|
||||||
manager.
|
|
||||||
|
|
||||||
* #42062: Packages compiled with `%oneapi` now depend on a new package
|
|
||||||
`intel-oneapi-runtime`. This is similar to `gcc-runtime`, and the runtimes can
|
|
||||||
provide virtuals and compilers can inject dependencies on virtuals into compiled
|
|
||||||
packages. This allows us to model library soname compatibility and allows
|
|
||||||
compilers like `%oneapi` to provide virtuals like `sycl` (which can also be
|
|
||||||
provided by standalone libraries). Note that until we have an agreement in place
|
|
||||||
with intel, Intel packages are marked `redistribute(source=False, binary=False)`
|
|
||||||
and must be downloaded outside of Spack.
|
|
||||||
|
|
||||||
* #43272: changes to the optimization criteria of the solver improve the hit-rate of
|
|
||||||
buildcaches by a fair amount. The solver more relaxed compatibility rules and will
|
|
||||||
not try to strictly match compilers or targets of reused specs. Users can still
|
|
||||||
enforce the previous strict behavior with `require:` sections in `packages.yaml`.
|
|
||||||
Note that to enforce correct linking, Spack will *not* reuse old `%gcc` and
|
|
||||||
`%oneapi` specs that do not have the runtime libraries as a dependency.
|
|
||||||
|
|
||||||
* #43539: Spack will reuse specs built with compilers that are *not* explicitly
|
|
||||||
configured in `compilers.yaml`. Because we can now keep runtime libraries in build
|
|
||||||
cache, we do not require you to also have a local configured compiler to *use* the
|
|
||||||
runtime libraries. This improves reuse in buildcaches and avoids conflicts with OS
|
|
||||||
updates that happen underneath Spack.
|
|
||||||
|
|
||||||
* #43190: binary compatibility on `linux` is now based on the `libc` version,
|
|
||||||
instead of on the `os` tag. Spack builds now detect the host `libc` (`glibc` or
|
|
||||||
`musl`) and add it as an implicit external node in the dependency graph. Binaries
|
|
||||||
with a `libc` with the same name and a version less than or equal to that of the
|
|
||||||
detected `libc` can be reused. This is only on `linux`, not `macos` or `Windows`.
|
|
||||||
|
|
||||||
* #43464: each package that can provide a compiler is now detectable using `spack
|
|
||||||
external find`. External packages defining compiler paths are effectively used as
|
|
||||||
compilers, and `spack external find -t compiler` can be used as a substitute for
|
|
||||||
`spack compiler find`. More details on this transition are in
|
|
||||||
[the docs](https://spack.readthedocs.io/en/latest/getting_started.html#manual-compiler-configuration)
|
|
||||||
|
|
||||||
2. **Improved `spack find` UI for Environments**
|
|
||||||
|
|
||||||
If you're working in an enviroment, you likely care about:
|
|
||||||
|
|
||||||
* What are the roots
|
|
||||||
* Which ones are installed / not installed
|
|
||||||
* What's been added that still needs to be concretized
|
|
||||||
|
|
||||||
We've tweaked `spack find` in environments to show this information much more
|
|
||||||
clearly. Installation status is shown next to each root, so you can see what is
|
|
||||||
installed. Roots are also shown in bold in the list of installed packages. There is
|
|
||||||
also a new option for `spack find -r` / `--only-roots` that will only show env
|
|
||||||
roots, if you don't want to look at all the installed specs.
|
|
||||||
|
|
||||||
More details in #42334.
|
|
||||||
|
|
||||||
3. **Improved command-line string quoting**
|
|
||||||
|
|
||||||
We are making some breaking changes to how Spack parses specs on the CLI in order to
|
|
||||||
respect shell quoting instead of trying to fight it. If you (sadly) had to write
|
|
||||||
something like this on the command line:
|
|
||||||
|
|
||||||
```
|
|
||||||
spack install zlib cflags=\"-O2 -g\"
|
|
||||||
```
|
|
||||||
|
|
||||||
That will now result in an error, but you can now write what you probably expected
|
|
||||||
to work in the first place:
|
|
||||||
|
|
||||||
```
|
|
||||||
spack install zlib cflags="-O2 -g"
|
|
||||||
```
|
|
||||||
|
|
||||||
Quoted can also now include special characters, so you can supply flags like:
|
|
||||||
|
|
||||||
```
|
|
||||||
spack intall zlib ldflags='-Wl,-rpath=$ORIGIN/_libs'
|
|
||||||
```
|
|
||||||
|
|
||||||
To reduce ambiguity in parsing, we now require that you *not* put spaces around `=`
|
|
||||||
and `==` when for flags or variants. This would not have broken before but will now
|
|
||||||
result in an error:
|
|
||||||
|
|
||||||
```
|
|
||||||
spack install zlib cflags = "-O2 -g"
|
|
||||||
```
|
|
||||||
|
|
||||||
More details and discussion in #30634.
|
|
||||||
|
|
||||||
4. **Revert default `spack install` behavior to `--reuse`**
|
|
||||||
|
|
||||||
We changed the default concretizer behavior from `--reuse` to `--reuse-deps` in
|
|
||||||
#30990 (in `v0.20`), which meant that *every* `spack install` invocation would
|
|
||||||
attempt to build a new version of the requested package / any environment roots.
|
|
||||||
While this is a common ask for *upgrading* and for *developer* workflows, we don't
|
|
||||||
think it should be the default for a package manager.
|
|
||||||
|
|
||||||
We are going to try to stick to this policy:
|
|
||||||
1. Prioritize reuse and build as little as possible by default.
|
|
||||||
2. Only upgrade or install duplicates if they are explicitly asked for, or if there
|
|
||||||
is a known security issue that necessitates an upgrade.
|
|
||||||
|
|
||||||
With the install command you now have three options:
|
|
||||||
|
|
||||||
* `--reuse` (default): reuse as many existing installations as possible.
|
|
||||||
* `--reuse-deps` / `--fresh-roots`: upgrade (freshen) roots but reuse dependencies if possible.
|
|
||||||
* `--fresh`: install fresh versions of requested packages (roots) and their dependencies.
|
|
||||||
|
|
||||||
We've also introduced `--fresh-roots` as an alias for `--reuse-deps` to make it more clear
|
|
||||||
that it may give you fresh versions. More details in #41302 and #43988.
|
|
||||||
|
|
||||||
5. **More control over reused specs**
|
|
||||||
|
|
||||||
You can now control which packages to reuse and how. There is a new
|
|
||||||
`concretizer:reuse` config option, which accepts the following properties:
|
|
||||||
|
|
||||||
- `roots`: `true` to reuse roots, `false` to reuse just dependencies
|
|
||||||
- `exclude`: list of constraints used to select which specs *not* to reuse
|
|
||||||
- `include`: list of constraints used to select which specs *to* reuse
|
|
||||||
- `from`: list of sources for reused specs (some combination of `local`,
|
|
||||||
`buildcache`, or `external`)
|
|
||||||
|
|
||||||
For example, to reuse only specs compiled with GCC, you could write:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
concretizer:
|
|
||||||
reuse:
|
|
||||||
roots: true
|
|
||||||
include:
|
|
||||||
- "%gcc"
|
|
||||||
```
|
|
||||||
|
|
||||||
Or, if `openmpi` must be used from externals, and it must be the only external used:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
concretizer:
|
|
||||||
reuse:
|
|
||||||
roots: true
|
|
||||||
from:
|
|
||||||
- type: local
|
|
||||||
exclude: ["openmpi"]
|
|
||||||
- type: buildcache
|
|
||||||
exclude: ["openmpi"]
|
|
||||||
- type: external
|
|
||||||
include: ["openmpi"]
|
|
||||||
```
|
|
||||||
|
|
||||||
6. **New `redistribute()` directive**
|
|
||||||
|
|
||||||
Some packages can't be redistributed in source or binary form. We need an explicit
|
|
||||||
way to say that in a package.
|
|
||||||
|
|
||||||
Now there is a `redistribute()` directive so that package authors can write:
|
|
||||||
|
|
||||||
```python
|
|
||||||
class MyPackage(Package):
|
|
||||||
redistribute(source=False, binary=False)
|
|
||||||
```
|
|
||||||
|
|
||||||
Like other directives, this works with `when=`:
|
|
||||||
|
|
||||||
```python
|
|
||||||
class MyPackage(Package):
|
|
||||||
# 12.0 and higher are proprietary
|
|
||||||
redistribute(source=False, binary=False, when="@12.0:")
|
|
||||||
|
|
||||||
# can't redistribute when we depend on some proprietary dependency
|
|
||||||
redistribute(source=False, binary=False, when="^proprietary-dependency")
|
|
||||||
```
|
|
||||||
|
|
||||||
More in #20185.
|
|
||||||
|
|
||||||
7. **New `conflict:` and `prefer:` syntax for package preferences**
|
|
||||||
|
|
||||||
Previously, you could express conflicts and preferences in `packages.yaml` through
|
|
||||||
some contortions with `require:`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
packages:
|
|
||||||
zlib-ng:
|
|
||||||
require:
|
|
||||||
- one_of: ["%clang", "@:"] # conflict on %clang
|
|
||||||
- any_of: ["+shared", "@:"] # strong preference for +shared
|
|
||||||
```
|
|
||||||
|
|
||||||
You can now use `require:` and `prefer:` for a much more readable configuration:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
packages:
|
|
||||||
zlib-ng:
|
|
||||||
conflict:
|
|
||||||
- "%clang"
|
|
||||||
prefer:
|
|
||||||
- "+shared"
|
|
||||||
```
|
|
||||||
|
|
||||||
See [the documentation](https://spack.readthedocs.io/en/latest/packages_yaml.html#conflicts-and-strong-preferences)
|
|
||||||
and #41832 for more details.
|
|
||||||
|
|
||||||
8. **`include_concrete` in environments**
|
|
||||||
|
|
||||||
You may want to build on the *concrete* contents of another environment without
|
|
||||||
changing that environment. You can now include the concrete specs from another
|
|
||||||
environment's `spack.lock` with `include_concrete`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
spack:
|
|
||||||
specs: []
|
|
||||||
concretizer:
|
|
||||||
unify: true
|
|
||||||
include_concrete:
|
|
||||||
- /path/to/environment1
|
|
||||||
- /path/to/environment2
|
|
||||||
```
|
|
||||||
|
|
||||||
Now, when *this* environment is concretized, it will bring in the already concrete
|
|
||||||
specs from `environment1` and `environment2`, and build on top of them without
|
|
||||||
changing them. This is useful if you have phased deployments, where old deployments
|
|
||||||
should not be modified but you want to use as many of them as possible. More details
|
|
||||||
in #33768.
|
|
||||||
|
|
||||||
9. **`python-venv` isolation**
|
|
||||||
|
|
||||||
Spack has unique requirements for Python because it:
|
|
||||||
1. installs every package in its own independent directory, and
|
|
||||||
2. allows users to register *external* python installations.
|
|
||||||
|
|
||||||
External installations may contain their own installed packages that can interfere
|
|
||||||
with Spack installations, and some distributions (Debian and Ubuntu) even change the
|
|
||||||
`sysconfig` in ways that alter the installation layout of installed Python packages
|
|
||||||
(e.g., with the addition of a `/local` prefix on Debian or Ubuntu). To isolate Spack
|
|
||||||
from these and other issues, we now insert a small `python-venv` package in between
|
|
||||||
`python` and packages that need to install Python code. This isolates Spack's build
|
|
||||||
environment, isolates Spack from any issues with an external python, and resolves a
|
|
||||||
large number of issues we've had with Python installations.
|
|
||||||
|
|
||||||
See #40773 for further details.
|
|
||||||
|
|
||||||
## New commands, options, and directives
|
|
||||||
|
|
||||||
* Allow packages to be pushed to build cache after install from source (#42423)
|
|
||||||
* `spack develop`: stage build artifacts in same root as non-dev builds #41373
|
|
||||||
* Don't delete `spack develop` build artifacts after install (#43424)
|
|
||||||
* `spack find`: add options for local/upstream only (#42999)
|
|
||||||
* `spack logs`: print log files for packages (either partially built or installed) (#42202)
|
|
||||||
* `patch`: support reversing patches (#43040)
|
|
||||||
* `develop`: Add -b/--build-directory option to set build_directory package attribute (#39606)
|
|
||||||
* `spack list`: add `--namesapce` / `--repo` option (#41948)
|
|
||||||
* directives: add `checked_by` field to `license()`, add some license checks
|
|
||||||
* `spack gc`: add options for environments and build dependencies (#41731)
|
|
||||||
* Add `--create` to `spack env activate` (#40896)
|
|
||||||
|
|
||||||
## Performance improvements
|
|
||||||
|
|
||||||
* environment.py: fix excessive re-reads (#43746)
|
|
||||||
* ruamel yaml: fix quadratic complexity bug (#43745)
|
|
||||||
* Refactor to improve `spec format` speed (#43712)
|
|
||||||
* Do not acquire a write lock on the env post install if no views (#43505)
|
|
||||||
* asp.py: fewer calls to `spec.copy()` (#43715)
|
|
||||||
* spec.py: early return in `__str__`
|
|
||||||
* avoid `jinja2` import at startup unless needed (#43237)
|
|
||||||
|
|
||||||
## Other new features of note
|
|
||||||
|
|
||||||
* `archspec`: update to `v0.2.4`: support for Windows, bugfixes for `neoverse-v1` and
|
|
||||||
`neoverse-v2` detection.
|
|
||||||
* `spack config get`/`blame`: with no args, show entire config
|
|
||||||
* `spack env create <env>`: dir if dir-like (#44024)
|
|
||||||
* ASP-based solver: update os compatibility for macOS (#43862)
|
|
||||||
* Add handling of custom ssl certs in urllib ops (#42953)
|
|
||||||
* Add ability to rename environments (#43296)
|
|
||||||
* Add config option and compiler support to reuse across OS's (#42693)
|
|
||||||
* Support for prereleases (#43140)
|
|
||||||
* Only reuse externals when configured (#41707)
|
|
||||||
* Environments: Add support for including views (#42250)
|
|
||||||
|
|
||||||
## Binary caches
|
|
||||||
* Build cache: make signed/unsigned a mirror property (#41507)
|
|
||||||
* tools stack
|
|
||||||
|
|
||||||
## Removals, deprecations, and syntax changes
|
|
||||||
* remove `dpcpp` compiler and package (#43418)
|
|
||||||
* spack load: remove --only argument (#42120)
|
|
||||||
|
|
||||||
## Notable Bugfixes
|
|
||||||
* repo.py: drop deleted packages from provider cache (#43779)
|
|
||||||
* Allow `+` in module file names (#41999)
|
|
||||||
* `cmd/python`: use runpy to allow multiprocessing in scripts (#41789)
|
|
||||||
* Show extension commands with spack -h (#41726)
|
|
||||||
* Support environment variable expansion inside module projections (#42917)
|
|
||||||
* Alert user to failed concretizations (#42655)
|
|
||||||
* shell: fix zsh color formatting for PS1 in environments (#39497)
|
|
||||||
* spack mirror create --all: include patches (#41579)
|
|
||||||
|
|
||||||
## Spack community stats
|
|
||||||
|
|
||||||
* 7,994 total packages; 525 since `v0.21.0`
|
|
||||||
* 178 new Python packages, 5 new R packages
|
|
||||||
* 358 people contributed to this release
|
|
||||||
* 344 committers to packages
|
|
||||||
* 45 committers to core
|
|
||||||
|
|
||||||
|
|
||||||
# v0.21.2 (2024-03-01)
|
|
||||||
|
|
||||||
## Bugfixes
|
|
||||||
|
|
||||||
- Containerize: accommodate nested or pre-existing spack-env paths (#41558)
|
|
||||||
- Fix setup-env script, when going back and forth between instances (#40924)
|
|
||||||
- Fix using fully-qualified namespaces from root specs (#41957)
|
|
||||||
- Fix a bug when a required provider is requested for multiple virtuals (#42088)
|
|
||||||
- OCI buildcaches:
|
|
||||||
- only push in parallel when forking (#42143)
|
|
||||||
- use pickleable errors (#42160)
|
|
||||||
- Fix using sticky variants in externals (#42253)
|
|
||||||
- Fix a rare issue with conditional requirements and multi-valued variants (#42566)
|
|
||||||
|
|
||||||
## Package updates
|
|
||||||
- rust: add v1.75, rework a few variants (#41161,#41903)
|
|
||||||
- py-transformers: add v4.35.2 (#41266)
|
|
||||||
- mgard: fix OpenMP on AppleClang (#42933)
|
|
||||||
|
|
||||||
# v0.21.1 (2024-01-11)
|
|
||||||
|
|
||||||
## New features
|
|
||||||
- Add support for reading buildcaches created by Spack v0.22 (#41773)
|
|
||||||
|
|
||||||
## Bugfixes
|
|
||||||
|
|
||||||
- spack graph: fix coloring with environments (#41240)
|
|
||||||
- spack info: sort variants in --variants-by-name (#41389)
|
|
||||||
- Spec.format: error on old style format strings (#41934)
|
|
||||||
- ASP-based solver:
|
|
||||||
- fix infinite recursion when computing concretization errors (#41061)
|
|
||||||
- don't error for type mismatch on preferences (#41138)
|
|
||||||
- don't emit spurious debug output (#41218)
|
|
||||||
- Improve the error message for deprecated preferences (#41075)
|
|
||||||
- Fix MSVC preview version breaking clingo build on Windows (#41185)
|
|
||||||
- Fix multi-word aliases (#41126)
|
|
||||||
- Add a warning for unconfigured compiler (#41213)
|
|
||||||
- environment: fix an issue with deconcretization/reconcretization of specs (#41294)
|
|
||||||
- buildcache: don't error if a patch is missing, when installing from binaries (#41986)
|
|
||||||
- Multiple improvements to unit-tests (#41215,#41369,#41495,#41359,#41361,#41345,#41342,#41308,#41226)
|
|
||||||
|
|
||||||
## Package updates
|
|
||||||
- root: add a webgui patch to address security issue (#41404)
|
|
||||||
- BerkeleyGW: update source urls (#38218)
|
|
||||||
|
|
||||||
# v0.21.0 (2023-11-11)
|
# v0.21.0 (2023-11-11)
|
||||||
|
|
||||||
`v0.21.0` is a major feature release.
|
`v0.21.0` is a major feature release.
|
||||||
|
|||||||
20
CITATION.cff
20
CITATION.cff
@@ -31,17 +31,13 @@ type: software
|
|||||||
message: "If you are referencing Spack in a publication, please cite the paper below."
|
message: "If you are referencing Spack in a publication, please cite the paper below."
|
||||||
title: "The Spack Package Manager: Bringing Order to HPC Software Chaos"
|
title: "The Spack Package Manager: Bringing Order to HPC Software Chaos"
|
||||||
abstract: >-
|
abstract: >-
|
||||||
Large HPC centers spend considerable time supporting software for thousands of users, but the
|
Large HPC centers spend considerable time supporting software for thousands of users, but the complexity of HPC software is quickly outpacing the capabilities of existing software management tools.
|
||||||
complexity of HPC software is quickly outpacing the capabilities of existing software management
|
Scientific applications require specific versions of compilers, MPI, and other dependency libraries, so using a single, standard software stack is infeasible.
|
||||||
tools. Scientific applications require specific versions of compilers, MPI, and other dependency
|
However, managing many configurations is difficult because the configuration space is combinatorial in size.
|
||||||
libraries, so using a single, standard software stack is infeasible. However, managing many
|
We introduce Spack, a tool used at Lawrence Livermore National Laboratory to manage this complexity.
|
||||||
configurations is difficult because the configuration space is combinatorial in size. We
|
Spack provides a novel, re- cursive specification syntax to invoke parametric builds of packages and dependencies.
|
||||||
introduce Spack, a tool used at Lawrence Livermore National Laboratory to manage this complexity.
|
It allows any number of builds to coexist on the same system, and it ensures that installed packages can find their dependencies, regardless of the environment.
|
||||||
Spack provides a novel, re- cursive specification syntax to invoke parametric builds of packages
|
We show through real-world use cases that Spack supports diverse and demanding applications, bringing order to HPC software chaos.
|
||||||
and dependencies. It allows any number of builds to coexist on the same system, and it ensures
|
|
||||||
that installed packages can find their dependencies, regardless of the environment. We show
|
|
||||||
through real-world use cases that Spack supports diverse and demanding applications, bringing
|
|
||||||
order to HPC software chaos.
|
|
||||||
preferred-citation:
|
preferred-citation:
|
||||||
title: "The Spack Package Manager: Bringing Order to HPC Software Chaos"
|
title: "The Spack Package Manager: Bringing Order to HPC Software Chaos"
|
||||||
type: conference-paper
|
type: conference-paper
|
||||||
@@ -75,7 +71,7 @@ preferred-citation:
|
|||||||
type: doi
|
type: doi
|
||||||
value: 10.1145/2807591.2807623
|
value: 10.1145/2807591.2807623
|
||||||
- description: "The DOE Document Release Number of the work"
|
- description: "The DOE Document Release Number of the work"
|
||||||
type: other
|
type: other
|
||||||
value: "LLNL-CONF-669890"
|
value: "LLNL-CONF-669890"
|
||||||
authors:
|
authors:
|
||||||
- family-names: "Gamblin"
|
- family-names: "Gamblin"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2013-2024 LLNS, LLC and other Spack Project Developers.
|
Copyright (c) 2013-2023 LLNS, LLC and other Spack Project Developers.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
41
README.md
41
README.md
@@ -1,34 +1,13 @@
|
|||||||
<div align="left">
|
# <img src="https://cdn.rawgit.com/spack/spack/develop/share/spack/logo/spack-logo.svg" width="64" valign="middle" alt="Spack"/> Spack
|
||||||
|
|
||||||
<h2>
|
[](https://github.com/spack/spack/actions)
|
||||||
<picture>
|
[](https://github.com/spack/spack/actions/workflows/bootstrap.yml)
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.rawgit.com/spack/spack/develop/share/spack/logo/spack-logo-white-text.svg" width="250">
|
[](https://codecov.io/gh/spack/spack)
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://cdn.rawgit.com/spack/spack/develop/share/spack/logo/spack-logo-text.svg" width="250">
|
[](https://github.com/spack/spack/actions/workflows/build-containers.yml)
|
||||||
<img alt="Spack" src="https://cdn.rawgit.com/spack/spack/develop/share/spack/logo/spack-logo-text.svg" width="250">
|
[](https://spack.readthedocs.io)
|
||||||
</picture>
|
[](https://github.com/psf/black)
|
||||||
|
[](https://slack.spack.io)
|
||||||
<br>
|
[](https://matrix.to/#/#spack-space:matrix.org)
|
||||||
<br clear="all">
|
|
||||||
|
|
||||||
<a href="https://github.com/spack/spack/actions/workflows/ci.yml"><img src="https://github.com/spack/spack/workflows/ci/badge.svg" alt="CI Status"></a>
|
|
||||||
<a href="https://github.com/spack/spack/actions/workflows/bootstrapping.yml"><img src="https://github.com/spack/spack/actions/workflows/bootstrap.yml/badge.svg" alt="Bootstrap Status"></a>
|
|
||||||
<a href="https://github.com/spack/spack/actions/workflows/build-containers.yml"><img src="https://github.com/spack/spack/actions/workflows/build-containers.yml/badge.svg" alt="Containers Status"></a>
|
|
||||||
<a href="https://spack.readthedocs.io"><img src="https://readthedocs.org/projects/spack/badge/?version=latest" alt="Documentation Status"></a>
|
|
||||||
<a href="https://codecov.io/gh/spack/spack"><img src="https://codecov.io/gh/spack/spack/branch/develop/graph/badge.svg" alt="Code coverage"/></a>
|
|
||||||
<a href="https://slack.spack.io"><img src="https://slack.spack.io/badge.svg" alt="Slack"/></a>
|
|
||||||
<a href="https://matrix.to/#/#spack-space:matrix.org"><img src="https://img.shields.io/matrix/spack-space%3Amatrix.org?label=matrix" alt="Matrix"/></a>
|
|
||||||
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
**[Getting Started] • [Config] • [Community] • [Contributing] • [Packaging Guide]**
|
|
||||||
|
|
||||||
[Getting Started]: https://spack.readthedocs.io/en/latest/getting_started.html
|
|
||||||
[Config]: https://spack.readthedocs.io/en/latest/configuration.html
|
|
||||||
[Community]: #community
|
|
||||||
[Contributing]: https://spack.readthedocs.io/en/latest/contribution_guide.html
|
|
||||||
[Packaging Guide]: https://spack.readthedocs.io/en/latest/packaging_guide.html
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
Spack is a multi-platform package manager that builds and installs
|
Spack is a multi-platform package manager that builds and installs
|
||||||
multiple versions and configurations of software. It works on Linux,
|
multiple versions and configurations of software. It works on Linux,
|
||||||
@@ -88,7 +67,7 @@ Resources:
|
|||||||
[bridged](https://github.com/matrix-org/matrix-appservice-slack#matrix-appservice-slack) to Slack.
|
[bridged](https://github.com/matrix-org/matrix-appservice-slack#matrix-appservice-slack) to Slack.
|
||||||
* [**Github Discussions**](https://github.com/spack/spack/discussions):
|
* [**Github Discussions**](https://github.com/spack/spack/discussions):
|
||||||
for Q&A and discussions. Note the pinned discussions for announcements.
|
for Q&A and discussions. Note the pinned discussions for announcements.
|
||||||
* **X**: [@spackpm](https://twitter.com/spackpm). Be sure to
|
* **Twitter**: [@spackpm](https://twitter.com/spackpm). Be sure to
|
||||||
`@mention` us!
|
`@mention` us!
|
||||||
* **Mailing list**: [groups.google.com/d/forum/spack](https://groups.google.com/d/forum/spack):
|
* **Mailing list**: [groups.google.com/d/forum/spack](https://groups.google.com/d/forum/spack):
|
||||||
only for announcements. Please use other venues for discussions.
|
only for announcements. Please use other venues for discussions.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# sbang project developers. See the top-level COPYRIGHT file for details.
|
# sbang project developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# -*- python -*-
|
# -*- python -*-
|
||||||
#
|
#
|
||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
:: Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
:: Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
:: Spack Project Developers. See the top-level COPYRIGHT file for details.
|
:: Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
::
|
::
|
||||||
:: SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
:: SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -144,5 +144,3 @@ switch($SpackSubCommand)
|
|||||||
"unload" {Invoke-SpackLoad}
|
"unload" {Invoke-SpackLoad}
|
||||||
default {python "$Env:SPACK_ROOT/bin/spack" $SpackCMD_params $SpackSubCommand $SpackSubCommandArgs}
|
default {python "$Env:SPACK_ROOT/bin/spack" $SpackCMD_params $SpackSubCommand $SpackSubCommandArgs}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit $LASTEXITCODE
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ concretizer:
|
|||||||
# as possible, rather than building. If `false`, we'll always give you a fresh
|
# as possible, rather than building. If `false`, we'll always give you a fresh
|
||||||
# concretization. If `dependencies`, we'll only reuse dependencies but
|
# concretization. If `dependencies`, we'll only reuse dependencies but
|
||||||
# give you a fresh concretization for your root specs.
|
# give you a fresh concretization for your root specs.
|
||||||
reuse: true
|
reuse: dependencies
|
||||||
# Options that tune which targets are considered for concretization. The
|
# Options that tune which targets are considered for concretization. The
|
||||||
# concretization process is very sensitive to the number targets, and the time
|
# concretization process is very sensitive to the number targets, and the time
|
||||||
# needed to reach a solution increases noticeably with the number of targets
|
# needed to reach a solution increases noticeably with the number of targets
|
||||||
@@ -42,8 +42,3 @@ concretizer:
|
|||||||
# "minimal": allows the duplication of 'build-tools' nodes only (e.g. py-setuptools, cmake etc.)
|
# "minimal": allows the duplication of 'build-tools' nodes only (e.g. py-setuptools, cmake etc.)
|
||||||
# "full" (experimental): allows separation of the entire build-tool stack (e.g. the entire "cmake" subDAG)
|
# "full" (experimental): allows separation of the entire build-tool stack (e.g. the entire "cmake" subDAG)
|
||||||
strategy: minimal
|
strategy: minimal
|
||||||
# Option to specify compatibility between operating systems for reuse of compilers and packages
|
|
||||||
# Specified as a key: [list] where the key is the os that is being targeted, and the list contains the OS's
|
|
||||||
# it can reuse. Note this is a directional compatibility so mutual compatibility between two OS's
|
|
||||||
# requires two entries i.e. os_compatible: {sonoma: [monterey], monterey: [sonoma]}
|
|
||||||
os_compatible: {}
|
|
||||||
|
|||||||
@@ -101,12 +101,6 @@ config:
|
|||||||
verify_ssl: true
|
verify_ssl: true
|
||||||
|
|
||||||
|
|
||||||
# This is where custom certs for proxy/firewall are stored.
|
|
||||||
# It can be a path or environment variable. To match ssl env configuration
|
|
||||||
# the default is the environment variable SSL_CERT_FILE
|
|
||||||
ssl_certs: $SSL_CERT_FILE
|
|
||||||
|
|
||||||
|
|
||||||
# Suppress gpg warnings from binary package verification
|
# Suppress gpg warnings from binary package verification
|
||||||
# Only suppresses warnings, gpg failure will still fail the install
|
# Only suppresses warnings, gpg failure will still fail the install
|
||||||
# Potential rationale to set True: users have already explicitly trusted the
|
# Potential rationale to set True: users have already explicitly trusted the
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ packages:
|
|||||||
- apple-clang
|
- apple-clang
|
||||||
- clang
|
- clang
|
||||||
- gcc
|
- gcc
|
||||||
|
- intel
|
||||||
providers:
|
providers:
|
||||||
elf: [libelf]
|
elf: [libelf]
|
||||||
fuse: [macfuse]
|
fuse: [macfuse]
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
packages:
|
|
||||||
iconv:
|
|
||||||
require: [libiconv]
|
|
||||||
@@ -15,17 +15,15 @@
|
|||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
packages:
|
packages:
|
||||||
all:
|
all:
|
||||||
compiler: [gcc, clang, oneapi, xl, nag, fj, aocc]
|
compiler: [gcc, intel, pgi, clang, xl, nag, fj, aocc]
|
||||||
providers:
|
providers:
|
||||||
awk: [gawk]
|
awk: [gawk]
|
||||||
armci: [armcimpi]
|
|
||||||
blas: [openblas, amdblis]
|
blas: [openblas, amdblis]
|
||||||
D: [ldc]
|
D: [ldc]
|
||||||
daal: [intel-oneapi-daal]
|
daal: [intel-oneapi-daal]
|
||||||
elf: [elfutils]
|
elf: [elfutils]
|
||||||
fftw-api: [fftw, amdfftw]
|
fftw-api: [fftw, amdfftw]
|
||||||
flame: [libflame, amdlibflame]
|
flame: [libflame, amdlibflame]
|
||||||
fortran-rt: [gcc-runtime, intel-oneapi-runtime]
|
|
||||||
fuse: [libfuse]
|
fuse: [libfuse]
|
||||||
gl: [glx, osmesa]
|
gl: [glx, osmesa]
|
||||||
glu: [mesa-glu, openglu]
|
glu: [mesa-glu, openglu]
|
||||||
@@ -36,11 +34,9 @@ packages:
|
|||||||
java: [openjdk, jdk, ibm-java]
|
java: [openjdk, jdk, ibm-java]
|
||||||
jpeg: [libjpeg-turbo, libjpeg]
|
jpeg: [libjpeg-turbo, libjpeg]
|
||||||
lapack: [openblas, amdlibflame]
|
lapack: [openblas, amdlibflame]
|
||||||
libc: [glibc, musl]
|
libglx: [mesa+glx, mesa18+glx]
|
||||||
libgfortran: [gcc-runtime]
|
|
||||||
libglx: [mesa+glx]
|
|
||||||
libifcore: [intel-oneapi-runtime]
|
|
||||||
libllvm: [llvm]
|
libllvm: [llvm]
|
||||||
|
libosmesa: [mesa+osmesa, mesa18+osmesa]
|
||||||
lua-lang: [lua, lua-luajit-openresty, lua-luajit]
|
lua-lang: [lua, lua-luajit-openresty, lua-luajit]
|
||||||
luajit: [lua-luajit-openresty, lua-luajit]
|
luajit: [lua-luajit-openresty, lua-luajit]
|
||||||
mariadb-client: [mariadb-c-client, mariadb]
|
mariadb-client: [mariadb-c-client, mariadb]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
12
lib/spack/docs/_templates/layout.html
vendored
12
lib/spack/docs/_templates/layout.html
vendored
@@ -1,12 +0,0 @@
|
|||||||
{% extends "!layout.html" %}
|
|
||||||
|
|
||||||
{%- block extrahead %}
|
|
||||||
<!-- Google tag (gtag.js) -->
|
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-S0PQ7WV75K"></script>
|
|
||||||
<script>
|
|
||||||
window.dataLayer = window.dataLayer || [];
|
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
gtag('js', new Date());
|
|
||||||
gtag('config', 'G-S0PQ7WV75K');
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -865,7 +865,7 @@ There are several different ways to use Spack packages once you have
|
|||||||
installed them. As you've seen, spack packages are installed into long
|
installed them. As you've seen, spack packages are installed into long
|
||||||
paths with hashes, and you need a way to get them into your path. The
|
paths with hashes, and you need a way to get them into your path. The
|
||||||
easiest way is to use :ref:`spack load <cmd-spack-load>`, which is
|
easiest way is to use :ref:`spack load <cmd-spack-load>`, which is
|
||||||
described in this section.
|
described in the next section.
|
||||||
|
|
||||||
Some more advanced ways to use Spack packages include:
|
Some more advanced ways to use Spack packages include:
|
||||||
|
|
||||||
@@ -959,86 +959,7 @@ use ``spack find --loaded``.
|
|||||||
You can also use ``spack load --list`` to get the same output, but it
|
You can also use ``spack load --list`` to get the same output, but it
|
||||||
does not have the full set of query options that ``spack find`` offers.
|
does not have the full set of query options that ``spack find`` offers.
|
||||||
|
|
||||||
We'll learn more about Spack's spec syntax in :ref:`a later section <sec-specs>`.
|
We'll learn more about Spack's spec syntax in the next section.
|
||||||
|
|
||||||
|
|
||||||
.. _extensions:
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
Python packages and virtual environments
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Spack can install a large number of Python packages. Their names are
|
|
||||||
typically prefixed with ``py-``. Installing and using them is no
|
|
||||||
different from any other package:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack install py-numpy
|
|
||||||
$ spack load py-numpy
|
|
||||||
$ python3
|
|
||||||
>>> import numpy
|
|
||||||
|
|
||||||
The ``spack load`` command sets the ``PATH`` variable so that the right Python
|
|
||||||
executable is used, and makes sure that ``numpy`` and its dependencies can be
|
|
||||||
located in the ``PYTHONPATH``.
|
|
||||||
|
|
||||||
Spack is different from other Python package managers in that it installs
|
|
||||||
every package into its *own* prefix. This is in contrast to ``pip``, which
|
|
||||||
installs all packages into the same prefix, be it in a virtual environment
|
|
||||||
or not.
|
|
||||||
|
|
||||||
For many users, **virtual environments** are more convenient than repeated
|
|
||||||
``spack load`` commands, particularly when working with multiple Python
|
|
||||||
packages. Fortunately Spack supports environments itself, which together
|
|
||||||
with a view are no different from Python virtual environments.
|
|
||||||
|
|
||||||
The recommended way of working with Python extensions such as ``py-numpy``
|
|
||||||
is through :ref:`Environments <environments>`. The following example creates
|
|
||||||
a Spack environment with ``numpy`` in the current working directory. It also
|
|
||||||
puts a filesystem view in ``./view``, which is a more traditional combined
|
|
||||||
prefix for all packages in the environment.
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack env create --with-view view --dir .
|
|
||||||
$ spack -e . add py-numpy
|
|
||||||
$ spack -e . concretize
|
|
||||||
$ spack -e . install
|
|
||||||
|
|
||||||
Now you can activate the environment and start using the packages:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack env activate .
|
|
||||||
$ python3
|
|
||||||
>>> import numpy
|
|
||||||
|
|
||||||
The environment view is also a virtual environment, which is useful if you are
|
|
||||||
sharing the environment with others who are unfamiliar with Spack. They can
|
|
||||||
either use the Python executable directly:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ ./view/bin/python3
|
|
||||||
>>> import numpy
|
|
||||||
|
|
||||||
or use the activation script:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ source ./view/bin/activate
|
|
||||||
$ python3
|
|
||||||
>>> import numpy
|
|
||||||
|
|
||||||
In general, there should not be much difference between ``spack env activate``
|
|
||||||
and using the virtual environment. The main advantage of ``spack env activate``
|
|
||||||
is that it knows about more packages than just Python packages, and it may set
|
|
||||||
additional runtime variables that are not covered by the virtual environment
|
|
||||||
activation script.
|
|
||||||
|
|
||||||
See :ref:`environments` for a more in-depth description of Spack
|
|
||||||
environments and customizations to views.
|
|
||||||
|
|
||||||
|
|
||||||
.. _sec-specs:
|
.. _sec-specs:
|
||||||
@@ -1198,9 +1119,6 @@ and ``3.4.2``. Similarly, ``@4.2:`` means any version above and including
|
|||||||
``4.2``. As a short-hand, ``@3`` is equivalent to the range ``@3:3`` and
|
``4.2``. As a short-hand, ``@3`` is equivalent to the range ``@3:3`` and
|
||||||
includes any version with major version ``3``.
|
includes any version with major version ``3``.
|
||||||
|
|
||||||
Versions are ordered lexicograpically by its components. For more details
|
|
||||||
on the order, see :ref:`the packaging guide <version-comparison>`.
|
|
||||||
|
|
||||||
Notice that you can distinguish between the specific version ``@=3.2`` and
|
Notice that you can distinguish between the specific version ``@=3.2`` and
|
||||||
the range ``@3.2``. This is useful for packages that follow a versioning
|
the range ``@3.2``. This is useful for packages that follow a versioning
|
||||||
scheme that omits the zero patch version number: ``3.2``, ``3.2.1``,
|
scheme that omits the zero patch version number: ``3.2``, ``3.2.1``,
|
||||||
@@ -1212,10 +1130,6 @@ A version specifier can also be a list of ranges and specific versions,
|
|||||||
separated by commas. For example, ``@1.0:1.5,=1.7.1`` matches any version
|
separated by commas. For example, ``@1.0:1.5,=1.7.1`` matches any version
|
||||||
in the range ``1.0:1.5`` and the specific version ``1.7.1``.
|
in the range ``1.0:1.5`` and the specific version ``1.7.1``.
|
||||||
|
|
||||||
^^^^^^^^^^^^
|
|
||||||
Git versions
|
|
||||||
^^^^^^^^^^^^
|
|
||||||
|
|
||||||
For packages with a ``git`` attribute, ``git`` references
|
For packages with a ``git`` attribute, ``git`` references
|
||||||
may be specified instead of a numerical version i.e. branches, tags
|
may be specified instead of a numerical version i.e. branches, tags
|
||||||
and commits. Spack will stage and build based off the ``git``
|
and commits. Spack will stage and build based off the ``git``
|
||||||
@@ -1784,6 +1698,165 @@ check only local packages (as opposed to those used transparently from
|
|||||||
``upstream`` spack instances) and the ``-j,--json`` option to output
|
``upstream`` spack instances) and the ``-j,--json`` option to output
|
||||||
machine-readable json data for any errors.
|
machine-readable json data for any errors.
|
||||||
|
|
||||||
|
|
||||||
|
.. _extensions:
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
Extensions & Python support
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
Spack's installation model assumes that each package will live in its
|
||||||
|
own install prefix. However, certain packages are typically installed
|
||||||
|
*within* the directory hierarchy of other packages. For example,
|
||||||
|
`Python <https://www.python.org>`_ packages are typically installed in the
|
||||||
|
``$prefix/lib/python-2.7/site-packages`` directory.
|
||||||
|
|
||||||
|
In Spack, installation prefixes are immutable, so this type of installation
|
||||||
|
is not directly supported. However, it is possible to create views that
|
||||||
|
allow you to merge install prefixes of multiple packages into a single new prefix.
|
||||||
|
Views are a convenient way to get a more traditional filesystem structure.
|
||||||
|
Using *extensions*, you can ensure that Python packages always share the
|
||||||
|
same prefix in the view as Python itself. Suppose you have
|
||||||
|
Python installed like so:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ spack find python
|
||||||
|
==> 1 installed packages.
|
||||||
|
-- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
|
||||||
|
python@2.7.8
|
||||||
|
|
||||||
|
.. _cmd-spack-extensions:
|
||||||
|
|
||||||
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
``spack extensions``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
You can find extensions for your Python installation like this:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ spack extensions python
|
||||||
|
==> python@2.7.8%gcc@4.4.7 arch=linux-debian7-x86_64-703c7a96
|
||||||
|
==> 36 extensions:
|
||||||
|
geos py-ipython py-pexpect py-pyside py-sip
|
||||||
|
py-basemap py-libxml2 py-pil py-pytz py-six
|
||||||
|
py-biopython py-mako py-pmw py-rpy2 py-sympy
|
||||||
|
py-cython py-matplotlib py-pychecker py-scientificpython py-virtualenv
|
||||||
|
py-dateutil py-mpi4py py-pygments py-scikit-learn
|
||||||
|
py-epydoc py-mx py-pylint py-scipy
|
||||||
|
py-gnuplot py-nose py-pyparsing py-setuptools
|
||||||
|
py-h5py py-numpy py-pyqt py-shiboken
|
||||||
|
|
||||||
|
==> 12 installed:
|
||||||
|
-- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
|
||||||
|
py-dateutil@2.4.0 py-nose@1.3.4 py-pyside@1.2.2
|
||||||
|
py-dateutil@2.4.0 py-numpy@1.9.1 py-pytz@2014.10
|
||||||
|
py-ipython@2.3.1 py-pygments@2.0.1 py-setuptools@11.3.1
|
||||||
|
py-matplotlib@1.4.2 py-pyparsing@2.0.3 py-six@1.9.0
|
||||||
|
|
||||||
|
The extensions are a subset of what's returned by ``spack list``, and
|
||||||
|
they are packages like any other. They are installed into their own
|
||||||
|
prefixes, and you can see this with ``spack find --paths``:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ spack find --paths py-numpy
|
||||||
|
==> 1 installed packages.
|
||||||
|
-- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
|
||||||
|
py-numpy@1.9.1 ~/spack/opt/linux-debian7-x86_64/gcc@4.4.7/py-numpy@1.9.1-66733244
|
||||||
|
|
||||||
|
However, even though this package is installed, you cannot use it
|
||||||
|
directly when you run ``python``:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ spack load python
|
||||||
|
$ python
|
||||||
|
Python 2.7.8 (default, Feb 17 2015, 01:35:25)
|
||||||
|
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
|
||||||
|
Type "help", "copyright", "credits" or "license" for more information.
|
||||||
|
>>> import numpy
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "<stdin>", line 1, in <module>
|
||||||
|
ImportError: No module named numpy
|
||||||
|
>>>
|
||||||
|
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
Using Extensions in Environments
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The recommended way of working with extensions such as ``py-numpy``
|
||||||
|
above is through :ref:`Environments <environments>`. For example,
|
||||||
|
the following creates an environment in the current working directory
|
||||||
|
with a filesystem view in the ``./view`` directory:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ spack env create --with-view view --dir .
|
||||||
|
$ spack -e . add py-numpy
|
||||||
|
$ spack -e . concretize
|
||||||
|
$ spack -e . install
|
||||||
|
|
||||||
|
We recommend environments for two reasons. Firstly, environments
|
||||||
|
can be activated (requires :ref:`shell-support`):
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ spack env activate .
|
||||||
|
|
||||||
|
which sets all the right environment variables such as ``PATH`` and
|
||||||
|
``PYTHONPATH``. This ensures that
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ python
|
||||||
|
>>> import numpy
|
||||||
|
|
||||||
|
works. Secondly, even without shell support, the view ensures
|
||||||
|
that Python can locate its extensions:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ ./view/bin/python
|
||||||
|
>>> import numpy
|
||||||
|
|
||||||
|
See :ref:`environments` for a more in-depth description of Spack
|
||||||
|
environments and customizations to views.
|
||||||
|
|
||||||
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
Using ``spack load``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
A more traditional way of using Spack and extensions is ``spack load``
|
||||||
|
(requires :ref:`shell-support`). This will add the extension to ``PYTHONPATH``
|
||||||
|
in your current shell, and Python itself will be available in the ``PATH``:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ spack load py-numpy
|
||||||
|
$ python
|
||||||
|
>>> import numpy
|
||||||
|
|
||||||
|
The loaded packages can be checked using ``spack find --loaded``
|
||||||
|
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
Loading Extensions via Modules
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Apart from ``spack env activate`` and ``spack load``, you can load numpy
|
||||||
|
through your environment modules (using ``environment-modules`` or
|
||||||
|
``lmod``). This will also add the extension to the ``PYTHONPATH`` in
|
||||||
|
your current shell.
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ module load <name of numpy module>
|
||||||
|
|
||||||
|
If you do not know the name of the specific numpy module you wish to
|
||||||
|
load, you can use the ``spack module tcl|lmod loads`` command to get
|
||||||
|
the name of the module from the Spack spec.
|
||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
Filesystem requirements
|
Filesystem requirements
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -220,40 +220,6 @@ section of the configuration:
|
|||||||
|
|
||||||
.. _binary_caches_oci:
|
.. _binary_caches_oci:
|
||||||
|
|
||||||
---------------------------------
|
|
||||||
Automatic push to a build cache
|
|
||||||
---------------------------------
|
|
||||||
|
|
||||||
Sometimes it is convenient to push packages to a build cache as soon as they are installed. Spack can do this by setting autopush flag when adding a mirror:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack mirror add --autopush <name> <url or path>
|
|
||||||
|
|
||||||
Or the autopush flag can be set for an existing mirror:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack mirror set --autopush <name> # enable automatic push for an existing mirror
|
|
||||||
$ spack mirror set --no-autopush <name> # disable automatic push for an existing mirror
|
|
||||||
|
|
||||||
Then after installing a package it is automatically pushed to all mirrors with ``autopush: true``. The command
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack install <package>
|
|
||||||
|
|
||||||
will have the same effect as
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack install <package>
|
|
||||||
$ spack buildcache push <cache> <package> # for all caches with autopush: true
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Packages are automatically pushed to a build cache only if they are built from source.
|
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
OCI / Docker V2 registries as build cache
|
OCI / Docker V2 registries as build cache
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -87,7 +87,7 @@ You can check what is installed in the bootstrapping store at any time using:
|
|||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
% spack -b find
|
% spack find -b
|
||||||
==> Showing internal bootstrap store at "/Users/spack/.spack/bootstrap/store"
|
==> Showing internal bootstrap store at "/Users/spack/.spack/bootstrap/store"
|
||||||
==> 11 installed packages
|
==> 11 installed packages
|
||||||
-- darwin-catalina-x86_64 / apple-clang@12.0.0 ------------------
|
-- darwin-catalina-x86_64 / apple-clang@12.0.0 ------------------
|
||||||
@@ -101,7 +101,7 @@ In case it is needed you can remove all the software in the current bootstrappin
|
|||||||
% spack clean -b
|
% spack clean -b
|
||||||
==> Removing bootstrapped software and configuration in "/Users/spack/.spack/bootstrap"
|
==> Removing bootstrapped software and configuration in "/Users/spack/.spack/bootstrap"
|
||||||
|
|
||||||
% spack -b find
|
% spack find -b
|
||||||
==> Showing internal bootstrap store at "/Users/spack/.spack/bootstrap/store"
|
==> Showing internal bootstrap store at "/Users/spack/.spack/bootstrap/store"
|
||||||
==> 0 installed packages
|
==> 0 installed packages
|
||||||
|
|
||||||
@@ -175,4 +175,4 @@ bootstrapping.
|
|||||||
|
|
||||||
This command needs to be run on a machine with internet access and the resulting folder
|
This command needs to be run on a machine with internet access and the resulting folder
|
||||||
has to be moved over to the air-gapped system. Once the local sources are added using the
|
has to be moved over to the air-gapped system. Once the local sources are added using the
|
||||||
commands suggested at the prompt, they can be used to bootstrap Spack.
|
commands suggested at the prompt, they can be used to bootstrap Spack.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -21,86 +21,23 @@ is the following:
|
|||||||
Reuse already installed packages
|
Reuse already installed packages
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
The ``reuse`` attribute controls how aggressively Spack reuses binary packages during concretization. The
|
The ``reuse`` attribute controls whether Spack will prefer to use installed packages (``true``), or
|
||||||
attribute can either be a single value, or an object for more complex configurations.
|
whether it will do a "fresh" installation and prefer the latest settings from
|
||||||
|
``package.py`` files and ``packages.yaml`` (``false``).
|
||||||
In the former case ("single value") it allows Spack to:
|
You can use:
|
||||||
|
|
||||||
1. Reuse installed packages and buildcaches for all the specs to be concretized, when ``true``
|
|
||||||
2. Reuse installed packages and buildcaches only for the dependencies of the root specs, when ``dependencies``
|
|
||||||
3. Disregard reusing installed packages and buildcaches, when ``false``
|
|
||||||
|
|
||||||
In case a finer control over which specs are reused is needed, then the value of this attribute can be
|
|
||||||
an object, with the following keys:
|
|
||||||
|
|
||||||
1. ``roots``: if ``true`` root specs are reused, if ``false`` only dependencies of root specs are reused
|
|
||||||
2. ``from``: list of sources from which reused specs are taken
|
|
||||||
|
|
||||||
Each source in ``from`` is itself an object:
|
|
||||||
|
|
||||||
.. list-table:: Attributes for a source or reusable specs
|
|
||||||
:header-rows: 1
|
|
||||||
|
|
||||||
* - Attribute name
|
|
||||||
- Description
|
|
||||||
* - type (mandatory, string)
|
|
||||||
- Can be ``local``, ``buildcache``, or ``external``
|
|
||||||
* - include (optional, list of specs)
|
|
||||||
- If present, reusable specs must match at least one of the constraint in the list
|
|
||||||
* - exclude (optional, list of specs)
|
|
||||||
- If present, reusable specs must not match any of the constraint in the list.
|
|
||||||
|
|
||||||
For instance, the following configuration:
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
concretizer:
|
|
||||||
reuse:
|
|
||||||
roots: true
|
|
||||||
from:
|
|
||||||
- type: local
|
|
||||||
include:
|
|
||||||
- "%gcc"
|
|
||||||
- "%clang"
|
|
||||||
|
|
||||||
tells the concretizer to reuse all specs compiled with either ``gcc`` or ``clang``, that are installed
|
|
||||||
in the local store. Any spec from remote buildcaches is disregarded.
|
|
||||||
|
|
||||||
To reduce the boilerplate in configuration files, default values for the ``include`` and
|
|
||||||
``exclude`` options can be pushed up one level:
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
concretizer:
|
|
||||||
reuse:
|
|
||||||
roots: true
|
|
||||||
include:
|
|
||||||
- "%gcc"
|
|
||||||
from:
|
|
||||||
- type: local
|
|
||||||
- type: buildcache
|
|
||||||
- type: local
|
|
||||||
include:
|
|
||||||
- "foo %oneapi"
|
|
||||||
|
|
||||||
In the example above we reuse all specs compiled with ``gcc`` from the local store
|
|
||||||
and remote buildcaches, and we also reuse ``foo %oneapi``. Note that the last source of
|
|
||||||
specs override the default ``include`` attribute.
|
|
||||||
|
|
||||||
For one-off concretizations, the are command line arguments for each of the simple "single value"
|
|
||||||
configurations. This means a user can:
|
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
% spack install --reuse <spec>
|
% spack install --reuse <spec>
|
||||||
|
|
||||||
to enable reuse for a single installation, or:
|
to enable reuse for a single installation, and you can use:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
spack install --fresh <spec>
|
spack install --fresh <spec>
|
||||||
|
|
||||||
to do a fresh install if ``reuse`` is enabled by default.
|
to do a fresh install if ``reuse`` is enabled by default.
|
||||||
|
``reuse: dependencies`` is the default.
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -250,7 +250,7 @@ generator is Ninja. To switch to the Ninja generator, simply add:
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
generator("ninja")
|
generator = "Ninja"
|
||||||
|
|
||||||
|
|
||||||
``CMakePackage`` defaults to "Unix Makefiles". If you switch to the
|
``CMakePackage`` defaults to "Unix Makefiles". If you switch to the
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -90,7 +90,7 @@ and optimizers do require a paid license. In Spack, they are packaged as:
|
|||||||
TODO: Confirm and possible change(!) the scope of MPI components (runtime
|
TODO: Confirm and possible change(!) the scope of MPI components (runtime
|
||||||
vs. devel) in current (and previous?) *cluster/professional/composer*
|
vs. devel) in current (and previous?) *cluster/professional/composer*
|
||||||
editions, i.e., presence in downloads, possibly subject to license
|
editions, i.e., presence in downloads, possibly subject to license
|
||||||
coverage(!); see `discussion in PR #4300
|
coverage(!); see `disussion in PR #4300
|
||||||
<https://github.com/spack/spack/pull/4300#issuecomment-305582898>`_. [NB:
|
<https://github.com/spack/spack/pull/4300#issuecomment-305582898>`_. [NB:
|
||||||
An "mpi" subdirectory is not indicative of the full MPI SDK being present
|
An "mpi" subdirectory is not indicative of the full MPI SDK being present
|
||||||
(i.e., ``mpicc``, ..., and header files). The directory may just as well
|
(i.e., ``mpicc``, ..., and header files). The directory may just as well
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -88,13 +88,13 @@ command-line. However, Makefiles that use ``?=`` for assignment honor
|
|||||||
environment variables. Since Spack already sets ``CC``, ``CXX``, ``F77``,
|
environment variables. Since Spack already sets ``CC``, ``CXX``, ``F77``,
|
||||||
and ``FC``, you won't need to worry about setting these variables. If
|
and ``FC``, you won't need to worry about setting these variables. If
|
||||||
there are any other variables you need to set, you can do this in the
|
there are any other variables you need to set, you can do this in the
|
||||||
``setup_build_environment`` method:
|
``edit`` method:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def setup_build_environment(self, env):
|
def edit(self, spec, prefix):
|
||||||
env.set("PREFIX", prefix)
|
env["PREFIX"] = prefix
|
||||||
env.set("BLASLIB", spec["blas"].libs.ld_flags)
|
env["BLASLIB"] = spec["blas"].libs.ld_flags
|
||||||
|
|
||||||
|
|
||||||
`cbench <https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/cbench/package.py>`_
|
`cbench <https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/cbench/package.py>`_
|
||||||
@@ -140,7 +140,7 @@ Edit Makefile
|
|||||||
Some Makefiles are just plain stubborn and will ignore command-line
|
Some Makefiles are just plain stubborn and will ignore command-line
|
||||||
variables. The only way to ensure that these packages build correctly
|
variables. The only way to ensure that these packages build correctly
|
||||||
is to directly edit the Makefile. Spack provides a ``FileFilter`` class
|
is to directly edit the Makefile. Spack provides a ``FileFilter`` class
|
||||||
and a ``filter`` method to help with this. For example:
|
and a ``filter_file`` method to help with this. For example:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -173,72 +173,6 @@ arguments to ``Makefile.PL`` or ``Build.PL`` by overriding
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
^^^^^^^
|
|
||||||
Testing
|
|
||||||
^^^^^^^
|
|
||||||
|
|
||||||
``PerlPackage`` provides a simple stand-alone test of the successfully
|
|
||||||
installed package to confirm that installed perl module(s) can be used.
|
|
||||||
These tests can be performed any time after the installation using
|
|
||||||
``spack -v test run``. (For more information on the command, see
|
|
||||||
:ref:`cmd-spack-test-run`.)
|
|
||||||
|
|
||||||
The base class automatically detects perl modules based on the presence
|
|
||||||
of ``*.pm`` files under the package's library directory. For example,
|
|
||||||
the files under ``perl-bignum``'s perl library are:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ find . -name "*.pm"
|
|
||||||
./bigfloat.pm
|
|
||||||
./bigrat.pm
|
|
||||||
./Math/BigFloat/Trace.pm
|
|
||||||
./Math/BigInt/Trace.pm
|
|
||||||
./Math/BigRat/Trace.pm
|
|
||||||
./bigint.pm
|
|
||||||
./bignum.pm
|
|
||||||
|
|
||||||
|
|
||||||
which results in the package having the ``use_modules`` property containing:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
use_modules = [
|
|
||||||
"bigfloat",
|
|
||||||
"bigrat",
|
|
||||||
"Math::BigFloat::Trace",
|
|
||||||
"Math::BigInt::Trace",
|
|
||||||
"Math::BigRat::Trace",
|
|
||||||
"bigint",
|
|
||||||
"bignum",
|
|
||||||
]
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
This list can often be used to catch missing dependencies.
|
|
||||||
|
|
||||||
If the list is somehow wrong, you can provide the names of the modules
|
|
||||||
yourself by overriding ``use_modules`` like so:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
use_modules = ["bigfloat", "bigrat", "bigint", "bignum"]
|
|
||||||
|
|
||||||
If you only want a subset of the automatically detected modules to be
|
|
||||||
tested, you could instead define the ``skip_modules`` property on the
|
|
||||||
package. So, instead of overriding ``use_modules`` as shown above, you
|
|
||||||
could define the following:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
skip_modules = [
|
|
||||||
"Math::BigFloat::Trace",
|
|
||||||
"Math::BigInt::Trace",
|
|
||||||
"Math::BigRat::Trace",
|
|
||||||
]
|
|
||||||
|
|
||||||
for the same use tests.
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
Alternatives to Spack
|
Alternatives to Spack
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -718,45 +718,23 @@ command-line tool, or C/C++/Fortran program with optional Python
|
|||||||
modules? The former should be prepended with ``py-``, while the
|
modules? The former should be prepended with ``py-``, while the
|
||||||
latter should not.
|
latter should not.
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""
|
""""""""""""""""""""""
|
||||||
``extends`` vs. ``depends_on``
|
extends vs. depends_on
|
||||||
""""""""""""""""""""""""""""""
|
""""""""""""""""""""""
|
||||||
|
|
||||||
|
This is very similar to the naming dilemma above, with a slight twist.
|
||||||
As mentioned in the :ref:`Packaging Guide <packaging_extensions>`,
|
As mentioned in the :ref:`Packaging Guide <packaging_extensions>`,
|
||||||
``extends`` and ``depends_on`` are very similar, but ``extends`` ensures
|
``extends`` and ``depends_on`` are very similar, but ``extends`` ensures
|
||||||
that the extension and extendee share the same prefix in views.
|
that the extension and extendee share the same prefix in views.
|
||||||
This allows the user to import a Python module without
|
This allows the user to import a Python module without
|
||||||
having to add that module to ``PYTHONPATH``.
|
having to add that module to ``PYTHONPATH``.
|
||||||
|
|
||||||
Additionally, ``extends("python")`` adds a dependency on the package
|
When deciding between ``extends`` and ``depends_on``, the best rule of
|
||||||
``python-venv``. This improves isolation from the system, whether
|
thumb is to check the installation prefix. If Python libraries are
|
||||||
it's during the build or at runtime: user and system site packages
|
installed to ``<prefix>/lib/pythonX.Y/site-packages``, then you
|
||||||
cannot accidentally be used by any package that ``extends("python")``.
|
should use ``extends``. If Python libraries are installed elsewhere
|
||||||
|
or the only files that get installed reside in ``<prefix>/bin``, then
|
||||||
As a rule of thumb: if a package does not install any Python modules
|
don't use ``extends``.
|
||||||
of its own, and merely puts a Python script in the ``bin`` directory,
|
|
||||||
then there is no need for ``extends``. If the package installs modules
|
|
||||||
in the ``site-packages`` directory, it requires ``extends``.
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""
|
|
||||||
Executing ``python`` during the build
|
|
||||||
"""""""""""""""""""""""""""""""""""""
|
|
||||||
|
|
||||||
Whenever you need to execute a Python command or pass the path of the
|
|
||||||
Python interpreter to the build system, it is best to use the global
|
|
||||||
variable ``python`` directly. For example:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
@run_before("install")
|
|
||||||
def recythonize(self):
|
|
||||||
python("setup.py", "clean") # use the `python` global
|
|
||||||
|
|
||||||
As mentioned in the previous section, ``extends("python")`` adds an
|
|
||||||
automatic dependency on ``python-venv``, which is a virtual environment
|
|
||||||
that guarantees build isolation. The ``python`` global always refers to
|
|
||||||
the correct Python interpreter, whether the package uses ``extends("python")``
|
|
||||||
or ``depends_on("python")``.
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
Alternatives to Spack
|
Alternatives to Spack
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
.. chain:
|
.. chain:
|
||||||
|
|
||||||
=============================================
|
============================
|
||||||
Chaining Spack Installations (upstreams.yaml)
|
Chaining Spack Installations
|
||||||
=============================================
|
============================
|
||||||
|
|
||||||
You can point your Spack installation to another installation to use any
|
You can point your Spack installation to another installation to use any
|
||||||
packages that are installed there. To register the other Spack instance,
|
packages that are installed there. To register the other Spack instance,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -199,7 +199,6 @@ def setup(sphinx):
|
|||||||
("py:class", "contextlib.contextmanager"),
|
("py:class", "contextlib.contextmanager"),
|
||||||
("py:class", "module"),
|
("py:class", "module"),
|
||||||
("py:class", "_io.BufferedReader"),
|
("py:class", "_io.BufferedReader"),
|
||||||
("py:class", "_io.BytesIO"),
|
|
||||||
("py:class", "unittest.case.TestCase"),
|
("py:class", "unittest.case.TestCase"),
|
||||||
("py:class", "_frozen_importlib_external.SourceFileLoader"),
|
("py:class", "_frozen_importlib_external.SourceFileLoader"),
|
||||||
("py:class", "clingo.Control"),
|
("py:class", "clingo.Control"),
|
||||||
@@ -216,7 +215,6 @@ def setup(sphinx):
|
|||||||
("py:class", "spack.spec.InstallStatus"),
|
("py:class", "spack.spec.InstallStatus"),
|
||||||
("py:class", "spack.spec.SpecfileReaderBase"),
|
("py:class", "spack.spec.SpecfileReaderBase"),
|
||||||
("py:class", "spack.install_test.Pb"),
|
("py:class", "spack.install_test.Pb"),
|
||||||
("py:class", "spack.filesystem_view.SimpleFilesystemView"),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -145,25 +145,6 @@ hosts when making ``ssl`` connections. Set to ``false`` to disable, and
|
|||||||
tools like ``curl`` will use their ``--insecure`` options. Disabling
|
tools like ``curl`` will use their ``--insecure`` options. Disabling
|
||||||
this can expose you to attacks. Use at your own risk.
|
this can expose you to attacks. Use at your own risk.
|
||||||
|
|
||||||
--------------------
|
|
||||||
``ssl_certs``
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
Path to custom certificats for SSL verification. The value can be a
|
|
||||||
filesytem path, or an environment variable that expands to an absolute file path.
|
|
||||||
The default value is set to the environment variable ``SSL_CERT_FILE``
|
|
||||||
to use the same syntax used by many other applications that automatically
|
|
||||||
detect custom certificates.
|
|
||||||
When ``url_fetch_method:curl`` the ``config:ssl_certs`` should resolve to
|
|
||||||
a single file. Spack will then set the environment variable ``CURL_CA_BUNDLE``
|
|
||||||
in the subprocess calling ``curl``.
|
|
||||||
If ``url_fetch_method:urllib`` then files and directories are supported i.e.
|
|
||||||
``config:ssl_certs:$SSL_CERT_FILE`` or ``config:ssl_certs:$SSL_CERT_DIR``
|
|
||||||
will work.
|
|
||||||
In all cases the expanded path must be absolute for Spack to use the certificates.
|
|
||||||
Certificates relative to an environment can be created by prepending the path variable
|
|
||||||
with the Spack configuration variable``$env``.
|
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
``checksum``
|
``checksum``
|
||||||
--------------------
|
--------------------
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -73,12 +73,9 @@ are six configuration scopes. From lowest to highest:
|
|||||||
Spack instance per project) or for site-wide settings on a multi-user
|
Spack instance per project) or for site-wide settings on a multi-user
|
||||||
machine (e.g., for a common Spack instance).
|
machine (e.g., for a common Spack instance).
|
||||||
|
|
||||||
#. **plugin**: Read from a Python project's entry points. Settings here affect
|
|
||||||
all instances of Spack running with the same Python installation. This scope takes higher precedence than site, system, and default scopes.
|
|
||||||
|
|
||||||
#. **user**: Stored in the home directory: ``~/.spack/``. These settings
|
#. **user**: Stored in the home directory: ``~/.spack/``. These settings
|
||||||
affect all instances of Spack and take higher precedence than site,
|
affect all instances of Spack and take higher precedence than site,
|
||||||
system, plugin, or defaults scopes.
|
system, or defaults scopes.
|
||||||
|
|
||||||
#. **custom**: Stored in a custom directory specified by ``--config-scope``.
|
#. **custom**: Stored in a custom directory specified by ``--config-scope``.
|
||||||
If multiple scopes are listed on the command line, they are ordered
|
If multiple scopes are listed on the command line, they are ordered
|
||||||
@@ -199,45 +196,6 @@ with MPICH. You can create different configuration scopes for use with
|
|||||||
mpi: [mpich]
|
mpi: [mpich]
|
||||||
|
|
||||||
|
|
||||||
.. _plugin-scopes:
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^
|
|
||||||
Plugin scopes
|
|
||||||
^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
Python version >= 3.8 is required to enable plugin configuration.
|
|
||||||
|
|
||||||
Spack can be made aware of configuration scopes that are installed as part of a python package. To do so, register a function that returns the scope's path to the ``"spack.config"`` entry point. Consider the Python package ``my_package`` that includes Spack configurations:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
my-package/
|
|
||||||
├── src
|
|
||||||
│ ├── my_package
|
|
||||||
│ │ ├── __init__.py
|
|
||||||
│ │ └── spack/
|
|
||||||
│ │ │ └── config.yaml
|
|
||||||
└── pyproject.toml
|
|
||||||
|
|
||||||
adding the following to ``my_package``'s ``pyproject.toml`` will make ``my_package``'s ``spack/`` configurations visible to Spack when ``my_package`` is installed:
|
|
||||||
|
|
||||||
.. code-block:: toml
|
|
||||||
|
|
||||||
[project.entry_points."spack.config"]
|
|
||||||
my_package = "my_package:get_config_path"
|
|
||||||
|
|
||||||
The function ``my_package.get_extension_path`` in ``my_package/__init__.py`` might look like
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import importlib.resources
|
|
||||||
|
|
||||||
def get_config_path():
|
|
||||||
dirname = importlib.resources.files("my_package").joinpath("spack")
|
|
||||||
if dirname.exists():
|
|
||||||
return str(dirname)
|
|
||||||
|
|
||||||
.. _platform-scopes:
|
.. _platform-scopes:
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -9,96 +9,34 @@
|
|||||||
Container Images
|
Container Images
|
||||||
================
|
================
|
||||||
|
|
||||||
Spack :ref:`environments` can easily be turned into container images. This page
|
Spack :ref:`environments` are a great tool to create container images, but
|
||||||
outlines two ways in which this can be done:
|
preparing one that is suitable for production requires some more boilerplate
|
||||||
|
than just:
|
||||||
1. By installing the environment on the host system, and copying the installations
|
|
||||||
into the container image. This approach does not require any tools like Docker
|
|
||||||
or Singularity to be installed.
|
|
||||||
2. By generating a Docker or Singularity recipe that can be used to build the
|
|
||||||
container image. In this approach, Spack builds the software inside the
|
|
||||||
container runtime, not on the host system.
|
|
||||||
|
|
||||||
The first approach is easiest if you already have an installed environment,
|
|
||||||
the second approach gives more control over the container image.
|
|
||||||
|
|
||||||
---------------------------
|
|
||||||
From existing installations
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
If you already have a Spack environment installed on your system, you can
|
|
||||||
share the binaries as an OCI compatible container image. To get started you
|
|
||||||
just have to configure and OCI registry and run ``spack buildcache push``.
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
# Create and install an environment in the current directory
|
|
||||||
spack env create -d .
|
|
||||||
spack -e . add pkg-a pkg-b
|
|
||||||
spack -e . install
|
|
||||||
|
|
||||||
# Configure the registry
|
|
||||||
spack -e . mirror add --oci-username ... --oci-password ... container-registry oci://example.com/name/image
|
|
||||||
|
|
||||||
# Push the image
|
|
||||||
spack -e . buildcache push --update-index --base-image ubuntu:22.04 --tag my_env container-registry
|
|
||||||
|
|
||||||
The resulting container image can then be run as follows:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ docker run -it example.com/name/image:my_env
|
|
||||||
|
|
||||||
The image generated by Spack consists of the specified base image with each package from the
|
|
||||||
environment as a separate layer on top. The image is minimal by construction, it only contains the
|
|
||||||
environment roots and its runtime dependencies.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
When using registries like GHCR and Docker Hub, the ``--oci-password`` flag is not
|
|
||||||
the password for your account, but a personal access token you need to generate separately.
|
|
||||||
|
|
||||||
The specified ``--base-image`` should have a libc that is compatible with the host system.
|
|
||||||
For example if your host system is Ubuntu 20.04, you can use ``ubuntu:20.04``, ``ubuntu:22.04``
|
|
||||||
or newer: the libc in the container image must be at least the version of the host system,
|
|
||||||
assuming ABI compatibility. It is also perfectly fine to use a completely different
|
|
||||||
Linux distribution as long as the libc is compatible.
|
|
||||||
|
|
||||||
For convenience, Spack also turns the OCI registry into a :ref:`build cache <binary_caches_oci>`,
|
|
||||||
so that future ``spack install`` of the environment will simply pull the binaries from the
|
|
||||||
registry instead of doing source builds. The flag ``--update-index`` is needed to make Spack
|
|
||||||
take the build cache into account when concretizing.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
When generating container images in CI, the approach above is recommended when CI jobs
|
|
||||||
already run in a sandboxed environment. You can simply use ``spack`` directly
|
|
||||||
in the CI job and push the resulting image to a registry. Subsequent CI jobs should
|
|
||||||
run faster because Spack can install from the same registry instead of rebuilding from
|
|
||||||
sources.
|
|
||||||
|
|
||||||
---------------------------------------------
|
|
||||||
Generating recipes for Docker and Singularity
|
|
||||||
---------------------------------------------
|
|
||||||
|
|
||||||
Apart from copying existing installations into container images, Spack can also
|
|
||||||
generate recipes for container images. This is useful if you want to run Spack
|
|
||||||
itself in a sandboxed environment instead of on the host system.
|
|
||||||
|
|
||||||
Since recipes need a little bit more boilerplate than
|
|
||||||
|
|
||||||
.. code-block:: docker
|
.. code-block:: docker
|
||||||
|
|
||||||
COPY spack.yaml /environment
|
COPY spack.yaml /environment
|
||||||
RUN spack -e /environment install
|
RUN spack -e /environment install
|
||||||
|
|
||||||
Spack provides a command to generate customizable recipes for container images. Customizations
|
Additional actions may be needed to minimize the size of the
|
||||||
include minimizing the size of the image, installing packages in the base image using the system
|
container, or to update the system software that is installed in the base
|
||||||
package manager, and setting up a proper entrypoint to run the image.
|
image, or to set up a proper entrypoint to run the image. These tasks are
|
||||||
|
usually both necessary and repetitive, so Spack comes with a command
|
||||||
|
to generate recipes for container images starting from a ``spack.yaml``.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
.. seealso::
|
||||||
|
|
||||||
|
This page is a reference for generating recipes to build container images.
|
||||||
|
It means that your environment is built from scratch inside the container
|
||||||
|
runtime.
|
||||||
|
|
||||||
|
Since v0.21, Spack can also create container images from existing package installations
|
||||||
|
on your host system. See :ref:`binary_caches_oci` for more information on
|
||||||
|
that topic.
|
||||||
|
|
||||||
|
--------------------
|
||||||
A Quick Introduction
|
A Quick Introduction
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
--------------------
|
||||||
|
|
||||||
Consider having a Spack environment like the following:
|
Consider having a Spack environment like the following:
|
||||||
|
|
||||||
@@ -109,8 +47,8 @@ Consider having a Spack environment like the following:
|
|||||||
- gromacs+mpi
|
- gromacs+mpi
|
||||||
- mpich
|
- mpich
|
||||||
|
|
||||||
Producing a ``Dockerfile`` from it is as simple as changing directories to
|
Producing a ``Dockerfile`` from it is as simple as moving to the directory
|
||||||
where the ``spack.yaml`` file is stored and running the following command:
|
where the ``spack.yaml`` file is stored and giving the following command:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
@@ -176,9 +114,9 @@ configuration are discussed in details in the sections below.
|
|||||||
|
|
||||||
.. _container_spack_images:
|
.. _container_spack_images:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
--------------------------
|
||||||
Spack Images on Docker Hub
|
Spack Images on Docker Hub
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
--------------------------
|
||||||
|
|
||||||
Docker images with Spack preinstalled and ready to be used are
|
Docker images with Spack preinstalled and ready to be used are
|
||||||
built when a release is tagged, or nightly on ``develop``. The images
|
built when a release is tagged, or nightly on ``develop``. The images
|
||||||
@@ -194,15 +132,15 @@ The OS that are currently supported are summarized in the table below:
|
|||||||
* - Operating System
|
* - Operating System
|
||||||
- Base Image
|
- Base Image
|
||||||
- Spack Image
|
- Spack Image
|
||||||
|
* - Ubuntu 18.04
|
||||||
|
- ``ubuntu:18.04``
|
||||||
|
- ``spack/ubuntu-bionic``
|
||||||
* - Ubuntu 20.04
|
* - Ubuntu 20.04
|
||||||
- ``ubuntu:20.04``
|
- ``ubuntu:20.04``
|
||||||
- ``spack/ubuntu-focal``
|
- ``spack/ubuntu-focal``
|
||||||
* - Ubuntu 22.04
|
* - Ubuntu 22.04
|
||||||
- ``ubuntu:22.04``
|
- ``ubuntu:22.04``
|
||||||
- ``spack/ubuntu-jammy``
|
- ``spack/ubuntu-jammy``
|
||||||
* - Ubuntu 24.04
|
|
||||||
- ``ubuntu:24.04``
|
|
||||||
- ``spack/ubuntu-noble``
|
|
||||||
* - CentOS 7
|
* - CentOS 7
|
||||||
- ``centos:7``
|
- ``centos:7``
|
||||||
- ``spack/centos7``
|
- ``spack/centos7``
|
||||||
@@ -227,12 +165,12 @@ The OS that are currently supported are summarized in the table below:
|
|||||||
* - Rocky Linux 9
|
* - Rocky Linux 9
|
||||||
- ``rockylinux:9``
|
- ``rockylinux:9``
|
||||||
- ``spack/rockylinux9``
|
- ``spack/rockylinux9``
|
||||||
* - Fedora Linux 39
|
* - Fedora Linux 37
|
||||||
- ``fedora:39``
|
- ``fedora:37``
|
||||||
- ``spack/fedora39``
|
- ``spack/fedora37``
|
||||||
* - Fedora Linux 40
|
* - Fedora Linux 38
|
||||||
- ``fedora:40``
|
- ``fedora:38``
|
||||||
- ``spack/fedora40``
|
- ``spack/fedora38``
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -248,9 +186,9 @@ by Spack use them as default base images for their ``build`` stage,
|
|||||||
even though handles to use custom base images provided by users are
|
even though handles to use custom base images provided by users are
|
||||||
available to accommodate complex use cases.
|
available to accommodate complex use cases.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
---------------------------------
|
||||||
Configuring the Container Recipe
|
Creating Images From Environments
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
---------------------------------
|
||||||
|
|
||||||
Any Spack Environment can be used for the automatic generation of container
|
Any Spack Environment can be used for the automatic generation of container
|
||||||
recipes. Sensible defaults are provided for things like the base image or the
|
recipes. Sensible defaults are provided for things like the base image or the
|
||||||
@@ -291,18 +229,18 @@ under the ``container`` attribute of environments:
|
|||||||
|
|
||||||
A detailed description of the options available can be found in the :ref:`container_config_options` section.
|
A detailed description of the options available can be found in the :ref:`container_config_options` section.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~
|
-------------------
|
||||||
Setting Base Images
|
Setting Base Images
|
||||||
~~~~~~~~~~~~~~~~~~~
|
-------------------
|
||||||
|
|
||||||
The ``images`` subsection is used to select both the image where
|
The ``images`` subsection is used to select both the image where
|
||||||
Spack builds the software and the image where the built software
|
Spack builds the software and the image where the built software
|
||||||
is installed. This attribute can be set in different ways and
|
is installed. This attribute can be set in different ways and
|
||||||
which one to use depends on the use case at hand.
|
which one to use depends on the use case at hand.
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""""""""""""
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
Use Official Spack Images From Dockerhub
|
Use Official Spack Images From Dockerhub
|
||||||
""""""""""""""""""""""""""""""""""""""""
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
To generate a recipe that uses an official Docker image from the
|
To generate a recipe that uses an official Docker image from the
|
||||||
Spack organization to build the software and the corresponding official OS image
|
Spack organization to build the software and the corresponding official OS image
|
||||||
@@ -507,9 +445,9 @@ responsibility to ensure that:
|
|||||||
Therefore we don't recommend its use in cases that can be otherwise
|
Therefore we don't recommend its use in cases that can be otherwise
|
||||||
covered by the simplified mode shown first.
|
covered by the simplified mode shown first.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
----------------------------
|
||||||
Singularity Definition Files
|
Singularity Definition Files
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
----------------------------
|
||||||
|
|
||||||
In addition to producing recipes in ``Dockerfile`` format Spack can produce
|
In addition to producing recipes in ``Dockerfile`` format Spack can produce
|
||||||
Singularity Definition Files by just changing the value of the ``format``
|
Singularity Definition Files by just changing the value of the ``format``
|
||||||
@@ -530,9 +468,9 @@ attribute:
|
|||||||
The minimum version of Singularity required to build a SIF (Singularity Image Format)
|
The minimum version of Singularity required to build a SIF (Singularity Image Format)
|
||||||
image from the recipes generated by Spack is ``3.5.3``.
|
image from the recipes generated by Spack is ``3.5.3``.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
------------------------------
|
||||||
Extending the Jinja2 Templates
|
Extending the Jinja2 Templates
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
------------------------------
|
||||||
|
|
||||||
The Dockerfile and the Singularity definition file that Spack can generate are based on
|
The Dockerfile and the Singularity definition file that Spack can generate are based on
|
||||||
a few Jinja2 templates that are rendered according to the environment being containerized.
|
a few Jinja2 templates that are rendered according to the environment being containerized.
|
||||||
@@ -653,9 +591,9 @@ The recipe that gets generated contains the two extra instruction that we added
|
|||||||
|
|
||||||
.. _container_config_options:
|
.. _container_config_options:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
-----------------------
|
||||||
Configuration Reference
|
Configuration Reference
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
-----------------------
|
||||||
|
|
||||||
The tables below describe all the configuration options that are currently supported
|
The tables below describe all the configuration options that are currently supported
|
||||||
to customize the generation of container recipes:
|
to customize the generation of container recipes:
|
||||||
@@ -752,13 +690,13 @@ to customize the generation of container recipes:
|
|||||||
- Description string
|
- Description string
|
||||||
- No
|
- No
|
||||||
|
|
||||||
~~~~~~~~~~~~~~
|
--------------
|
||||||
Best Practices
|
Best Practices
|
||||||
~~~~~~~~~~~~~~
|
--------------
|
||||||
|
|
||||||
"""
|
^^^
|
||||||
MPI
|
MPI
|
||||||
"""
|
^^^
|
||||||
Due to the dependency on Fortran for OpenMPI, which is the spack default
|
Due to the dependency on Fortran for OpenMPI, which is the spack default
|
||||||
implementation, consider adding ``gfortran`` to the ``apt-get install`` list.
|
implementation, consider adding ``gfortran`` to the ``apt-get install`` list.
|
||||||
|
|
||||||
@@ -769,9 +707,9 @@ For execution on HPC clusters, it can be helpful to import the docker
|
|||||||
image into Singularity in order to start a program with an *external*
|
image into Singularity in order to start a program with an *external*
|
||||||
MPI. Otherwise, also add ``openssh-server`` to the ``apt-get install`` list.
|
MPI. Otherwise, also add ``openssh-server`` to the ``apt-get install`` list.
|
||||||
|
|
||||||
""""
|
^^^^
|
||||||
CUDA
|
CUDA
|
||||||
""""
|
^^^^
|
||||||
Starting from CUDA 9.0, Nvidia provides minimal CUDA images based on
|
Starting from CUDA 9.0, Nvidia provides minimal CUDA images based on
|
||||||
Ubuntu. Please see `their instructions <https://hub.docker.com/r/nvidia/cuda/>`_.
|
Ubuntu. Please see `their instructions <https://hub.docker.com/r/nvidia/cuda/>`_.
|
||||||
Avoid double-installing CUDA by adding, e.g.
|
Avoid double-installing CUDA by adding, e.g.
|
||||||
@@ -790,9 +728,9 @@ to your ``spack.yaml``.
|
|||||||
Users will either need ``nvidia-docker`` or e.g. Singularity to *execute*
|
Users will either need ``nvidia-docker`` or e.g. Singularity to *execute*
|
||||||
device kernels.
|
device kernels.
|
||||||
|
|
||||||
"""""""""""""""""""""""""
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
Docker on Windows and OSX
|
Docker on Windows and OSX
|
||||||
"""""""""""""""""""""""""
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
On Mac OS and Windows, docker runs on a hypervisor that is not allocated much
|
On Mac OS and Windows, docker runs on a hypervisor that is not allocated much
|
||||||
memory by default, and some spack packages may fail to build due to lack of
|
memory by default, and some spack packages may fail to build due to lack of
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -184,7 +184,7 @@ Style Tests
|
|||||||
|
|
||||||
Spack uses `Flake8 <http://flake8.pycqa.org/en/latest/>`_ to test for
|
Spack uses `Flake8 <http://flake8.pycqa.org/en/latest/>`_ to test for
|
||||||
`PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_ conformance and
|
`PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_ conformance and
|
||||||
`mypy <https://mypy.readthedocs.io/en/stable/>`_ for type checking. PEP 8 is
|
`mypy <https://mypy.readthedocs.io/en/stable/>` for type checking. PEP 8 is
|
||||||
a series of style guides for Python that provide suggestions for everything
|
a series of style guides for Python that provide suggestions for everything
|
||||||
from variable naming to indentation. In order to limit the number of PRs that
|
from variable naming to indentation. In order to limit the number of PRs that
|
||||||
were mostly style changes, we decided to enforce PEP 8 conformance. Your PR
|
were mostly style changes, we decided to enforce PEP 8 conformance. Your PR
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -357,23 +357,91 @@ If there is a hook that you would like and is missing, you can propose to add a
|
|||||||
``pre_install(spec)``
|
``pre_install(spec)``
|
||||||
"""""""""""""""""""""
|
"""""""""""""""""""""
|
||||||
|
|
||||||
A ``pre_install`` hook is run within the install subprocess, directly before the install starts.
|
A ``pre_install`` hook is run within an install subprocess, directly before
|
||||||
It expects a single argument of a spec.
|
the install starts. It expects a single argument of a spec, and is run in
|
||||||
|
a multiprocessing subprocess. Note that if you see ``pre_install`` functions associated with packages these are not hooks
|
||||||
|
as we have defined them here, but rather callback functions associated with
|
||||||
|
a package install.
|
||||||
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""
|
||||||
``post_install(spec, explicit=None)``
|
``post_install(spec)``
|
||||||
"""""""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""
|
||||||
|
|
||||||
A ``post_install`` hook is run within the install subprocess, directly after the install finishes,
|
A ``post_install`` hook is run within an install subprocess, directly after
|
||||||
but before the build stage is removed and the spec is registered in the database. It expects two
|
the install finishes, but before the build stage is removed. If you
|
||||||
arguments: spec and an optional boolean indicating whether this spec is being installed explicitly.
|
write one of these hooks, you should expect it to accept a spec as the only
|
||||||
|
argument. This is run in a multiprocessing subprocess. This ``post_install`` is
|
||||||
|
also seen in packages, but in this context not related to the hooks described
|
||||||
|
here.
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
``pre_uninstall(spec)`` and ``post_uninstall(spec)``
|
|
||||||
""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
|
|
||||||
These hooks are currently used for cleaning up module files after uninstall.
|
""""""""""""""""""""""""""
|
||||||
|
``on_install_start(spec)``
|
||||||
|
""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
This hook is run at the beginning of ``lib/spack/spack/installer.py``,
|
||||||
|
in the install function of a ``PackageInstaller``,
|
||||||
|
and importantly is not part of a build process, but before it. This is when
|
||||||
|
we have just newly grabbed the task, and are preparing to install. If you
|
||||||
|
write a hook of this type, you should provide the spec to it.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def on_install_start(spec):
|
||||||
|
"""On start of an install, we want to...
|
||||||
|
"""
|
||||||
|
print('on_install_start')
|
||||||
|
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""
|
||||||
|
``on_install_success(spec)``
|
||||||
|
""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
This hook is run on a successful install, and is also run inside the build
|
||||||
|
process, akin to ``post_install``. The main difference is that this hook
|
||||||
|
is run outside of the context of the stage directory, meaning after the
|
||||||
|
build stage has been removed and the user is alerted that the install was
|
||||||
|
successful. If you need to write a hook that is run on success of a particular
|
||||||
|
phase, you should use ``on_phase_success``.
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""
|
||||||
|
``on_install_failure(spec)``
|
||||||
|
""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
This hook is run given an install failure that happens outside of the build
|
||||||
|
subprocess, but somewhere in ``installer.py`` when something else goes wrong.
|
||||||
|
If you need to write a hook that is relevant to a failure within a build
|
||||||
|
process, you would want to instead use ``on_phase_failure``.
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""
|
||||||
|
``on_install_cancel(spec)``
|
||||||
|
"""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
The same, but triggered if a spec install is cancelled for any reason.
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
``on_phase_success(pkg, phase_name, log_file)``
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
This hook is run within the install subprocess, and specifically when a phase
|
||||||
|
successfully finishes. Since we are interested in the package, the name of
|
||||||
|
the phase, and any output from it, we require:
|
||||||
|
|
||||||
|
- **pkg**: the package variable, which also has the attached spec at ``pkg.spec``
|
||||||
|
- **phase_name**: the name of the phase that was successful (e.g., configure)
|
||||||
|
- **log_file**: the path to the file with output, in case you need to inspect or otherwise interact with it.
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
``on_phase_error(pkg, phase_name, log_file)``
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
In the case of an error during a phase, we might want to trigger some event
|
||||||
|
with a hook, and this is the purpose of this particular hook. Akin to
|
||||||
|
``on_phase_success`` we require the same variables - the package that failed,
|
||||||
|
the name of the phase, and the log file where we might find errors.
|
||||||
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@@ -552,11 +620,11 @@ With either interpreter you can run a single command:
|
|||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ spack python -c 'from spack.spec import Spec; Spec("python").concretized()'
|
$ spack python -c 'import distro; distro.linux_distribution()'
|
||||||
...
|
('Ubuntu', '18.04', 'Bionic Beaver')
|
||||||
|
|
||||||
$ spack python -i ipython -c 'from spack.spec import Spec; Spec("python").concretized()'
|
$ spack python -i ipython -c 'import distro; distro.linux_distribution()'
|
||||||
Out[1]: ...
|
Out[1]: ('Ubuntu', '18.04', 'Bionic Beaver')
|
||||||
|
|
||||||
or a file:
|
or a file:
|
||||||
|
|
||||||
@@ -716,27 +784,27 @@ Release branches
|
|||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
There are currently two types of Spack releases: :ref:`major releases
|
There are currently two types of Spack releases: :ref:`major releases
|
||||||
<major-releases>` (``0.21.0``, ``0.22.0``, etc.) and :ref:`patch releases
|
<major-releases>` (``0.17.0``, ``0.18.0``, etc.) and :ref:`point releases
|
||||||
<patch-releases>` (``0.22.1``, ``0.22.2``, ``0.22.3``, etc.). Here is a
|
<point-releases>` (``0.17.1``, ``0.17.2``, ``0.17.3``, etc.). Here is a
|
||||||
diagram of how Spack release branches work::
|
diagram of how Spack release branches work::
|
||||||
|
|
||||||
o branch: develop (latest version, v0.23.0.dev0)
|
o branch: develop (latest version, v0.19.0.dev0)
|
||||||
|
|
|
|
||||||
o
|
o
|
||||||
| o branch: releases/v0.22, tag: v0.22.1
|
| o branch: releases/v0.18, tag: v0.18.1
|
||||||
o |
|
o |
|
||||||
| o tag: v0.22.0
|
| o tag: v0.18.0
|
||||||
o |
|
o |
|
||||||
| o
|
| o
|
||||||
|/
|
|/
|
||||||
o
|
o
|
||||||
|
|
|
|
||||||
o
|
o
|
||||||
| o branch: releases/v0.21, tag: v0.21.2
|
| o branch: releases/v0.17, tag: v0.17.2
|
||||||
o |
|
o |
|
||||||
| o tag: v0.21.1
|
| o tag: v0.17.1
|
||||||
o |
|
o |
|
||||||
| o tag: v0.21.0
|
| o tag: v0.17.0
|
||||||
o |
|
o |
|
||||||
| o
|
| o
|
||||||
|/
|
|/
|
||||||
@@ -747,8 +815,8 @@ requests target ``develop``. The ``develop`` branch will report that its
|
|||||||
version is that of the next **major** release with a ``.dev0`` suffix.
|
version is that of the next **major** release with a ``.dev0`` suffix.
|
||||||
|
|
||||||
Each Spack release series also has a corresponding branch, e.g.
|
Each Spack release series also has a corresponding branch, e.g.
|
||||||
``releases/v0.22`` has ``v0.22.x`` versions of Spack, and
|
``releases/v0.18`` has ``0.18.x`` versions of Spack, and
|
||||||
``releases/v0.21`` has ``v0.21.x`` versions. A major release is the first
|
``releases/v0.17`` has ``0.17.x`` versions. A major release is the first
|
||||||
tagged version on a release branch. Minor releases are back-ported from
|
tagged version on a release branch. Minor releases are back-ported from
|
||||||
develop onto release branches. This is typically done by cherry-picking
|
develop onto release branches. This is typically done by cherry-picking
|
||||||
bugfix commits off of ``develop``.
|
bugfix commits off of ``develop``.
|
||||||
@@ -778,40 +846,27 @@ for more details.
|
|||||||
Scheduling work for releases
|
Scheduling work for releases
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
We schedule work for **major releases** through `milestones
|
We schedule work for releases by creating `GitHub projects
|
||||||
<https://github.com/spack/spack/milestones>`_ and `GitHub Projects
|
<https://github.com/spack/spack/projects>`_. At any time, there may be
|
||||||
<https://github.com/spack/spack/projects>`_, while **patch releases** use `labels
|
several open release projects. For example, below are two releases (from
|
||||||
<https://github.com/spack/spack/labels>`_.
|
some past version of the page linked above):
|
||||||
|
|
||||||
There is only one milestone open at a time. Its name corresponds to the next major version, for
|
.. image:: images/projects.png
|
||||||
example ``v0.23``. Important issues and pull requests should be assigned to this milestone by
|
|
||||||
core developers, so that they are not forgotten at the time of release. The milestone is closed
|
|
||||||
when the release is made, and a new milestone is created for the next major release.
|
|
||||||
|
|
||||||
Bug reports in GitHub issues are automatically labelled ``bug`` and ``triage``. Spack developers
|
This image shows one release in progress for ``0.15.1`` and another for
|
||||||
assign one of the labels ``impact-low``, ``impact-medium`` or ``impact-high``. This will make the
|
``0.16.0``. Each of these releases has a project board containing issues
|
||||||
issue appear in the `Triaged bugs <https://github.com/orgs/spack/projects/6>`_ project board.
|
and pull requests. GitHub shows a status bar with completed work in
|
||||||
Important issues should be assigned to the next milestone as well, so they appear at the top of
|
green, work in progress in purple, and work not started yet in gray, so
|
||||||
the project board.
|
it's fairly easy to see progress.
|
||||||
|
|
||||||
Spack's milestones are not firm commitments so we move work between releases frequently. If we
|
Spack's project boards are not firm commitments so we move work between
|
||||||
need to make a release and some tasks are not yet done, we will simply move them to the next major
|
releases frequently. If we need to make a release and some tasks are not
|
||||||
release milestone, rather than delaying the release to complete them.
|
yet done, we will simply move them to the next minor or major release, rather
|
||||||
|
than delaying the release to complete them.
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
For more on using GitHub project boards, see `GitHub's documentation
|
||||||
Backporting bug fixes
|
<https://docs.github.com/en/github/managing-your-work-on-github/about-project-boards>`_.
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
When a bug is fixed in the ``develop`` branch, it is often necessary to backport the fix to one
|
|
||||||
(or more) of the ``release/vX.Y`` branches. Only the release manager is responsible for doing
|
|
||||||
backports, but Spack maintainers are responsible for labelling pull requests (and issues if no bug
|
|
||||||
fix is available yet) with ``vX.Y.Z`` labels. The label should correspond to the next patch version
|
|
||||||
that the bug fix should be backported to.
|
|
||||||
|
|
||||||
Backports are done publicly by the release manager using a pull request named ``Backports vX.Y.Z``.
|
|
||||||
This pull request is opened from the ``backports/vX.Y.Z`` branch, targets the ``releases/vX.Y``
|
|
||||||
branch and contains a (growing) list of cherry-picked commits from the ``develop`` branch.
|
|
||||||
Typically there are one or two backport pull requests open at any given time.
|
|
||||||
|
|
||||||
.. _major-releases:
|
.. _major-releases:
|
||||||
|
|
||||||
@@ -819,21 +874,25 @@ Typically there are one or two backport pull requests open at any given time.
|
|||||||
Making major releases
|
Making major releases
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Assuming all required work from the milestone is completed, the steps to make the major release
|
Assuming a project board has already been created and all required work
|
||||||
are:
|
completed, the steps to make the major release are:
|
||||||
|
|
||||||
#. `Create a new milestone <https://github.com/spack/spack/milestones>`_ for the next major
|
#. Create two new project boards:
|
||||||
release.
|
|
||||||
|
|
||||||
#. `Create a new label <https://github.com/spack/spack/labels>`_ for the next patch release.
|
* One for the next major release
|
||||||
|
* One for the next point release
|
||||||
|
|
||||||
#. Move any optional tasks that are not done to the next milestone.
|
#. Move any optional tasks that are not done to one of the new project boards.
|
||||||
|
|
||||||
|
In general, small bugfixes should go to the next point release. Major
|
||||||
|
features, refactors, and changes that could affect concretization should
|
||||||
|
go in the next major release.
|
||||||
|
|
||||||
#. Create a branch for the release, based on ``develop``:
|
#. Create a branch for the release, based on ``develop``:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ git checkout -b releases/v0.23 develop
|
$ git checkout -b releases/v0.15 develop
|
||||||
|
|
||||||
For a version ``vX.Y.Z``, the branch's name should be
|
For a version ``vX.Y.Z``, the branch's name should be
|
||||||
``releases/vX.Y``. That is, you should create a ``releases/vX.Y``
|
``releases/vX.Y``. That is, you should create a ``releases/vX.Y``
|
||||||
@@ -869,8 +928,8 @@ are:
|
|||||||
|
|
||||||
Create a pull request targeting the ``develop`` branch, bumping the major
|
Create a pull request targeting the ``develop`` branch, bumping the major
|
||||||
version in ``lib/spack/spack/__init__.py`` with a ``dev0`` release segment.
|
version in ``lib/spack/spack/__init__.py`` with a ``dev0`` release segment.
|
||||||
For instance when you have just released ``v0.23.0``, set the version
|
For instance when you have just released ``v0.15.0``, set the version
|
||||||
to ``(0, 24, 0, 'dev0')`` on ``develop``.
|
to ``(0, 16, 0, 'dev0')`` on ``develop``.
|
||||||
|
|
||||||
#. Follow the steps in :ref:`publishing-releases`.
|
#. Follow the steps in :ref:`publishing-releases`.
|
||||||
|
|
||||||
@@ -879,52 +938,82 @@ are:
|
|||||||
#. Follow the steps in :ref:`announcing-releases`.
|
#. Follow the steps in :ref:`announcing-releases`.
|
||||||
|
|
||||||
|
|
||||||
.. _patch-releases:
|
.. _point-releases:
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
Making patch releases
|
Making point releases
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
To make the patch release process both efficient and transparent, we use a *backports pull request*
|
Assuming a project board has already been created and all required work
|
||||||
which contains cherry-picked commits from the ``develop`` branch. The majority of the work is to
|
completed, the steps to make the point release are:
|
||||||
cherry-pick the bug fixes, which ideally should be done as soon as they land on ``develop``:
|
|
||||||
this ensures cherry-picking happens in order, and makes conflicts easier to resolve since the
|
|
||||||
changes are fresh in the mind of the developer.
|
|
||||||
|
|
||||||
The backports pull request is always titled ``Backports vX.Y.Z`` and is labelled ``backports``. It
|
#. Create a new project board for the next point release.
|
||||||
is opened from a branch named ``backports/vX.Y.Z`` and targets the ``releases/vX.Y`` branch.
|
|
||||||
|
|
||||||
Whenever a pull request labelled ``vX.Y.Z`` is merged, cherry-pick the associated squashed commit
|
#. Move any optional tasks that are not done to the next project board.
|
||||||
on ``develop`` to the ``backports/vX.Y.Z`` branch. For pull requests that were rebased (or not
|
|
||||||
squashed), cherry-pick each associated commit individually. Never force push to the
|
|
||||||
``backports/vX.Y.Z`` branch.
|
|
||||||
|
|
||||||
.. warning::
|
#. Check out the release branch (it should already exist).
|
||||||
|
|
||||||
Sometimes you may **still** get merge conflicts even if you have
|
For the ``X.Y.Z`` release, the release branch is called ``releases/vX.Y``.
|
||||||
cherry-picked all the commits in order. This generally means there
|
For ``v0.15.1``, you would check out ``releases/v0.15``:
|
||||||
is some other intervening pull request that the one you're trying
|
|
||||||
to pick depends on. In these cases, you'll need to make a judgment
|
|
||||||
call regarding those pull requests. Consider the number of affected
|
|
||||||
files and/or the resulting differences.
|
|
||||||
|
|
||||||
1. If the changes are small, you might just cherry-pick it.
|
.. code-block:: console
|
||||||
|
|
||||||
2. If the changes are large, then you may decide that this fix is not
|
$ git checkout releases/v0.15
|
||||||
worth including in a patch release, in which case you should remove
|
|
||||||
the label from the pull request. Remember that large, manual backports
|
|
||||||
are seldom the right choice for a patch release.
|
|
||||||
|
|
||||||
When all commits are cherry-picked in the ``backports/vX.Y.Z`` branch, make the patch
|
#. If a pull request to the release branch named ``Backports vX.Y.Z`` is not already
|
||||||
release as follows:
|
in the project, create it. This pull request ought to be created as early as
|
||||||
|
possible when working on a release project, so that we can build the release
|
||||||
|
commits incrementally, and identify potential conflicts at an early stage.
|
||||||
|
|
||||||
#. `Create a new label <https://github.com/spack/spack/labels>`_ ``vX.Y.{Z+1}`` for the next patch
|
#. Cherry-pick each pull request in the ``Done`` column of the release
|
||||||
release.
|
project board onto the ``Backports vX.Y.Z`` pull request.
|
||||||
|
|
||||||
#. Replace the label ``vX.Y.Z`` with ``vX.Y.{Z+1}`` for all PRs and issues that are not done.
|
This is **usually** fairly simple since we squash the commits from the
|
||||||
|
vast majority of pull requests. That means there is only one commit
|
||||||
|
per pull request to cherry-pick. For example, `this pull request
|
||||||
|
<https://github.com/spack/spack/pull/15777>`_ has three commits, but
|
||||||
|
they were squashed into a single commit on merge. You can see the
|
||||||
|
commit that was created here:
|
||||||
|
|
||||||
#. Manually push a single commit with commit message ``Set version to vX.Y.Z`` to the
|
.. image:: images/pr-commit.png
|
||||||
``backports/vX.Y.Z`` branch, that both bumps the Spack version number and updates the changelog:
|
|
||||||
|
You can easily cherry pick it like this (assuming you already have the
|
||||||
|
release branch checked out):
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ git cherry-pick 7e46da7
|
||||||
|
|
||||||
|
For pull requests that were rebased (or not squashed), you'll need to
|
||||||
|
cherry-pick each associated commit individually.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
It is important to cherry-pick commits in the order they happened,
|
||||||
|
otherwise you can get conflicts while cherry-picking. When
|
||||||
|
cherry-picking look at the merge date,
|
||||||
|
**not** the number of the pull request or the date it was opened.
|
||||||
|
|
||||||
|
Sometimes you may **still** get merge conflicts even if you have
|
||||||
|
cherry-picked all the commits in order. This generally means there
|
||||||
|
is some other intervening pull request that the one you're trying
|
||||||
|
to pick depends on. In these cases, you'll need to make a judgment
|
||||||
|
call regarding those pull requests. Consider the number of affected
|
||||||
|
files and or the resulting differences.
|
||||||
|
|
||||||
|
1. If the dependency changes are small, you might just cherry-pick it,
|
||||||
|
too. If you do this, add the task to the release board.
|
||||||
|
|
||||||
|
2. If the changes are large, then you may decide that this fix is not
|
||||||
|
worth including in a point release, in which case you should remove
|
||||||
|
the task from the release project.
|
||||||
|
|
||||||
|
3. You can always decide to manually back-port the fix to the release
|
||||||
|
branch if neither of the above options makes sense, but this can
|
||||||
|
require a lot of work. It's seldom the right choice.
|
||||||
|
|
||||||
|
#. When all the commits from the project board are cherry-picked into
|
||||||
|
the ``Backports vX.Y.Z`` pull request, you can push a commit to:
|
||||||
|
|
||||||
1. Bump the version in ``lib/spack/spack/__init__.py``.
|
1. Bump the version in ``lib/spack/spack/__init__.py``.
|
||||||
2. Update ``CHANGELOG.md`` with a list of the changes.
|
2. Update ``CHANGELOG.md`` with a list of the changes.
|
||||||
@@ -933,22 +1022,20 @@ release as follows:
|
|||||||
release branch. See `the changelog from 0.14.1
|
release branch. See `the changelog from 0.14.1
|
||||||
<https://github.com/spack/spack/commit/ff0abb9838121522321df2a054d18e54b566b44a>`_.
|
<https://github.com/spack/spack/commit/ff0abb9838121522321df2a054d18e54b566b44a>`_.
|
||||||
|
|
||||||
#. Make sure CI passes on the **backports pull request**, including:
|
#. Merge the ``Backports vX.Y.Z`` PR with the **Rebase and merge** strategy. This
|
||||||
|
is needed to keep track in the release branch of all the commits that were
|
||||||
|
cherry-picked.
|
||||||
|
|
||||||
|
#. Make sure CI passes on the release branch, including:
|
||||||
|
|
||||||
* Regular unit tests
|
* Regular unit tests
|
||||||
* Build tests
|
* Build tests
|
||||||
* The E4S pipeline at `gitlab.spack.io <https://gitlab.spack.io>`_
|
* The E4S pipeline at `gitlab.spack.io <https://gitlab.spack.io>`_
|
||||||
|
|
||||||
#. Merge the ``Backports vX.Y.Z`` PR with the **Rebase and merge** strategy. This
|
If CI does not pass, you'll need to figure out why, and make changes
|
||||||
is needed to keep track in the release branch of all the commits that were
|
to the release branch until it does. You can make more commits, modify
|
||||||
cherry-picked.
|
or remove cherry-picked commits, or cherry-pick **more** from
|
||||||
|
``develop`` to make this happen.
|
||||||
#. Make sure CI passes on the last commit of the **release branch**.
|
|
||||||
|
|
||||||
#. In the rare case you need to include additional commits in the patch release after the backports
|
|
||||||
PR is merged, it is best to delete the last commit ``Set version to vX.Y.Z`` from the release
|
|
||||||
branch with a single force push, open a new backports PR named ``Backports vX.Y.Z (2)``, and
|
|
||||||
repeat the process. Avoid repeated force pushes to the release branch.
|
|
||||||
|
|
||||||
#. Follow the steps in :ref:`publishing-releases`.
|
#. Follow the steps in :ref:`publishing-releases`.
|
||||||
|
|
||||||
@@ -1023,31 +1110,25 @@ Updating `releases/latest`
|
|||||||
|
|
||||||
If the new release is the **highest** Spack release yet, you should
|
If the new release is the **highest** Spack release yet, you should
|
||||||
also tag it as ``releases/latest``. For example, suppose the highest
|
also tag it as ``releases/latest``. For example, suppose the highest
|
||||||
release is currently ``0.22.3``:
|
release is currently ``0.15.3``:
|
||||||
|
|
||||||
* If you are releasing ``0.22.4`` or ``0.23.0``, then you should tag
|
* If you are releasing ``0.15.4`` or ``0.16.0``, then you should tag
|
||||||
it with ``releases/latest``, as these are higher than ``0.22.3``.
|
it with ``releases/latest``, as these are higher than ``0.15.3``.
|
||||||
|
|
||||||
* If you are making a new release of an **older** major version of
|
* If you are making a new release of an **older** major version of
|
||||||
Spack, e.g. ``0.21.4``, then you should not tag it as
|
Spack, e.g. ``0.14.4``, then you should not tag it as
|
||||||
``releases/latest`` (as there are newer major versions).
|
``releases/latest`` (as there are newer major versions).
|
||||||
|
|
||||||
To do so, first fetch the latest tag created on GitHub, since you may not have it locally:
|
To tag ``releases/latest``, do this:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ git fetch --force git@github.com:spack/spack vX.Y.Z
|
$ git checkout releases/vX.Y # vX.Y is the new release's branch
|
||||||
|
$ git tag --force releases/latest
|
||||||
|
$ git push --force --tags
|
||||||
|
|
||||||
Then tag ``vX.Y.Z`` as ``releases/latest`` and push the individual tag to GitHub.
|
The ``--force`` argument to ``git tag`` makes ``git`` overwrite the existing
|
||||||
|
``releases/latest`` tag with the new one.
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ git tag --force releases/latest vX.Y.Z
|
|
||||||
$ git push --force git@github.com:spack/spack releases/latest
|
|
||||||
|
|
||||||
The ``--force`` argument to ``git tag`` makes ``git`` overwrite the existing ``releases/latest``
|
|
||||||
tag with the new one. Do **not** use the ``--tags`` flag when pushing, since this will push *all*
|
|
||||||
local tags.
|
|
||||||
|
|
||||||
|
|
||||||
.. _announcing-releases:
|
.. _announcing-releases:
|
||||||
@@ -1058,9 +1139,9 @@ Announcing a release
|
|||||||
|
|
||||||
We announce releases in all of the major Spack communication channels.
|
We announce releases in all of the major Spack communication channels.
|
||||||
Publishing the release takes care of GitHub. The remaining channels are
|
Publishing the release takes care of GitHub. The remaining channels are
|
||||||
X, Slack, and the mailing list. Here are the steps:
|
Twitter, Slack, and the mailing list. Here are the steps:
|
||||||
|
|
||||||
#. Announce the release on X.
|
#. Announce the release on Twitter.
|
||||||
|
|
||||||
* Compose the tweet on the ``@spackpm`` account per the
|
* Compose the tweet on the ``@spackpm`` account per the
|
||||||
``spack-twitter`` slack channel.
|
``spack-twitter`` slack channel.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -142,17 +142,6 @@ user's prompt to begin with the environment name in brackets.
|
|||||||
$ spack env activate -p myenv
|
$ spack env activate -p myenv
|
||||||
[myenv] $ ...
|
[myenv] $ ...
|
||||||
|
|
||||||
The ``activate`` command can also be used to create a new environment if it does not already
|
|
||||||
exist.
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack env activate --create -p myenv
|
|
||||||
# ...
|
|
||||||
# [creates if myenv does not exist yet]
|
|
||||||
# ...
|
|
||||||
[myenv] $ ...
|
|
||||||
|
|
||||||
To deactivate an environment, use the command:
|
To deactivate an environment, use the command:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
@@ -172,36 +161,21 @@ environment will remove the view from the user environment.
|
|||||||
Anonymous Environments
|
Anonymous Environments
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Apart from managed environments, Spack also supports anonymous environments.
|
Any directory can be treated as an environment if it contains a file
|
||||||
|
``spack.yaml``. To load an anonymous environment, use:
|
||||||
Anonymous environments can be placed in any directory of choice.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
When uninstalling packages, Spack asks the user to confirm the removal of packages
|
|
||||||
that are still used in a managed environment. This is not the case for anonymous
|
|
||||||
environments.
|
|
||||||
|
|
||||||
To create an anonymous environment, use one of the following commands:
|
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ spack env create --dir my_env
|
$ spack env activate -d /path/to/directory
|
||||||
$ spack env create ./my_env
|
|
||||||
|
|
||||||
As a shorthand, you can also create an anonymous environment upon activation if it does not
|
Anonymous specs can be created in place using the command:
|
||||||
already exist:
|
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ spack env activate --create ./my_env
|
$ spack env create -d .
|
||||||
|
|
||||||
For convenience, Spack can also place an anonymous environment in a temporary directory for you:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack env activate --temp
|
|
||||||
|
|
||||||
|
In this case Spack simply creates a ``spack.yaml`` file in the requested
|
||||||
|
directory.
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
Environment Sensitive Commands
|
Environment Sensitive Commands
|
||||||
@@ -427,23 +401,6 @@ that git clone if ``foo`` is in the environment.
|
|||||||
Further development on ``foo`` can be tested by reinstalling the environment,
|
Further development on ``foo`` can be tested by reinstalling the environment,
|
||||||
and eventually committed and pushed to the upstream git repo.
|
and eventually committed and pushed to the upstream git repo.
|
||||||
|
|
||||||
If the package being developed supports out-of-source builds then users can use the
|
|
||||||
``--build_directory`` flag to control the location and name of the build directory.
|
|
||||||
This is a shortcut to set the ``package_attributes:build_directory`` in the
|
|
||||||
``packages`` configuration (see :ref:`assigning-package-attributes`).
|
|
||||||
The supplied location will become the build-directory for that package in all future builds.
|
|
||||||
|
|
||||||
.. warning::
|
|
||||||
Potential pitfalls of setting the build directory
|
|
||||||
Spack does not check for out-of-source build compatibility with the packages and
|
|
||||||
so the onerous of making sure the package supports out-of-source builds is on
|
|
||||||
the user.
|
|
||||||
For example, most ``autotool`` and ``makefile`` packages do not support out-of-source builds
|
|
||||||
while all ``CMake`` packages do.
|
|
||||||
Understanding these nuances are on the software developers and we strongly encourage
|
|
||||||
developers to only redirect the build directory if they understand their package's
|
|
||||||
build-system.
|
|
||||||
|
|
||||||
^^^^^^^
|
^^^^^^^
|
||||||
Loading
|
Loading
|
||||||
^^^^^^^
|
^^^^^^^
|
||||||
@@ -460,125 +417,6 @@ Sourcing that file in Bash will make the environment available to the
|
|||||||
user; and can be included in ``.bashrc`` files, etc. The ``loads``
|
user; and can be included in ``.bashrc`` files, etc. The ``loads``
|
||||||
file may also be copied out of the environment, renamed, etc.
|
file may also be copied out of the environment, renamed, etc.
|
||||||
|
|
||||||
|
|
||||||
.. _environment_include_concrete:
|
|
||||||
|
|
||||||
------------------------------
|
|
||||||
Included Concrete Environments
|
|
||||||
------------------------------
|
|
||||||
|
|
||||||
Spack environments can create an environment based off of information in already
|
|
||||||
established environments. You can think of it as a combination of existing
|
|
||||||
environments. It will gather information from the existing environment's
|
|
||||||
``spack.lock`` and use that during the creation of this included concrete
|
|
||||||
environment. When an included concrete environment is created it will generate
|
|
||||||
a ``spack.lock`` file for the newly created environment.
|
|
||||||
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
Creating included environments
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
To create a combined concrete environment, you must have at least one existing
|
|
||||||
concrete environment. You will use the command ``spack env create`` with the
|
|
||||||
argument ``--include-concrete`` followed by the name or path of the environment
|
|
||||||
you'd like to include. Here is an example of how to create a combined environment
|
|
||||||
from the command line.
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack env create myenv
|
|
||||||
$ spack -e myenv add python
|
|
||||||
$ spack -e myenv concretize
|
|
||||||
$ spack env create --include-concrete myenv included_env
|
|
||||||
|
|
||||||
|
|
||||||
You can also include an environment directly in the ``spack.yaml`` file. It
|
|
||||||
involves adding the ``include_concrete`` heading in the yaml followed by the
|
|
||||||
absolute path to the independent environments.
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
spack:
|
|
||||||
specs: []
|
|
||||||
concretizer:
|
|
||||||
unify: true
|
|
||||||
include_concrete:
|
|
||||||
- /absolute/path/to/environment1
|
|
||||||
- /absolute/path/to/environment2
|
|
||||||
|
|
||||||
|
|
||||||
Once the ``spack.yaml`` has been updated you must concretize the environment to
|
|
||||||
get the concrete specs from the included environments.
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
Updating an included environment
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
If changes were made to the base environment and you want that reflected in the
|
|
||||||
included environment you will need to reconcretize both the base environment and the
|
|
||||||
included environment for the change to be implemented. For example:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack env create myenv
|
|
||||||
$ spack -e myenv add python
|
|
||||||
$ spack -e myenv concretize
|
|
||||||
$ spack env create --include-concrete myenv included_env
|
|
||||||
|
|
||||||
|
|
||||||
$ spack -e myenv find
|
|
||||||
==> In environment myenv
|
|
||||||
==> Root specs
|
|
||||||
python
|
|
||||||
|
|
||||||
==> 0 installed packages
|
|
||||||
|
|
||||||
|
|
||||||
$ spack -e included_env find
|
|
||||||
==> In environment included_env
|
|
||||||
==> No root specs
|
|
||||||
==> Included specs
|
|
||||||
python
|
|
||||||
|
|
||||||
==> 0 installed packages
|
|
||||||
|
|
||||||
Here we see that ``included_env`` has access to the python package through
|
|
||||||
the ``myenv`` environment. But if we were to add another spec to ``myenv``,
|
|
||||||
``included_env`` will not be able to access the new information.
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack -e myenv add perl
|
|
||||||
$ spack -e myenv concretize
|
|
||||||
$ spack -e myenv find
|
|
||||||
==> In environment myenv
|
|
||||||
==> Root specs
|
|
||||||
perl python
|
|
||||||
|
|
||||||
==> 0 installed packages
|
|
||||||
|
|
||||||
|
|
||||||
$ spack -e included_env find
|
|
||||||
==> In environment included_env
|
|
||||||
==> No root specs
|
|
||||||
==> Included specs
|
|
||||||
python
|
|
||||||
|
|
||||||
==> 0 installed packages
|
|
||||||
|
|
||||||
It isn't until you run the ``spack concretize`` command that the combined
|
|
||||||
environment will get the updated information from the reconcretized base environmennt.
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack -e included_env concretize
|
|
||||||
$ spack -e included_env find
|
|
||||||
==> In environment included_env
|
|
||||||
==> No root specs
|
|
||||||
==> Included specs
|
|
||||||
perl python
|
|
||||||
|
|
||||||
==> 0 installed packages
|
|
||||||
|
|
||||||
.. _environment-configuration:
|
.. _environment-configuration:
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
@@ -619,11 +457,11 @@ a ``packages.yaml`` file) could contain:
|
|||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
spack:
|
spack:
|
||||||
# ...
|
...
|
||||||
packages:
|
packages:
|
||||||
all:
|
all:
|
||||||
compiler: [intel]
|
compiler: [intel]
|
||||||
# ...
|
...
|
||||||
|
|
||||||
This configuration sets the default compiler for all packages to
|
This configuration sets the default compiler for all packages to
|
||||||
``intel``.
|
``intel``.
|
||||||
@@ -930,7 +768,6 @@ For example, the following environment has three root packages:
|
|||||||
This allows for a much-needed reduction in redundancy between packages
|
This allows for a much-needed reduction in redundancy between packages
|
||||||
and constraints.
|
and constraints.
|
||||||
|
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
Filesystem Views
|
Filesystem Views
|
||||||
----------------
|
----------------
|
||||||
@@ -970,7 +807,7 @@ directories.
|
|||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
spack:
|
spack:
|
||||||
# ...
|
...
|
||||||
view:
|
view:
|
||||||
mpis:
|
mpis:
|
||||||
root: /path/to/view
|
root: /path/to/view
|
||||||
@@ -1014,7 +851,7 @@ automatically named ``default``, so that
|
|||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
spack:
|
spack:
|
||||||
# ...
|
...
|
||||||
view: True
|
view: True
|
||||||
|
|
||||||
is equivalent to
|
is equivalent to
|
||||||
@@ -1022,7 +859,7 @@ is equivalent to
|
|||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
spack:
|
spack:
|
||||||
# ...
|
...
|
||||||
view:
|
view:
|
||||||
default:
|
default:
|
||||||
root: .spack-env/view
|
root: .spack-env/view
|
||||||
@@ -1032,7 +869,7 @@ and
|
|||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
spack:
|
spack:
|
||||||
# ...
|
...
|
||||||
view: /path/to/view
|
view: /path/to/view
|
||||||
|
|
||||||
is equivalent to
|
is equivalent to
|
||||||
@@ -1040,7 +877,7 @@ is equivalent to
|
|||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
spack:
|
spack:
|
||||||
# ...
|
...
|
||||||
view:
|
view:
|
||||||
default:
|
default:
|
||||||
root: /path/to/view
|
root: /path/to/view
|
||||||
@@ -1083,17 +920,6 @@ function, as shown in the example below:
|
|||||||
^mpi: "{name}-{version}/{^mpi.name}-{^mpi.version}-{compiler.name}-{compiler.version}"
|
^mpi: "{name}-{version}/{^mpi.name}-{^mpi.version}-{compiler.name}-{compiler.version}"
|
||||||
all: "{name}-{version}/{compiler.name}-{compiler.version}"
|
all: "{name}-{version}/{compiler.name}-{compiler.version}"
|
||||||
|
|
||||||
Projections also permit environment and spack configuration variable
|
|
||||||
expansions as shown below:
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
projections:
|
|
||||||
all: "{name}-{version}/{compiler.name}-{compiler.version}/$date/$SYSTEM_ENV_VARIBLE"
|
|
||||||
|
|
||||||
where ``$date`` is the spack configuration variable that will expand with the ``YYYY-MM-DD``
|
|
||||||
format and ``$SYSTEM_ENV_VARIABLE`` is an environment variable defined in the shell.
|
|
||||||
|
|
||||||
The entries in the projections configuration file must all be either
|
The entries in the projections configuration file must all be either
|
||||||
specs or the keyword ``all``. For each spec, the projection used will
|
specs or the keyword ``all``. For each spec, the projection used will
|
||||||
be the first non-``all`` entry that the spec satisfies, or ``all`` if
|
be the first non-``all`` entry that the spec satisfies, or ``all`` if
|
||||||
@@ -1164,7 +990,7 @@ other targets to depend on the environment installation.
|
|||||||
|
|
||||||
A typical workflow is as follows:
|
A typical workflow is as follows:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code:: console
|
||||||
|
|
||||||
spack env create -d .
|
spack env create -d .
|
||||||
spack -e . add perl
|
spack -e . add perl
|
||||||
@@ -1257,7 +1083,7 @@ its dependencies. This can be useful when certain flags should only apply to
|
|||||||
dependencies. Below we show a use case where a spec is installed with verbose
|
dependencies. Below we show a use case where a spec is installed with verbose
|
||||||
output (``spack install --verbose``) while its dependencies are installed silently:
|
output (``spack install --verbose``) while its dependencies are installed silently:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code:: console
|
||||||
|
|
||||||
$ spack env depfile -o Makefile
|
$ spack env depfile -o Makefile
|
||||||
|
|
||||||
@@ -1279,7 +1105,7 @@ This can be accomplished through the generated ``[<prefix>/]SPACK_PACKAGE_IDS``
|
|||||||
variable. Assuming we have an active and concrete environment, we generate the
|
variable. Assuming we have an active and concrete environment, we generate the
|
||||||
associated ``Makefile`` with a prefix ``example``:
|
associated ``Makefile`` with a prefix ``example``:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code:: console
|
||||||
|
|
||||||
$ spack env depfile -o env.mk --make-prefix example
|
$ spack env depfile -o env.mk --make-prefix example
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -111,39 +111,3 @@ The corresponding unit tests can be run giving the appropriate options to ``spac
|
|||||||
|
|
||||||
(5 durations < 0.005s hidden. Use -vv to show these durations.)
|
(5 durations < 0.005s hidden. Use -vv to show these durations.)
|
||||||
=========================================== 5 passed in 5.06s ============================================
|
=========================================== 5 passed in 5.06s ============================================
|
||||||
|
|
||||||
---------------------------------------
|
|
||||||
Registering Extensions via Entry Points
|
|
||||||
---------------------------------------
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
Python version >= 3.8 is required to register extensions via entry points.
|
|
||||||
|
|
||||||
Spack can be made aware of extensions that are installed as part of a python package. To do so, register a function that returns the extension path, or paths, to the ``"spack.extensions"`` entry point. Consider the Python package ``my_package`` that includes a Spack extension:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
my-package/
|
|
||||||
├── src
|
|
||||||
│ ├── my_package
|
|
||||||
│ │ └── __init__.py
|
|
||||||
│ └── spack-scripting/ # the spack extensions
|
|
||||||
└── pyproject.toml
|
|
||||||
|
|
||||||
adding the following to ``my_package``'s ``pyproject.toml`` will make the ``spack-scripting`` extension visible to Spack when ``my_package`` is installed:
|
|
||||||
|
|
||||||
.. code-block:: toml
|
|
||||||
|
|
||||||
[project.entry_points."spack.extenions"]
|
|
||||||
my_package = "my_package:get_extension_path"
|
|
||||||
|
|
||||||
The function ``my_package.get_extension_path`` in ``my_package/__init__.py`` might look like
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import importlib.resources
|
|
||||||
|
|
||||||
def get_extension_path():
|
|
||||||
dirname = importlib.resources.files("my_package").joinpath("spack-scripting")
|
|
||||||
if dirname.exists():
|
|
||||||
return str(dirname)
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -35,7 +35,7 @@ A build matrix showing which packages are working on which systems is shown belo
|
|||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
apt update
|
apt update
|
||||||
apt install bzip2 ca-certificates file g++ gcc gfortran git gzip lsb-release patch python3 tar unzip xz-utils zstd
|
apt install build-essential ca-certificates coreutils curl environment-modules gfortran git gpg lsb-release python3 python3-distutils python3-venv unzip zip
|
||||||
|
|
||||||
.. tab-item:: RHEL
|
.. tab-item:: RHEL
|
||||||
|
|
||||||
@@ -43,14 +43,14 @@ A build matrix showing which packages are working on which systems is shown belo
|
|||||||
|
|
||||||
dnf install epel-release
|
dnf install epel-release
|
||||||
dnf group install "Development Tools"
|
dnf group install "Development Tools"
|
||||||
dnf install gcc-gfortran redhat-lsb-core python3 unzip
|
dnf install curl findutils gcc-gfortran gnupg2 hostname iproute redhat-lsb-core python3 python3-pip python3-setuptools unzip python3-boto3
|
||||||
|
|
||||||
.. tab-item:: macOS Brew
|
.. tab-item:: macOS Brew
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
brew update
|
brew update
|
||||||
brew install gcc git zip
|
brew install curl gcc git gnupg zip
|
||||||
|
|
||||||
------------
|
------------
|
||||||
Installation
|
Installation
|
||||||
@@ -250,10 +250,9 @@ Compiler configuration
|
|||||||
|
|
||||||
Spack has the ability to build packages with multiple compilers and
|
Spack has the ability to build packages with multiple compilers and
|
||||||
compiler versions. Compilers can be made available to Spack by
|
compiler versions. Compilers can be made available to Spack by
|
||||||
specifying them manually in ``compilers.yaml`` or ``packages.yaml``,
|
specifying them manually in ``compilers.yaml``, or automatically by
|
||||||
or automatically by running ``spack compiler find``, but for
|
running ``spack compiler find``, but for convenience Spack will
|
||||||
convenience Spack will automatically detect compilers the first time
|
automatically detect compilers the first time it needs them.
|
||||||
it needs them.
|
|
||||||
|
|
||||||
.. _cmd-spack-compilers:
|
.. _cmd-spack-compilers:
|
||||||
|
|
||||||
@@ -458,54 +457,6 @@ specification. The operations available to modify the environment are ``set``, `
|
|||||||
prepend_path: # Similar for append|remove_path
|
prepend_path: # Similar for append|remove_path
|
||||||
LD_LIBRARY_PATH: /ld/paths/added/by/setvars/sh
|
LD_LIBRARY_PATH: /ld/paths/added/by/setvars/sh
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Spack is in the process of moving compilers from a separate
|
|
||||||
attribute to be handled like all other packages. As part of this
|
|
||||||
process, the ``compilers.yaml`` section will eventually be replaced
|
|
||||||
by configuration in the ``packages.yaml`` section. This new
|
|
||||||
configuration is now available, although it is not yet the default
|
|
||||||
behavior.
|
|
||||||
|
|
||||||
Compilers can also be configured as external packages in the
|
|
||||||
``packages.yaml`` config file. Any external package for a compiler
|
|
||||||
(e.g. ``gcc`` or ``llvm``) will be treated as a configured compiler
|
|
||||||
assuming the paths to the compiler executables are determinable from
|
|
||||||
the prefix.
|
|
||||||
|
|
||||||
If the paths to the compiler executable are not determinable from the
|
|
||||||
prefix, you can add them to the ``extra_attributes`` field. Similarly,
|
|
||||||
all other fields from the compilers config can be added to the
|
|
||||||
``extra_attributes`` field for an external representing a compiler.
|
|
||||||
|
|
||||||
Note that the format for the ``paths`` field in the
|
|
||||||
``extra_attributes`` section is different than in the ``compilers``
|
|
||||||
config. For compilers configured as external packages, the section is
|
|
||||||
named ``compilers`` and the dictionary maps language names (``c``,
|
|
||||||
``cxx``, ``fortran``) to paths, rather than using the names ``cc``,
|
|
||||||
``fc``, and ``f77``.
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
packages:
|
|
||||||
gcc:
|
|
||||||
external:
|
|
||||||
- spec: gcc@12.2.0 arch=linux-rhel8-skylake
|
|
||||||
prefix: /usr
|
|
||||||
extra_attributes:
|
|
||||||
environment:
|
|
||||||
set:
|
|
||||||
GCC_ROOT: /usr
|
|
||||||
external:
|
|
||||||
- spec: llvm+clang@15.0.0 arch=linux-rhel8-skylake
|
|
||||||
prefix: /usr
|
|
||||||
extra_attributes:
|
|
||||||
compilers:
|
|
||||||
c: /usr/bin/clang-with-suffix
|
|
||||||
cxx: /usr/bin/clang++-with-extra-info
|
|
||||||
fortran: /usr/bin/gfortran
|
|
||||||
extra_rpaths:
|
|
||||||
- /usr/lib/llvm/
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
Build Your Own Compiler
|
Build Your Own Compiler
|
||||||
@@ -672,7 +623,7 @@ Fortran.
|
|||||||
|
|
||||||
compilers:
|
compilers:
|
||||||
- compiler:
|
- compiler:
|
||||||
# ...
|
...
|
||||||
paths:
|
paths:
|
||||||
cc: /usr/bin/clang
|
cc: /usr/bin/clang
|
||||||
cxx: /usr/bin/clang++
|
cxx: /usr/bin/clang++
|
||||||
@@ -1578,8 +1529,6 @@ Microsoft Visual Studio
|
|||||||
"""""""""""""""""""""""
|
"""""""""""""""""""""""
|
||||||
|
|
||||||
Microsoft Visual Studio provides the only Windows C/C++ compiler that is currently supported by Spack.
|
Microsoft Visual Studio provides the only Windows C/C++ compiler that is currently supported by Spack.
|
||||||
Spack additionally requires that the Windows SDK (including WGL) to be installed as part of your
|
|
||||||
visual studio installation as it is required to build many packages from source.
|
|
||||||
|
|
||||||
We require several specific components to be included in the Visual Studio installation.
|
We require several specific components to be included in the Visual Studio installation.
|
||||||
One is the C/C++ toolset, which can be selected as "Desktop development with C++" or "C++ build tools,"
|
One is the C/C++ toolset, which can be selected as "Desktop development with C++" or "C++ build tools,"
|
||||||
@@ -1587,7 +1536,6 @@ depending on installation type (Professional, Build Tools, etc.) The other requ
|
|||||||
"C++ CMake tools for Windows," which can be selected from among the optional packages.
|
"C++ CMake tools for Windows," which can be selected from among the optional packages.
|
||||||
This provides CMake and Ninja for use during Spack configuration.
|
This provides CMake and Ninja for use during Spack configuration.
|
||||||
|
|
||||||
|
|
||||||
If you already have Visual Studio installed, you can make sure these components are installed by
|
If you already have Visual Studio installed, you can make sure these components are installed by
|
||||||
rerunning the installer. Next to your installation, select "Modify" and look at the
|
rerunning the installer. Next to your installation, select "Modify" and look at the
|
||||||
"Installation details" pane on the right.
|
"Installation details" pane on the right.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
BIN
lib/spack/docs/images/pr-commit.png
Normal file
BIN
lib/spack/docs/images/pr-commit.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
BIN
lib/spack/docs/images/projects.png
Normal file
BIN
lib/spack/docs/images/projects.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -12,6 +12,10 @@
|
|||||||
Spack
|
Spack
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
.. epigraph::
|
||||||
|
|
||||||
|
`These are docs for the Spack package manager. For sphere packing, see` `pyspack <https://pyspack.readthedocs.io>`_.
|
||||||
|
|
||||||
Spack is a package management tool designed to support multiple
|
Spack is a package management tool designed to support multiple
|
||||||
versions and configurations of software on a wide variety of platforms
|
versions and configurations of software on a wide variety of platforms
|
||||||
and environments. It was designed for large supercomputing centers,
|
and environments. It was designed for large supercomputing centers,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -10,7 +10,7 @@ Modules (modules.yaml)
|
|||||||
======================
|
======================
|
||||||
|
|
||||||
The use of module systems to manage user environment in a controlled way
|
The use of module systems to manage user environment in a controlled way
|
||||||
is a common practice at HPC centers that is sometimes embraced also by
|
is a common practice at HPC centers that is often embraced also by
|
||||||
individual programmers on their development machines. To support this
|
individual programmers on their development machines. To support this
|
||||||
common practice Spack integrates with `Environment Modules
|
common practice Spack integrates with `Environment Modules
|
||||||
<http://modules.sourceforge.net/>`_ and `Lmod
|
<http://modules.sourceforge.net/>`_ and `Lmod
|
||||||
@@ -21,38 +21,14 @@ Modules are one of several ways you can use Spack packages. For other
|
|||||||
options that may fit your use case better, you should also look at
|
options that may fit your use case better, you should also look at
|
||||||
:ref:`spack load <spack-load>` and :ref:`environments <environments>`.
|
:ref:`spack load <spack-load>` and :ref:`environments <environments>`.
|
||||||
|
|
||||||
-----------
|
----------------------------
|
||||||
Quick start
|
Using module files via Spack
|
||||||
-----------
|
----------------------------
|
||||||
|
|
||||||
In the current version of Spack, module files are not generated by default. To get started, you
|
If you have installed a supported module system you should be able to
|
||||||
can generate module files for all currently installed packages by running either
|
run ``module avail`` to see what module
|
||||||
|
files have been installed. Here is sample output of those programs,
|
||||||
.. code-block:: console
|
showing lots of installed packages:
|
||||||
|
|
||||||
$ spack module tcl refresh
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack module lmod refresh
|
|
||||||
|
|
||||||
Spack can also generate module files for all future installations automatically through the
|
|
||||||
following configuration:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack config add modules:default:enable:[tcl]
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ spack config add modules:default:enable:[lmod]
|
|
||||||
|
|
||||||
Assuming you have a module system installed, you should now be able to use the ``module`` command
|
|
||||||
to interact with them:
|
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
@@ -89,17 +65,33 @@ scheme used at your site.
|
|||||||
Module file customization
|
Module file customization
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
Module files are generated by post-install hooks after the successful
|
||||||
|
installation of a package.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Spack only generates modulefiles when a package is installed. If
|
||||||
|
you attempt to install a package and it is already installed, Spack
|
||||||
|
will not regenerate modulefiles for the package. This may lead to
|
||||||
|
inconsistent modulefiles if the Spack module configuration has
|
||||||
|
changed since the package was installed, either by editing a file
|
||||||
|
or changing scopes or environments.
|
||||||
|
|
||||||
|
Later in this section there is a subsection on :ref:`regenerating
|
||||||
|
modules <cmd-spack-module-refresh>` that will allow you to bring
|
||||||
|
your modules to a consistent state.
|
||||||
|
|
||||||
The table below summarizes the essential information associated with
|
The table below summarizes the essential information associated with
|
||||||
the different file formats that can be generated by Spack:
|
the different file formats that can be generated by Spack:
|
||||||
|
|
||||||
|
|
||||||
+-----------+--------------+------------------------------+----------------------------------------------+----------------------+
|
+-----------------------------+--------------------+-------------------------------+----------------------------------------------+----------------------+
|
||||||
| | Hierarchical | **Default root directory** | **Default template file** | **Compatible tools** |
|
| | **Hook name** | **Default root directory** | **Default template file** | **Compatible tools** |
|
||||||
+===========+==============+==============================+==============================================+======================+
|
+=============================+====================+===============================+==============================================+======================+
|
||||||
| ``tcl`` | No | share/spack/modules | share/spack/templates/modules/modulefile.tcl | Env. Modules/Lmod |
|
| **Tcl - Non-Hierarchical** | ``tcl`` | share/spack/modules | share/spack/templates/modules/modulefile.tcl | Env. Modules/Lmod |
|
||||||
+-----------+--------------+------------------------------+----------------------------------------------+----------------------+
|
+-----------------------------+--------------------+-------------------------------+----------------------------------------------+----------------------+
|
||||||
| ``lmod`` | Yes | share/spack/lmod | share/spack/templates/modules/modulefile.lua | Lmod |
|
| **Lua - Hierarchical** | ``lmod`` | share/spack/lmod | share/spack/templates/modules/modulefile.lua | Lmod |
|
||||||
+-----------+--------------+------------------------------+----------------------------------------------+----------------------+
|
+-----------------------------+--------------------+-------------------------------+----------------------------------------------+----------------------+
|
||||||
|
|
||||||
|
|
||||||
Spack ships with sensible defaults for the generation of module files, but
|
Spack ships with sensible defaults for the generation of module files, but
|
||||||
@@ -110,7 +102,7 @@ In general you can override or extend the default behavior by:
|
|||||||
2. writing specific rules in the ``modules.yaml`` configuration file
|
2. writing specific rules in the ``modules.yaml`` configuration file
|
||||||
3. writing your own templates to override or extend the defaults
|
3. writing your own templates to override or extend the defaults
|
||||||
|
|
||||||
The former method lets you express changes in the run-time environment
|
The former method let you express changes in the run-time environment
|
||||||
that are needed to use the installed software properly, e.g. injecting variables
|
that are needed to use the installed software properly, e.g. injecting variables
|
||||||
from language interpreters into their extensions. The latter two instead permit to
|
from language interpreters into their extensions. The latter two instead permit to
|
||||||
fine tune the filesystem layout, content and creation of module files to meet
|
fine tune the filesystem layout, content and creation of module files to meet
|
||||||
@@ -118,62 +110,79 @@ site specific conventions.
|
|||||||
|
|
||||||
.. _overide-api-calls-in-package-py:
|
.. _overide-api-calls-in-package-py:
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
Setting environment variables dynamically in ``package.py``
|
Override API calls in ``package.py``
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
There are two methods that you can implement in any ``package.py`` to dynamically affect the
|
There are two methods that you can override in any ``package.py`` to affect the
|
||||||
content of the module files generated by Spack. The most important one is
|
content of the module files generated by Spack. The first one:
|
||||||
``setup_run_environment``, which can be used to set environment variables in the module file that
|
|
||||||
depend on the spec:
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def setup_run_environment(self, env):
|
def setup_run_environment(self, env):
|
||||||
if self.spec.satisfies("+foo"):
|
pass
|
||||||
env.set("FOO", "bar")
|
|
||||||
|
|
||||||
The second, less commonly used, is ``setup_dependent_run_environment(self, env, dependent_spec)``,
|
can alter the content of the module file associated with the same package where it is overridden.
|
||||||
which allows a dependency to set variables in the module file of its dependents. This is typically
|
The second method:
|
||||||
used in packages like ``python``, ``r``, or ``perl`` to prepend the dependent's prefix to the
|
|
||||||
search path of the interpreter (``PYTHONPATH``, ``R_LIBS``, ``PERL5LIB`` resp.), so it can locate
|
|
||||||
the packages at runtime.
|
|
||||||
|
|
||||||
For example, a simplified version of the ``python`` package could look like this:
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def setup_dependent_run_environment(self, env, dependent_spec):
|
def setup_dependent_run_environment(self, env, dependent_spec):
|
||||||
if dependent_spec.package.extends(self.spec):
|
pass
|
||||||
env.prepend_path("PYTHONPATH", dependent_spec.prefix.lib.python)
|
|
||||||
|
|
||||||
and would make any package that ``extends("python")`` have its library directory added to the
|
can instead inject run-time environment modifications in the module files of packages
|
||||||
``PYTHONPATH`` environment variable in the module file. It's much more convenient to set this
|
that depend on it. In both cases you need to fill ``env`` with the desired
|
||||||
variable here, than to repeat it in every Python extension's ``setup_run_environment`` method.
|
list of environment modifications.
|
||||||
|
|
||||||
|
.. admonition:: The ``r`` package and callback APIs
|
||||||
|
|
||||||
|
An example in which it is crucial to override both methods
|
||||||
|
is given by the ``r`` package. This package installs libraries and headers
|
||||||
|
in non-standard locations and it is possible to prepend the appropriate directory
|
||||||
|
to the corresponding environment variables:
|
||||||
|
|
||||||
|
================== =================================
|
||||||
|
LD_LIBRARY_PATH ``self.prefix/rlib/R/lib``
|
||||||
|
PKG_CONFIG_PATH ``self.prefix/rlib/pkgconfig``
|
||||||
|
================== =================================
|
||||||
|
|
||||||
|
with the following snippet:
|
||||||
|
|
||||||
|
.. literalinclude:: _spack_root/var/spack/repos/builtin/packages/r/package.py
|
||||||
|
:pyobject: R.setup_run_environment
|
||||||
|
|
||||||
|
The ``r`` package also knows which environment variable should be modified
|
||||||
|
to make language extensions provided by other packages available, and modifies
|
||||||
|
it appropriately in the override of the second method:
|
||||||
|
|
||||||
|
.. literalinclude:: _spack_root/var/spack/repos/builtin/packages/r/package.py
|
||||||
|
:pyobject: R.setup_dependent_run_environment
|
||||||
|
|
||||||
.. _modules-yaml:
|
.. _modules-yaml:
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
The ``modules.yaml`` config file and module sets
|
Write a configuration file
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The configuration files that control module generation behavior are named ``modules.yaml``. The
|
The configuration files that control module generation behavior
|
||||||
default configuration looks like this:
|
are named ``modules.yaml``. The default configuration:
|
||||||
|
|
||||||
.. literalinclude:: _spack_root/etc/spack/defaults/modules.yaml
|
.. literalinclude:: _spack_root/etc/spack/defaults/modules.yaml
|
||||||
:language: yaml
|
:language: yaml
|
||||||
|
|
||||||
You can define one or more **module sets**, each of which can be configured separately with regard
|
activates the hooks to generate ``tcl`` module files and inspects
|
||||||
to install location, naming scheme, inclusion and exclusion, autoloading, et cetera.
|
the installation folder of each package for the presence of a set of subdirectories
|
||||||
|
(``bin``, ``man``, ``share/man``, etc.). If any is found its full path is prepended
|
||||||
|
to the environment variables listed below the folder name.
|
||||||
|
|
||||||
The default module set is aptly named ``default``. All
|
Spack modules can be configured for multiple module sets. The default
|
||||||
:ref:`Spack commands that operate on modules <maintaining-module-files>` apply to the ``default``
|
module set is named ``default``. All Spack commands which operate on
|
||||||
module set, unless another module set is specified explicitly (with the ``--name`` flag).
|
modules default to apply the ``default`` module set, but can be
|
||||||
|
applied to any module set in the configuration.
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
Changing the modules root
|
Changing the modules root
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
"""""""""""""""""""""""""
|
||||||
|
|
||||||
As shown in the table above, the default module root for ``lmod`` is
|
As shown in the table above, the default module root for ``lmod`` is
|
||||||
``$spack/share/spack/lmod`` and the default root for ``tcl`` is
|
``$spack/share/spack/lmod`` and the default root for ``tcl`` is
|
||||||
@@ -189,7 +198,7 @@ set by changing the ``roots`` key of the configuration.
|
|||||||
my_custom_lmod_modules:
|
my_custom_lmod_modules:
|
||||||
roots:
|
roots:
|
||||||
lmod: /path/to/install/custom/lmod/modules
|
lmod: /path/to/install/custom/lmod/modules
|
||||||
# ...
|
...
|
||||||
|
|
||||||
This configuration will create two module sets. The default module set
|
This configuration will create two module sets. The default module set
|
||||||
will install its ``tcl`` modules to ``/path/to/install/tcl/modules``
|
will install its ``tcl`` modules to ``/path/to/install/tcl/modules``
|
||||||
@@ -215,32 +224,25 @@ location could be confusing to users of your modules. In the next
|
|||||||
section, we will discuss enabling and disabling module types (module
|
section, we will discuss enabling and disabling module types (module
|
||||||
file generators) for each module set.
|
file generators) for each module set.
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
""""""""""""""""""""
|
||||||
Automatically generating module files
|
Activate other hooks
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
""""""""""""""""""""
|
||||||
|
|
||||||
Spack can be configured to automatically generate module files as part of package installation.
|
Any other module file generator shipped with Spack can be activated adding it to the
|
||||||
This is done by adding the desired module systems to the ``enable`` list.
|
list under the ``enable`` key in the module file. Currently the only generator that
|
||||||
|
is not active by default is ``lmod``, which produces hierarchical lua module files.
|
||||||
|
|
||||||
|
Each module system can then be configured separately. In fact, you should list configuration
|
||||||
|
options that affect a particular type of module files under a top level key corresponding
|
||||||
|
to the generator being customized:
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
modules:
|
modules:
|
||||||
default:
|
default:
|
||||||
enable:
|
enable:
|
||||||
- tcl
|
- tcl
|
||||||
- lmod
|
- lmod
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
Configuring ``tcl`` and ``lmod`` modules
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
You can configure the behavior of either module system separately, under a key corresponding to
|
|
||||||
the generator being customized:
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
modules:
|
|
||||||
default:
|
|
||||||
tcl:
|
tcl:
|
||||||
# contains environment modules specific customizations
|
# contains environment modules specific customizations
|
||||||
lmod:
|
lmod:
|
||||||
@@ -251,82 +253,16 @@ either change the layout of the module files on the filesystem, or they will aff
|
|||||||
their content. For the latter point it is possible to use anonymous specs
|
their content. For the latter point it is possible to use anonymous specs
|
||||||
to fine tune the set of packages on which the modifications should be applied.
|
to fine tune the set of packages on which the modifications should be applied.
|
||||||
|
|
||||||
.. _autoloading-dependencies:
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
Autoloading and hiding dependencies
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
A module file should set the variables that are needed for an application to work. But since an
|
|
||||||
application often has many dependencies, where should all the environment variables for those be
|
|
||||||
set? In Spack the rule is that each package sets the runtime variables that are needed by the
|
|
||||||
package itself, and no more. This way, dependencies can be loaded standalone too, and duplication
|
|
||||||
of environment variables is avoided.
|
|
||||||
|
|
||||||
That means however that if you want to use an application, you need to load the modules for all its
|
|
||||||
dependencies. Of course this is not something you would want users to do manually.
|
|
||||||
|
|
||||||
Since Spack knows the dependency graph of every package, it can easily generate module files that
|
|
||||||
automatically load the modules for its dependencies recursively. It is enabled by default for both
|
|
||||||
Lmod and Environment Modules under the ``autoload: direct`` config option. The former system has
|
|
||||||
builtin support through the ``depends_on`` function, the latter simply uses a ``module load``
|
|
||||||
statement. Both module systems (at least in newer versions) do reference counting, so that if a
|
|
||||||
module is loaded by two different modules, it will only be unloaded after the others are.
|
|
||||||
|
|
||||||
The ``autoload`` key accepts the values:
|
|
||||||
|
|
||||||
* ``none``: no autoloading
|
|
||||||
* ``run``: autoload direct *run* type dependencies
|
|
||||||
* ``direct``: autoload direct *link and run* type dependencies
|
|
||||||
* ``all``: autoload all dependencies
|
|
||||||
|
|
||||||
In case of ``run`` and ``direct``, a ``module load`` triggers a recursive load.
|
|
||||||
|
|
||||||
The ``direct`` option is most correct: there are cases where pure link dependencies need to set
|
|
||||||
variables for themselves, or need to have variables of their own dependencies set.
|
|
||||||
|
|
||||||
In practice however, ``run`` is often sufficient, and may make ``module load`` snappier.
|
|
||||||
|
|
||||||
The ``all`` option is discouraged and seldomly used.
|
|
||||||
|
|
||||||
A common complaint about autoloading is the large number of modules that are visible to the user.
|
|
||||||
Spack has a solution for this as well: ``hide_implicits: true``. This ensures that only those
|
|
||||||
packages you've explicitly installed are exposed by ``module avail``, but still allows for
|
|
||||||
autoloading of hidden dependencies. Lmod should support hiding implicits in general, while
|
|
||||||
Environment Modules requires version 4.7 or higher.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
If supported by your module system, we highly encourage the following configuration that enables
|
|
||||||
autoloading and hiding of implicits. It ensures all runtime variables are set correctly,
|
|
||||||
including those for dependencies, without overwhelming the user with a large number of available
|
|
||||||
modules. Further, it makes it easier to get readable module names without collisions, see the
|
|
||||||
section below on :ref:`modules-projections`.
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
modules:
|
|
||||||
default:
|
|
||||||
tcl:
|
|
||||||
hide_implicits: true
|
|
||||||
all:
|
|
||||||
autoload: direct # or `run`
|
|
||||||
lmod:
|
|
||||||
hide_implicits: true
|
|
||||||
all:
|
|
||||||
autoload: direct # or `run`
|
|
||||||
|
|
||||||
.. _anonymous_specs:
|
.. _anonymous_specs:
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
""""""""""""""""""""""""""""
|
||||||
Setting environment variables for selected packages in config
|
Selection by anonymous specs
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
""""""""""""""""""""""""""""
|
||||||
|
|
||||||
In the configuration file you can filter particular specs, and make further changes to the
|
In the configuration file you can use *anonymous specs* (i.e. specs
|
||||||
environment variables that go into their module files. This is very powerful when you want to avoid
|
that **are not required to have a root package** and are thus used just
|
||||||
:ref:`modifying the package itself <overide-api-calls-in-package-py>`, or when you want to set
|
to express constraints) to apply certain modifications on a selected set
|
||||||
certain variables on multiple selected packages at once.
|
of the installed software. For instance, in the snippet below:
|
||||||
|
|
||||||
For instance, in the snippet below:
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
@@ -369,28 +305,12 @@ the variable ``FOOBAR`` will be unset.
|
|||||||
.. note::
|
.. note::
|
||||||
Order does matter
|
Order does matter
|
||||||
The modifications associated with the ``all`` keyword are always evaluated
|
The modifications associated with the ``all`` keyword are always evaluated
|
||||||
first, no matter where they appear in the configuration file. All the other changes to
|
first, no matter where they appear in the configuration file. All the other
|
||||||
environment variables for matching specs are evaluated from top to bottom.
|
spec constraints are instead evaluated top to bottom.
|
||||||
|
|
||||||
.. warning::
|
""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
As general advice, it's often better to set as few unnecessary variables as possible. For
|
|
||||||
example, the following seemingly innocent and potentially useful configuration
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
all:
|
|
||||||
environment:
|
|
||||||
set:
|
|
||||||
"{name}_ROOT": "{prefix}"
|
|
||||||
|
|
||||||
sets ``BINUTILS_ROOT`` to its prefix in modules for ``binutils``, which happens to break
|
|
||||||
the ``gcc`` compiler: it uses this variable as its default search path for certain object
|
|
||||||
files and libraries, and by merely setting it, everything fails to link.
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
Exclude or include specific module files
|
Exclude or include specific module files
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
You can use anonymous specs also to prevent module files from being written or
|
You can use anonymous specs also to prevent module files from being written or
|
||||||
to force them to be written. Consider the case where you want to hide from users
|
to force them to be written. Consider the case where you want to hide from users
|
||||||
@@ -410,19 +330,14 @@ you will prevent the generation of module files for any package that
|
|||||||
is compiled with ``gcc@4.4.7``, with the only exception of any ``gcc``
|
is compiled with ``gcc@4.4.7``, with the only exception of any ``gcc``
|
||||||
or any ``llvm`` installation.
|
or any ``llvm`` installation.
|
||||||
|
|
||||||
It is safe to combine ``exclude`` and ``autoload``
|
|
||||||
:ref:`mentioned above <autoloading-dependencies>`. When ``exclude`` prevents a module file to be
|
|
||||||
generated for a dependency, the ``autoload`` feature will simply not generate a statement to load
|
|
||||||
it.
|
|
||||||
|
|
||||||
|
|
||||||
.. _modules-projections:
|
.. _modules-projections:
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
"""""""""""""""""""""""""""""""
|
||||||
Customize the naming of modules
|
Customize the naming of modules
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
"""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
The names of environment modules generated by Spack are not always easy to
|
The names of environment modules generated by spack are not always easy to
|
||||||
fully comprehend due to the long hash in the name. There are three module
|
fully comprehend due to the long hash in the name. There are three module
|
||||||
configuration options to help with that. The first is a global setting to
|
configuration options to help with that. The first is a global setting to
|
||||||
adjust the hash length. It can be set anywhere from 0 to 32 and has a default
|
adjust the hash length. It can be set anywhere from 0 to 32 and has a default
|
||||||
@@ -438,13 +353,6 @@ shows how to set hash length in the module file names:
|
|||||||
tcl:
|
tcl:
|
||||||
hash_length: 7
|
hash_length: 7
|
||||||
|
|
||||||
.. tip::
|
|
||||||
|
|
||||||
Using ``hide_implicits: true`` (see :ref:`autoloading-dependencies`) vastly reduces the number
|
|
||||||
modules exposed to the user. The hidden modules always contain the hash in their name, and are
|
|
||||||
not influenced by the ``hash_length`` setting. Hidden implicits thus make it easier to use a
|
|
||||||
short hash length or no hash at all, without risking name conflicts.
|
|
||||||
|
|
||||||
To help make module names more readable, and to help alleviate name conflicts
|
To help make module names more readable, and to help alleviate name conflicts
|
||||||
with a short hash, one can use the ``suffixes`` option in the modules
|
with a short hash, one can use the ``suffixes`` option in the modules
|
||||||
configuration file. This option will add strings to modules that match a spec.
|
configuration file. This option will add strings to modules that match a spec.
|
||||||
@@ -457,12 +365,12 @@ For instance, the following config options,
|
|||||||
tcl:
|
tcl:
|
||||||
all:
|
all:
|
||||||
suffixes:
|
suffixes:
|
||||||
^python@3.12: 'python-3.12'
|
^python@2.7.12: 'python-2.7.12'
|
||||||
^openblas: 'openblas'
|
^openblas: 'openblas'
|
||||||
|
|
||||||
will add a ``python-3.12`` version string to any packages compiled with
|
will add a ``python-2.7.12`` version string to any packages compiled with
|
||||||
Python matching the spec, ``python@3.12``. This is useful to know which
|
python matching the spec, ``python@2.7.12``. This is useful to know which
|
||||||
version of Python a set of Python extensions is associated with. Likewise, the
|
version of python a set of python extensions is associated with. Likewise, the
|
||||||
``openblas`` string is attached to any program that has openblas in the spec,
|
``openblas`` string is attached to any program that has openblas in the spec,
|
||||||
most likely via the ``+blas`` variant specification.
|
most likely via the ``+blas`` variant specification.
|
||||||
|
|
||||||
@@ -560,11 +468,41 @@ that are already in the Lmod hierarchy.
|
|||||||
For hierarchies that are deeper than three layers ``lmod spider`` may have some issues.
|
For hierarchies that are deeper than three layers ``lmod spider`` may have some issues.
|
||||||
See `this discussion on the Lmod project <https://github.com/TACC/Lmod/issues/114>`_.
|
See `this discussion on the Lmod project <https://github.com/TACC/Lmod/issues/114>`_.
|
||||||
|
|
||||||
|
""""""""""""""""""""""
|
||||||
|
Select default modules
|
||||||
|
""""""""""""""""""""""
|
||||||
|
|
||||||
|
By default, when multiple modules of the same name share a directory,
|
||||||
|
the highest version number will be the default module. This behavior
|
||||||
|
of the ``module`` command can be overridden with a symlink named
|
||||||
|
``default`` to the desired default module. If you wish to configure
|
||||||
|
default modules with Spack, add a ``defaults`` key to your modules
|
||||||
|
configuration:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
modules:
|
||||||
|
my-module-set:
|
||||||
|
tcl:
|
||||||
|
defaults:
|
||||||
|
- gcc@10.2.1
|
||||||
|
- hdf5@1.2.10+mpi+hl%gcc
|
||||||
|
|
||||||
|
These defaults may be arbitrarily specific. For any package that
|
||||||
|
satisfies a default, Spack will generate the module file in the
|
||||||
|
appropriate path, and will generate a default symlink to the module
|
||||||
|
file as well.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
If Spack is configured to generate multiple default packages in the
|
||||||
|
same directory, the last modulefile to be generated will be the
|
||||||
|
default module.
|
||||||
|
|
||||||
.. _customize-env-modifications:
|
.. _customize-env-modifications:
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
"""""""""""""""""""""""""""""""""""
|
||||||
Customize environment modifications
|
Customize environment modifications
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
"""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
You can control which prefixes in a Spack package are added to
|
You can control which prefixes in a Spack package are added to
|
||||||
environment variables with the ``prefix_inspections`` section; this
|
environment variables with the ``prefix_inspections`` section; this
|
||||||
@@ -662,9 +600,9 @@ stack to users who are likely to inspect the modules to find full
|
|||||||
paths to software, when it is desirable to present the users with a
|
paths to software, when it is desirable to present the users with a
|
||||||
simpler set of paths than those generated by the Spack install tree.
|
simpler set of paths than those generated by the Spack install tree.
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
""""""""""""""""""""""""""""""""""""
|
||||||
Filter out environment modifications
|
Filter out environment modifications
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
Modifications to certain environment variables in module files are there by
|
Modifications to certain environment variables in module files are there by
|
||||||
default, for instance because they are generated by prefix inspections.
|
default, for instance because they are generated by prefix inspections.
|
||||||
@@ -684,37 +622,49 @@ do so by using the ``exclude_env_vars``:
|
|||||||
The configuration above will generate module files that will not contain
|
The configuration above will generate module files that will not contain
|
||||||
modifications to either ``CPATH`` or ``LIBRARY_PATH``.
|
modifications to either ``CPATH`` or ``LIBRARY_PATH``.
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
Select default modules
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
By default, when multiple modules of the same name share a directory,
|
.. _autoloading-dependencies:
|
||||||
the highest version number will be the default module. This behavior
|
|
||||||
of the ``module`` command can be overridden with a symlink named
|
"""""""""""""""""""""
|
||||||
``default`` to the desired default module. If you wish to configure
|
Autoload dependencies
|
||||||
default modules with Spack, add a ``defaults`` key to your modules
|
"""""""""""""""""""""
|
||||||
configuration:
|
|
||||||
|
Often it is required for a module to have its (transient) dependencies loaded as well.
|
||||||
|
One example where this is useful is when one package needs to use executables provided
|
||||||
|
by its dependency; when the dependency is autoloaded, the executable will be in the
|
||||||
|
PATH. Similarly for scripting languages such as Python, packages and their dependencies
|
||||||
|
have to be loaded together.
|
||||||
|
|
||||||
|
Autoloading is enabled by default for Lmod and Environment Modules. The former
|
||||||
|
has builtin support for through the ``depends_on`` function. The latter uses
|
||||||
|
``module load`` statement to load and track dependencies.
|
||||||
|
|
||||||
|
Autoloading can also be enabled conditionally:
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
modules:
|
modules:
|
||||||
my-module-set:
|
default:
|
||||||
tcl:
|
tcl:
|
||||||
defaults:
|
all:
|
||||||
- gcc@10.2.1
|
autoload: none
|
||||||
- hdf5@1.2.10+mpi+hl%gcc
|
^python:
|
||||||
|
autoload: direct
|
||||||
|
|
||||||
These defaults may be arbitrarily specific. For any package that
|
The configuration file above will produce module files that will
|
||||||
satisfies a default, Spack will generate the module file in the
|
load their direct dependencies if the package installed depends on ``python``.
|
||||||
appropriate path, and will generate a default symlink to the module
|
The allowed values for the ``autoload`` statement are either ``none``,
|
||||||
file as well.
|
``direct`` or ``all``.
|
||||||
|
|
||||||
.. warning::
|
.. note::
|
||||||
If Spack is configured to generate multiple default packages in the
|
Tcl prerequisites
|
||||||
same directory, the last modulefile to be generated will be the
|
In the ``tcl`` section of the configuration file it is possible to use
|
||||||
default module.
|
the ``prerequisites`` directive that accepts the same values as
|
||||||
|
``autoload``. It will produce module files that have a ``prereq``
|
||||||
.. _maintaining-module-files:
|
statement, which autoloads dependencies on Environment Modules when its
|
||||||
|
``auto_handling`` configuration option is enabled. If Environment Modules
|
||||||
|
is installed with Spack, ``auto_handling`` is enabled by default starting
|
||||||
|
version 4.2. Otherwise it is enabled by default since version 5.0.
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
Maintaining Module Files
|
Maintaining Module Files
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -97,35 +97,6 @@ Each package version and compiler listed in an external should
|
|||||||
have entries in Spack's packages and compiler configuration, even
|
have entries in Spack's packages and compiler configuration, even
|
||||||
though the package and compiler may not ever be built.
|
though the package and compiler may not ever be built.
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
Extra attributes for external packages
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Sometimes external packages require additional attributes to be used
|
|
||||||
effectively. This information can be defined on a per-package basis
|
|
||||||
and stored in the ``extra_attributes`` section of the external package
|
|
||||||
configuration. In addition to per-package information, this section
|
|
||||||
can be used to define environment modifications to be performed
|
|
||||||
whenever the package is used. For example, if an external package is
|
|
||||||
built without ``rpath`` support, it may require ``LD_LIBRARY_PATH``
|
|
||||||
settings to find its dependencies. This could be configured as
|
|
||||||
follows:
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
packages:
|
|
||||||
mpich:
|
|
||||||
externals:
|
|
||||||
- spec: mpich@3.3 %clang@12.0.0 +hwloc
|
|
||||||
prefix: /path/to/mpich
|
|
||||||
extra_attributes:
|
|
||||||
environment:
|
|
||||||
prepend_path:
|
|
||||||
LD_LIBRARY_PATH: /path/to/hwloc/lib64
|
|
||||||
|
|
||||||
See :ref:`configuration_environment_variables` for more information on
|
|
||||||
how to configure environment modifications in Spack config files.
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
Prevent packages from being built from sources
|
Prevent packages from being built from sources
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@@ -487,56 +458,6 @@ present. For instance with a configuration like:
|
|||||||
|
|
||||||
you will use ``mvapich2~cuda %gcc`` as an ``mpi`` provider.
|
you will use ``mvapich2~cuda %gcc`` as an ``mpi`` provider.
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
Conflicts and strong preferences
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
If the semantic of requirements is too strong, you can also express "strong preferences" and "conflicts"
|
|
||||||
from configuration files:
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
packages:
|
|
||||||
all:
|
|
||||||
prefer:
|
|
||||||
- '%clang'
|
|
||||||
conflict:
|
|
||||||
- '+shared'
|
|
||||||
|
|
||||||
The ``prefer`` and ``conflict`` sections can be used whenever a ``require`` section is allowed.
|
|
||||||
The argument is always a list of constraints, and each constraint can be either a simple string,
|
|
||||||
or a more complex object:
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
packages:
|
|
||||||
all:
|
|
||||||
conflict:
|
|
||||||
- spec: '%clang'
|
|
||||||
when: 'target=x86_64_v3'
|
|
||||||
message: 'reason why clang cannot be used'
|
|
||||||
|
|
||||||
The ``spec`` attribute is mandatory, while both ``when`` and ``message`` are optional.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Requirements allow for expressing both "strong preferences" and "conflicts".
|
|
||||||
The syntax for doing so, though, may not be immediately clear. For
|
|
||||||
instance, if we want to prevent any package from using ``%clang``, we can set:
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
packages:
|
|
||||||
all:
|
|
||||||
require:
|
|
||||||
- one_of: ['%clang', '@:']
|
|
||||||
|
|
||||||
Since only one of the requirements must hold, and ``@:`` is always true, the rule above is
|
|
||||||
equivalent to a conflict. For "strong preferences" we need to substitute the ``one_of`` policy
|
|
||||||
with ``any_of``.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.. _package-preferences:
|
.. _package-preferences:
|
||||||
|
|
||||||
-------------------
|
-------------------
|
||||||
@@ -647,8 +568,6 @@ manually placed files within the install prefix are owned by the
|
|||||||
assigned group. If no group is assigned, Spack will allow the OS
|
assigned group. If no group is assigned, Spack will allow the OS
|
||||||
default behavior to go as expected.
|
default behavior to go as expected.
|
||||||
|
|
||||||
.. _assigning-package-attributes:
|
|
||||||
|
|
||||||
----------------------------
|
----------------------------
|
||||||
Assigning Package Attributes
|
Assigning Package Attributes
|
||||||
----------------------------
|
----------------------------
|
||||||
@@ -659,11 +578,10 @@ You can assign class-level attributes in the configuration:
|
|||||||
|
|
||||||
packages:
|
packages:
|
||||||
mpileaks:
|
mpileaks:
|
||||||
package_attributes:
|
# Override existing attributes
|
||||||
# Override existing attributes
|
url: http://www.somewhereelse.com/mpileaks-1.0.tar.gz
|
||||||
url: http://www.somewhereelse.com/mpileaks-1.0.tar.gz
|
# ... or add new ones
|
||||||
# ... or add new ones
|
x: 1
|
||||||
x: 1
|
|
||||||
|
|
||||||
Attributes set this way will be accessible to any method executed
|
Attributes set this way will be accessible to any method executed
|
||||||
in the package.py file (e.g. the ``install()`` method). Values for these
|
in the package.py file (e.g. the ``install()`` method). Values for these
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -237,7 +237,7 @@ for details):
|
|||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -893,50 +893,26 @@ as an option to the ``version()`` directive. Example situations would be a
|
|||||||
"snapshot"-like Version Control System (VCS) tag, a VCS branch such as
|
"snapshot"-like Version Control System (VCS) tag, a VCS branch such as
|
||||||
``v6-16-00-patches``, or a URL specifying a regularly updated snapshot tarball.
|
``v6-16-00-patches``, or a URL specifying a regularly updated snapshot tarball.
|
||||||
|
|
||||||
|
|
||||||
.. _version-comparison:
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^
|
||||||
Version comparison
|
Version comparison
|
||||||
^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Spack imposes a generic total ordering on the set of versions,
|
|
||||||
independently from the package they are associated with.
|
|
||||||
|
|
||||||
Most Spack versions are numeric, a tuple of integers; for example,
|
Most Spack versions are numeric, a tuple of integers; for example,
|
||||||
``0.1``, ``6.96`` or ``1.2.3.1``. In this very basic case, version
|
``0.1``, ``6.96`` or ``1.2.3.1``. Spack knows how to compare and sort
|
||||||
comparison is lexicographical on the numeric components:
|
numeric versions.
|
||||||
``1.2 < 1.2.1 < 1.2.2 < 1.10``.
|
|
||||||
|
|
||||||
Spack can also supports string components such as ``1.1.1a`` and
|
Some Spack versions involve slight extensions of numeric syntax; for
|
||||||
``1.y.0``. String components are considered less than numeric
|
example, ``py-sphinx-rtd-theme@=0.1.10a0``. In this case, numbers are
|
||||||
components, so ``1.y.0 < 1.0``. This is for consistency with
|
always considered to be "newer" than letters. This is for consistency
|
||||||
`RPM <https://bugzilla.redhat.com/show_bug.cgi?id=50977>`_. String
|
with `RPM <https://bugzilla.redhat.com/show_bug.cgi?id=50977>`_.
|
||||||
components do not have to be separated by dots or any other delimiter.
|
|
||||||
So, the contrived version ``1y0`` is identical to ``1.y.0``.
|
|
||||||
|
|
||||||
Pre-release suffixes also contain string parts, but they are handled
|
Spack versions may also be arbitrary non-numeric strings, for example
|
||||||
in a special way. For example ``1.2.3alpha1`` is parsed as a pre-release
|
``develop``, ``master``, ``local``.
|
||||||
of the version ``1.2.3``. This allows Spack to order it before the
|
|
||||||
actual release: ``1.2.3alpha1 < 1.2.3``. Spack supports alpha, beta and
|
|
||||||
release candidate suffixes: ``1.2alpha1 < 1.2beta1 < 1.2rc1 < 1.2``. Any
|
|
||||||
suffix not recognized as a pre-release is treated as an ordinary
|
|
||||||
string component, so ``1.2 < 1.2-mysuffix``.
|
|
||||||
|
|
||||||
Finally, there are a few special string components that are considered
|
The order on versions is defined as follows. A version string is split
|
||||||
"infinity versions". They include ``develop``, ``main``, ``master``,
|
into a list of components based on delimiters such as ``.``, ``-`` etc.
|
||||||
``head``, ``trunk``, and ``stable``. For example: ``1.2 < develop``.
|
Lists are then ordered lexicographically, where components are ordered
|
||||||
These are useful for specifying the most recent development version of
|
as follows:
|
||||||
a package (often a moving target like a git branch), without assigning
|
|
||||||
a specific version number. Infinity versions are not automatically used when determining the latest version of a package unless explicitly required by another package or user.
|
|
||||||
|
|
||||||
More formally, the order on versions is defined as follows. A version
|
|
||||||
string is split into a list of components based on delimiters such as
|
|
||||||
``.`` and ``-`` and string boundaries. The components are split into
|
|
||||||
the **release** and a possible **pre-release** (if the last component
|
|
||||||
is numeric and the second to last is a string ``alpha``, ``beta`` or ``rc``).
|
|
||||||
The release components are ordered lexicographically, with comparsion
|
|
||||||
between different types of components as follows:
|
|
||||||
|
|
||||||
#. The following special strings are considered larger than any other
|
#. The following special strings are considered larger than any other
|
||||||
numeric or non-numeric version component, and satisfy the following
|
numeric or non-numeric version component, and satisfy the following
|
||||||
@@ -949,9 +925,6 @@ between different types of components as follows:
|
|||||||
#. All other non-numeric components are less than numeric components,
|
#. All other non-numeric components are less than numeric components,
|
||||||
and are ordered alphabetically.
|
and are ordered alphabetically.
|
||||||
|
|
||||||
Finally, if the release components are equal, the pre-release components
|
|
||||||
are used to break the tie, in the obvious way.
|
|
||||||
|
|
||||||
The logic behind this sort order is two-fold:
|
The logic behind this sort order is two-fold:
|
||||||
|
|
||||||
#. Non-numeric versions are usually used for special cases while
|
#. Non-numeric versions are usually used for special cases while
|
||||||
@@ -2442,14 +2415,15 @@ with. For example, suppose that in the ``libdwarf`` package you write:
|
|||||||
|
|
||||||
depends_on("libelf@0.8")
|
depends_on("libelf@0.8")
|
||||||
|
|
||||||
Now ``libdwarf`` will require ``libelf`` in the range ``0.8``, which
|
Now ``libdwarf`` will require ``libelf`` at *exactly* version ``0.8``.
|
||||||
includes patch versions ``0.8.1``, ``0.8.2``, etc. Apart from version
|
You can also specify a requirement for a particular variant or for
|
||||||
restrictions, you can also specify variants if this package requires
|
specific compiler flags:
|
||||||
optional features of the dependency.
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
depends_on("libelf@0.8 +parser +pic")
|
depends_on("libelf@0.8+debug")
|
||||||
|
depends_on("libelf debug=True")
|
||||||
|
depends_on("libelf cppflags='-fPIC'")
|
||||||
|
|
||||||
Both users *and* package authors can use the same spec syntax to refer
|
Both users *and* package authors can use the same spec syntax to refer
|
||||||
to different package configurations. Users use the spec syntax on the
|
to different package configurations. Users use the spec syntax on the
|
||||||
@@ -2457,82 +2431,46 @@ command line to find installed packages or to install packages with
|
|||||||
particular constraints, and package authors can use specs to describe
|
particular constraints, and package authors can use specs to describe
|
||||||
relationships between packages.
|
relationships between packages.
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
Specifying backward and forward compatibility
|
Version ranges
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Packages are often compatible with a range of versions of their
|
Although some packages require a specific version for their dependencies,
|
||||||
dependencies. This is typically referred to as backward and forward
|
most can be built with a range of versions. For example, if you are
|
||||||
compatibility. Spack allows you to specify this in the ``depends_on``
|
writing a package for a legacy Python module that only works with Python
|
||||||
directive using version ranges.
|
2.4 through 2.6, this would look like:
|
||||||
|
|
||||||
**Backwards compatibility** means that the package requires at least a
|
|
||||||
certain version of its dependency:
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
depends_on("python@3.10:")
|
depends_on("python@2.4:2.6")
|
||||||
|
|
||||||
In this case, the package requires Python 3.10 or newer.
|
Version ranges in Spack are *inclusive*, so ``2.4:2.6`` means any version
|
||||||
|
greater than or equal to ``2.4`` and up to and including any ``2.6.x``. If
|
||||||
Commonly, packages drop support for older versions of a dependency as
|
you want to specify that a package works with any version of Python 3 (or
|
||||||
they release new versions. In Spack you can conveniently add every
|
higher), this would look like:
|
||||||
backward compatibility rule as a separate line:
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
# backward compatibility with Python
|
depends_on("python@3:")
|
||||||
depends_on("python@3.8:")
|
|
||||||
depends_on("python@3.9:", when="@1.2:")
|
|
||||||
depends_on("python@3.10:", when="@1.4:")
|
|
||||||
|
|
||||||
This means that in general we need Python 3.8 or newer; from version
|
Here we leave out the upper bound. If you want to say that a package
|
||||||
1.2 onwards we need Python 3.9 or newer; from version 1.4 onwards we
|
requires Python 2, you can similarly leave out the lower bound:
|
||||||
need Python 3.10 or newer. Notice that it's fine to have overlapping
|
|
||||||
ranges in the ``when`` clauses.
|
|
||||||
|
|
||||||
**Forward compatibility** means that the package requires at most a
|
|
||||||
certain version of its dependency. Forward compatibility rules are
|
|
||||||
necessary when there are breaking changes in the dependency that the
|
|
||||||
package cannot handle. In Spack we often add forward compatibility
|
|
||||||
bounds only at the time a new, breaking version of a dependency is
|
|
||||||
released. As with backward compatibility, it is typical to see a list
|
|
||||||
of forward compatibility bounds in a package file as seperate lines:
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
# forward compatibility with Python
|
depends_on("python@:2")
|
||||||
depends_on("python@:3.12", when="@:1.10")
|
|
||||||
depends_on("python@:3.13", when="@:1.12")
|
|
||||||
|
|
||||||
Notice how the ``:`` now appears before the version number both in the
|
Notice that we didn't use ``@:3``. Version ranges are *inclusive*, so
|
||||||
dependency and in the ``when`` clause. This tells Spack that in general
|
``@:3`` means "up to and including any 3.x version".
|
||||||
we need Python 3.13 or older up to version ``1.12.x``, and up to version
|
|
||||||
``1.10.x`` we need Python 3.12 or older. Said differently, forward compatibility
|
|
||||||
with Python 3.13 was added in version 1.11, while version 1.13 added forward
|
|
||||||
compatibility with Python 3.14.
|
|
||||||
|
|
||||||
Notice that a version range ``@:3.12`` includes *any* patch version
|
You can also simply write
|
||||||
number ``3.12.x``, which is often useful when specifying forward compatibility
|
|
||||||
bounds.
|
|
||||||
|
|
||||||
So far we have seen open-ended version ranges, which is by far the most
|
|
||||||
common use case. It is also possible to specify both a lower and an upper bound
|
|
||||||
on the version of a dependency, like this:
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
depends_on("python@3.10:3.12")
|
depends_on("python@2.7")
|
||||||
|
|
||||||
There is short syntax to specify that a package is compatible with say any
|
to tell Spack that the package needs Python 2.7.x. This is equivalent to
|
||||||
``3.x`` version:
|
``@2.7:2.7``.
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
depends_on("python@3")
|
|
||||||
|
|
||||||
The above is equivalent to ``depends_on("python@3:3")``, which means at least
|
|
||||||
Python version 3 and at most any version ``3.x.y``.
|
|
||||||
|
|
||||||
In very rare cases, you may need to specify an exact version, for example
|
In very rare cases, you may need to specify an exact version, for example
|
||||||
if you need to distinguish between ``3.2`` and ``3.2.1``:
|
if you need to distinguish between ``3.2`` and ``3.2.1``:
|
||||||
@@ -4441,16 +4379,10 @@ implementation was selected for this build:
|
|||||||
elif "mvapich" in spec:
|
elif "mvapich" in spec:
|
||||||
configure_args.append("--with-mvapich")
|
configure_args.append("--with-mvapich")
|
||||||
|
|
||||||
It's also a bit more concise than satisfies.
|
It's also a bit more concise than satisfies. The difference between
|
||||||
|
the two functions is that ``satisfies()`` tests whether spec
|
||||||
.. note::
|
constraints overlap at all, while ``in`` tests whether a spec or any
|
||||||
|
of its dependencies satisfy the provided spec.
|
||||||
The ``satisfies()`` method tests whether this spec has, at least, all the constraints of the argument spec,
|
|
||||||
while ``in`` tests whether a spec or any of its dependencies satisfy the provided spec.
|
|
||||||
|
|
||||||
If the provided spec is anonymous (e.g., ":1.2:", "+shared") or has the
|
|
||||||
same name as the spec being checked, then ``in`` works the same as
|
|
||||||
``satisfies()``; however, use of ``satisfies()`` is more intuitive.
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
Architecture specifiers
|
Architecture specifiers
|
||||||
@@ -5352,7 +5284,7 @@ installed example.
|
|||||||
example = which(self.prefix.bin.example)
|
example = which(self.prefix.bin.example)
|
||||||
example()
|
example()
|
||||||
|
|
||||||
Output showing the identification of each test part after running the tests
|
Output showing the identification of each test part after runnig the tests
|
||||||
is illustrated below.
|
is illustrated below.
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
@@ -5849,7 +5781,7 @@ with those implemented in the package itself.
|
|||||||
* - `Cxx
|
* - `Cxx
|
||||||
<https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/cxx>`_
|
<https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/cxx>`_
|
||||||
- Compiles and runs several ``hello`` programs
|
- Compiles and runs several ``hello`` programs
|
||||||
* - `Fortran
|
* - `Fortan
|
||||||
<https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/fortran>`_
|
<https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/fortran>`_
|
||||||
- Compiles and runs ``hello`` programs (``F`` and ``f90``)
|
- Compiles and runs ``hello`` programs (``F`` and ``f90``)
|
||||||
* - `Mpi
|
* - `Mpi
|
||||||
@@ -6470,12 +6402,9 @@ the ``paths`` attribute:
|
|||||||
echo "Target: x86_64-pc-linux-gnu"
|
echo "Target: x86_64-pc-linux-gnu"
|
||||||
echo "Thread model: posix"
|
echo "Thread model: posix"
|
||||||
echo "InstalledDir: /usr/bin"
|
echo "InstalledDir: /usr/bin"
|
||||||
platforms: ["linux", "darwin"]
|
|
||||||
results:
|
results:
|
||||||
- spec: 'llvm@3.9.1 +clang~lld~lldb'
|
- spec: 'llvm@3.9.1 +clang~lld~lldb'
|
||||||
|
|
||||||
If the ``platforms`` attribute is present, tests are run only if the current host
|
|
||||||
matches one of the listed platforms.
|
|
||||||
Each test is performed by first creating a temporary directory structure as
|
Each test is performed by first creating a temporary directory structure as
|
||||||
specified in the corresponding ``layout`` and by then running
|
specified in the corresponding ``layout`` and by then running
|
||||||
package detection and checking that the outcome matches the expected
|
package detection and checking that the outcome matches the expected
|
||||||
@@ -6509,10 +6438,6 @@ package detection and checking that the outcome matches the expected
|
|||||||
- A spec that is expected from detection
|
- A spec that is expected from detection
|
||||||
- Any valid spec
|
- Any valid spec
|
||||||
- Yes
|
- Yes
|
||||||
* - ``results:[0]:extra_attributes``
|
|
||||||
- Extra attributes expected on the associated Spec
|
|
||||||
- Nested dictionary with string as keys, and regular expressions as leaf values
|
|
||||||
- No
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""
|
||||||
Reuse tests from other packages
|
Reuse tests from other packages
|
||||||
@@ -7048,18 +6973,3 @@ you probably care most about are:
|
|||||||
You may also care about `license exceptions
|
You may also care about `license exceptions
|
||||||
<https://spdx.org/licenses/exceptions-index.html>`_ that use the ``WITH`` operator,
|
<https://spdx.org/licenses/exceptions-index.html>`_ that use the ``WITH`` operator,
|
||||||
e.g. ``Apache-2.0 WITH LLVM-exception``.
|
e.g. ``Apache-2.0 WITH LLVM-exception``.
|
||||||
|
|
||||||
Many of the licenses that are currently in the spack repositories have been
|
|
||||||
automatically determined. While this is great for bulk adding license
|
|
||||||
information and is most likely correct, there are sometimes edge cases that
|
|
||||||
require manual intervention. To determine which licenses are validated and
|
|
||||||
which are not, there is the `checked_by` parameter in the license directive:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
license("<license>", when="<when>", checked_by="<github username>")
|
|
||||||
|
|
||||||
When you have validated a github license, either when doing so explicitly or
|
|
||||||
as part of packaging a new package, please set the `checked_by` parameter
|
|
||||||
to your Github username to signal that the license has been manually
|
|
||||||
verified.
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -810,7 +810,7 @@ generated by ``spack ci generate``. You also want your generated rebuild jobs
|
|||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
spack:
|
spack:
|
||||||
# ...
|
...
|
||||||
ci:
|
ci:
|
||||||
pipeline-gen:
|
pipeline-gen:
|
||||||
- build-job:
|
- build-job:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -17,7 +17,7 @@ experimental software separately from the built-in repository. Spack
|
|||||||
allows you to configure local repositories using either the
|
allows you to configure local repositories using either the
|
||||||
``repos.yaml`` or the ``spack repo`` command.
|
``repos.yaml`` or the ``spack repo`` command.
|
||||||
|
|
||||||
A package repository is a directory structured like this::
|
A package repository a directory structured like this::
|
||||||
|
|
||||||
repo/
|
repo/
|
||||||
repo.yaml
|
repo.yaml
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ sphinx==7.2.6
|
|||||||
sphinxcontrib-programoutput==0.17
|
sphinxcontrib-programoutput==0.17
|
||||||
sphinx_design==0.5.0
|
sphinx_design==0.5.0
|
||||||
sphinx-rtd-theme==2.0.0
|
sphinx-rtd-theme==2.0.0
|
||||||
python-levenshtein==0.25.1
|
python-levenshtein==0.23.0
|
||||||
docutils==0.20.1
|
docutils==0.20.1
|
||||||
pygments==2.17.2
|
pygments==2.17.2
|
||||||
urllib3==2.2.1
|
urllib3==2.1.0
|
||||||
pytest==8.2.0
|
pytest==7.4.3
|
||||||
isort==5.13.2
|
isort==5.12.0
|
||||||
black==24.4.2
|
black==23.11.0
|
||||||
flake8==7.0.0
|
flake8==6.1.0
|
||||||
mypy==1.10.0
|
mypy==1.7.1
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.. Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
|
||||||
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
|
||||||
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -142,7 +142,7 @@ Reputational Key
|
|||||||
----------------
|
----------------
|
||||||
|
|
||||||
The Reputational Key is the public facing key used to sign complete groups of
|
The Reputational Key is the public facing key used to sign complete groups of
|
||||||
development and release packages. Only one key pair exists in this class of
|
development and release packages. Only one key pair exsits in this class of
|
||||||
keys. In contrast to the Intermediate CI Key the Reputational Key *should* be
|
keys. In contrast to the Intermediate CI Key the Reputational Key *should* be
|
||||||
used to verify package integrity. At the end of develop and release pipeline a
|
used to verify package integrity. At the end of develop and release pipeline a
|
||||||
final pipeline job pulls down all signed package metadata built by the pipeline,
|
final pipeline job pulls down all signed package metadata built by the pipeline,
|
||||||
@@ -272,7 +272,7 @@ Internal Implementation
|
|||||||
|
|
||||||
The technical implementation of the pipeline signing process includes components
|
The technical implementation of the pipeline signing process includes components
|
||||||
defined in Amazon Web Services, the Kubernetes cluster, at affilicated
|
defined in Amazon Web Services, the Kubernetes cluster, at affilicated
|
||||||
institutions, and the GitLab/GitLab Runner deployment. We present the technical
|
institutions, and the GitLab/GitLab Runner deployment. We present the techincal
|
||||||
implementation in two interdependent sections. The first addresses how secrets
|
implementation in two interdependent sections. The first addresses how secrets
|
||||||
are managed through the lifecycle of a develop or release pipeline. The second
|
are managed through the lifecycle of a develop or release pipeline. The second
|
||||||
section describes how Gitlab Runner and pipelines are configured and managed to
|
section describes how Gitlab Runner and pipelines are configured and managed to
|
||||||
@@ -295,7 +295,7 @@ infrastructure.
|
|||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Multiple intermediate CI signing keys exist, one Intermediate CI Key for jobs
|
Multiple intermediate CI signing keys exist, one Intermediate CI Key for jobs
|
||||||
run in AWS, and one key for each affiliated institution (e.g. University of
|
run in AWS, and one key for each affiliated institution (e.g. Univerity of
|
||||||
Oregon). Here we describe how the Intermediate CI Key is managed in AWS:
|
Oregon). Here we describe how the Intermediate CI Key is managed in AWS:
|
||||||
|
|
||||||
The Intermediate CI Key (including the Signing Intermediate CI Private Key is
|
The Intermediate CI Key (including the Signing Intermediate CI Private Key is
|
||||||
@@ -305,7 +305,7 @@ contains an ASCII-armored export of just the *public* components of the
|
|||||||
Reputational Key. This secret also contains the *public* components of each of
|
Reputational Key. This secret also contains the *public* components of each of
|
||||||
the affiliated institutions' Intermediate CI Key. These are potentially needed
|
the affiliated institutions' Intermediate CI Key. These are potentially needed
|
||||||
to verify dependent packages which may have been found in the public mirror or
|
to verify dependent packages which may have been found in the public mirror or
|
||||||
built by a protected job running on an affiliated institution's infrastructure
|
built by a protected job running on an affiliated institution's infrastrcuture
|
||||||
in an earlier stage of the pipeline.
|
in an earlier stage of the pipeline.
|
||||||
|
|
||||||
Procedurally the ``spack-intermediate-ci-signing-key`` secret is used in
|
Procedurally the ``spack-intermediate-ci-signing-key`` secret is used in
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|||||||
257
lib/spack/env/cc
vendored
257
lib/spack/env/cc
vendored
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh -f
|
#!/bin/sh -f
|
||||||
# shellcheck disable=SC2034 # evals in this script fool shellcheck
|
# shellcheck disable=SC2034 # evals in this script fool shellcheck
|
||||||
#
|
#
|
||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -47,8 +47,7 @@ SPACK_F77_RPATH_ARG
|
|||||||
SPACK_FC_RPATH_ARG
|
SPACK_FC_RPATH_ARG
|
||||||
SPACK_LINKER_ARG
|
SPACK_LINKER_ARG
|
||||||
SPACK_SHORT_SPEC
|
SPACK_SHORT_SPEC
|
||||||
SPACK_SYSTEM_DIRS
|
SPACK_SYSTEM_DIRS"
|
||||||
SPACK_MANAGED_DIRS"
|
|
||||||
|
|
||||||
# Optional parameters that aren't required to be set
|
# Optional parameters that aren't required to be set
|
||||||
|
|
||||||
@@ -174,6 +173,22 @@ preextend() {
|
|||||||
unset IFS
|
unset IFS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# system_dir PATH
|
||||||
|
# test whether a path is a system directory
|
||||||
|
system_dir() {
|
||||||
|
IFS=':' # SPACK_SYSTEM_DIRS is colon-separated
|
||||||
|
path="$1"
|
||||||
|
for sd in $SPACK_SYSTEM_DIRS; do
|
||||||
|
if [ "${path}" = "${sd}" ] || [ "${path}" = "${sd}/" ]; then
|
||||||
|
# success if path starts with a system prefix
|
||||||
|
unset IFS
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset IFS
|
||||||
|
return 1 # fail if path starts no system prefix
|
||||||
|
}
|
||||||
|
|
||||||
# Fail with a clear message if the input contains any bell characters.
|
# Fail with a clear message if the input contains any bell characters.
|
||||||
if eval "[ \"\${*#*${lsep}}\" != \"\$*\" ]"; then
|
if eval "[ \"\${*#*${lsep}}\" != \"\$*\" ]"; then
|
||||||
die "Compiler command line contains our separator ('${lsep}'). Cannot parse."
|
die "Compiler command line contains our separator ('${lsep}'). Cannot parse."
|
||||||
@@ -186,18 +201,6 @@ for param in $params; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# eval this because SPACK_MANAGED_DIRS and SPACK_SYSTEM_DIRS are inputs we don't wanna loop over.
|
|
||||||
# moving the eval inside the function would eval it every call.
|
|
||||||
eval "\
|
|
||||||
path_order() {
|
|
||||||
case \"\$1\" in
|
|
||||||
$SPACK_MANAGED_DIRS) return 0 ;;
|
|
||||||
$SPACK_SYSTEM_DIRS) return 2 ;;
|
|
||||||
/*) return 1 ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
"
|
|
||||||
|
|
||||||
# Check if optional parameters are defined
|
# Check if optional parameters are defined
|
||||||
# If we aren't asking for debug flags, don't add them
|
# If we aren't asking for debug flags, don't add them
|
||||||
if [ -z "${SPACK_ADD_DEBUG_FLAGS:-}" ]; then
|
if [ -z "${SPACK_ADD_DEBUG_FLAGS:-}" ]; then
|
||||||
@@ -245,7 +248,7 @@ case "$command" in
|
|||||||
lang_flags=C
|
lang_flags=C
|
||||||
debug_flags="-g"
|
debug_flags="-g"
|
||||||
;;
|
;;
|
||||||
c++|CC|g++|clang++|armclang++|icpc|icpx|pgc++|nvc++|xlc++|xlc++_r|FCC|amdclang++|crayCC)
|
c++|CC|g++|clang++|armclang++|icpc|icpx|dpcpp|pgc++|nvc++|xlc++|xlc++_r|FCC|amdclang++|crayCC)
|
||||||
command="$SPACK_CXX"
|
command="$SPACK_CXX"
|
||||||
language="C++"
|
language="C++"
|
||||||
comp="CXX"
|
comp="CXX"
|
||||||
@@ -417,12 +420,11 @@ input_command="$*"
|
|||||||
parse_Wl() {
|
parse_Wl() {
|
||||||
while [ $# -ne 0 ]; do
|
while [ $# -ne 0 ]; do
|
||||||
if [ "$wl_expect_rpath" = yes ]; then
|
if [ "$wl_expect_rpath" = yes ]; then
|
||||||
path_order "$1"
|
if system_dir "$1"; then
|
||||||
case $? in
|
append return_system_rpath_dirs_list "$1"
|
||||||
0) append return_spack_store_rpath_dirs_list "$1" ;;
|
else
|
||||||
1) append return_rpath_dirs_list "$1" ;;
|
append return_rpath_dirs_list "$1"
|
||||||
2) append return_system_rpath_dirs_list "$1" ;;
|
fi
|
||||||
esac
|
|
||||||
wl_expect_rpath=no
|
wl_expect_rpath=no
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -430,25 +432,21 @@ parse_Wl() {
|
|||||||
arg="${1#-rpath=}"
|
arg="${1#-rpath=}"
|
||||||
if [ -z "$arg" ]; then
|
if [ -z "$arg" ]; then
|
||||||
shift; continue
|
shift; continue
|
||||||
|
elif system_dir "$arg"; then
|
||||||
|
append return_system_rpath_dirs_list "$arg"
|
||||||
|
else
|
||||||
|
append return_rpath_dirs_list "$arg"
|
||||||
fi
|
fi
|
||||||
path_order "$arg"
|
|
||||||
case $? in
|
|
||||||
0) append return_spack_store_rpath_dirs_list "$arg" ;;
|
|
||||||
1) append return_rpath_dirs_list "$arg" ;;
|
|
||||||
2) append return_system_rpath_dirs_list "$arg" ;;
|
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
--rpath=*)
|
--rpath=*)
|
||||||
arg="${1#--rpath=}"
|
arg="${1#--rpath=}"
|
||||||
if [ -z "$arg" ]; then
|
if [ -z "$arg" ]; then
|
||||||
shift; continue
|
shift; continue
|
||||||
|
elif system_dir "$arg"; then
|
||||||
|
append return_system_rpath_dirs_list "$arg"
|
||||||
|
else
|
||||||
|
append return_rpath_dirs_list "$arg"
|
||||||
fi
|
fi
|
||||||
path_order "$arg"
|
|
||||||
case $? in
|
|
||||||
0) append return_spack_store_rpath_dirs_list "$arg" ;;
|
|
||||||
1) append return_rpath_dirs_list "$arg" ;;
|
|
||||||
2) append return_system_rpath_dirs_list "$arg" ;;
|
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
-rpath|--rpath)
|
-rpath|--rpath)
|
||||||
wl_expect_rpath=yes
|
wl_expect_rpath=yes
|
||||||
@@ -475,20 +473,12 @@ categorize_arguments() {
|
|||||||
|
|
||||||
return_other_args_list=""
|
return_other_args_list=""
|
||||||
return_isystem_was_used=""
|
return_isystem_was_used=""
|
||||||
|
|
||||||
return_isystem_spack_store_include_dirs_list=""
|
|
||||||
return_isystem_system_include_dirs_list=""
|
return_isystem_system_include_dirs_list=""
|
||||||
return_isystem_include_dirs_list=""
|
return_isystem_include_dirs_list=""
|
||||||
|
|
||||||
return_spack_store_include_dirs_list=""
|
|
||||||
return_system_include_dirs_list=""
|
return_system_include_dirs_list=""
|
||||||
return_include_dirs_list=""
|
return_include_dirs_list=""
|
||||||
|
|
||||||
return_spack_store_lib_dirs_list=""
|
|
||||||
return_system_lib_dirs_list=""
|
return_system_lib_dirs_list=""
|
||||||
return_lib_dirs_list=""
|
return_lib_dirs_list=""
|
||||||
|
|
||||||
return_spack_store_rpath_dirs_list=""
|
|
||||||
return_system_rpath_dirs_list=""
|
return_system_rpath_dirs_list=""
|
||||||
return_rpath_dirs_list=""
|
return_rpath_dirs_list=""
|
||||||
|
|
||||||
@@ -536,7 +526,7 @@ categorize_arguments() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
replaced="$after$stripped"
|
replaced="$after$stripped"
|
||||||
|
|
||||||
# it matched, remove it
|
# it matched, remove it
|
||||||
shift
|
shift
|
||||||
@@ -556,32 +546,29 @@ categorize_arguments() {
|
|||||||
arg="${1#-isystem}"
|
arg="${1#-isystem}"
|
||||||
return_isystem_was_used=true
|
return_isystem_was_used=true
|
||||||
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
||||||
path_order "$arg"
|
if system_dir "$arg"; then
|
||||||
case $? in
|
append return_isystem_system_include_dirs_list "$arg"
|
||||||
0) append return_isystem_spack_store_include_dirs_list "$arg" ;;
|
else
|
||||||
1) append return_isystem_include_dirs_list "$arg" ;;
|
append return_isystem_include_dirs_list "$arg"
|
||||||
2) append return_isystem_system_include_dirs_list "$arg" ;;
|
fi
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
-I*)
|
-I*)
|
||||||
arg="${1#-I}"
|
arg="${1#-I}"
|
||||||
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
||||||
path_order "$arg"
|
if system_dir "$arg"; then
|
||||||
case $? in
|
append return_system_include_dirs_list "$arg"
|
||||||
0) append return_spack_store_include_dirs_list "$arg" ;;
|
else
|
||||||
1) append return_include_dirs_list "$arg" ;;
|
append return_include_dirs_list "$arg"
|
||||||
2) append return_system_include_dirs_list "$arg" ;;
|
fi
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
-L*)
|
-L*)
|
||||||
arg="${1#-L}"
|
arg="${1#-L}"
|
||||||
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
||||||
path_order "$arg"
|
if system_dir "$arg"; then
|
||||||
case $? in
|
append return_system_lib_dirs_list "$arg"
|
||||||
0) append return_spack_store_lib_dirs_list "$arg" ;;
|
else
|
||||||
1) append return_lib_dirs_list "$arg" ;;
|
append return_lib_dirs_list "$arg"
|
||||||
2) append return_system_lib_dirs_list "$arg" ;;
|
fi
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
-l*)
|
-l*)
|
||||||
# -loopopt=0 is generated erroneously in autoconf <= 2.69,
|
# -loopopt=0 is generated erroneously in autoconf <= 2.69,
|
||||||
@@ -614,32 +601,29 @@ categorize_arguments() {
|
|||||||
break
|
break
|
||||||
elif [ "$xlinker_expect_rpath" = yes ]; then
|
elif [ "$xlinker_expect_rpath" = yes ]; then
|
||||||
# Register the path of -Xlinker -rpath <other args> -Xlinker <path>
|
# Register the path of -Xlinker -rpath <other args> -Xlinker <path>
|
||||||
path_order "$1"
|
if system_dir "$1"; then
|
||||||
case $? in
|
append return_system_rpath_dirs_list "$1"
|
||||||
0) append return_spack_store_rpath_dirs_list "$1" ;;
|
else
|
||||||
1) append return_rpath_dirs_list "$1" ;;
|
append return_rpath_dirs_list "$1"
|
||||||
2) append return_system_rpath_dirs_list "$1" ;;
|
fi
|
||||||
esac
|
|
||||||
xlinker_expect_rpath=no
|
xlinker_expect_rpath=no
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-rpath=*)
|
-rpath=*)
|
||||||
arg="${1#-rpath=}"
|
arg="${1#-rpath=}"
|
||||||
path_order "$arg"
|
if system_dir "$arg"; then
|
||||||
case $? in
|
append return_system_rpath_dirs_list "$arg"
|
||||||
0) append return_spack_store_rpath_dirs_list "$arg" ;;
|
else
|
||||||
1) append return_rpath_dirs_list "$arg" ;;
|
append return_rpath_dirs_list "$arg"
|
||||||
2) append return_system_rpath_dirs_list "$arg" ;;
|
fi
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
--rpath=*)
|
--rpath=*)
|
||||||
arg="${1#--rpath=}"
|
arg="${1#--rpath=}"
|
||||||
path_order "$arg"
|
if system_dir "$arg"; then
|
||||||
case $? in
|
append return_system_rpath_dirs_list "$arg"
|
||||||
0) append return_spack_store_rpath_dirs_list "$arg" ;;
|
else
|
||||||
1) append return_rpath_dirs_list "$arg" ;;
|
append return_rpath_dirs_list "$arg"
|
||||||
2) append return_system_rpath_dirs_list "$arg" ;;
|
fi
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
-rpath|--rpath)
|
-rpath|--rpath)
|
||||||
xlinker_expect_rpath=yes
|
xlinker_expect_rpath=yes
|
||||||
@@ -677,25 +661,16 @@ categorize_arguments() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
categorize_arguments "$@"
|
categorize_arguments "$@"
|
||||||
|
include_dirs_list="$return_include_dirs_list"
|
||||||
spack_store_include_dirs_list="$return_spack_store_include_dirs_list"
|
lib_dirs_list="$return_lib_dirs_list"
|
||||||
system_include_dirs_list="$return_system_include_dirs_list"
|
rpath_dirs_list="$return_rpath_dirs_list"
|
||||||
include_dirs_list="$return_include_dirs_list"
|
system_include_dirs_list="$return_system_include_dirs_list"
|
||||||
|
system_lib_dirs_list="$return_system_lib_dirs_list"
|
||||||
spack_store_lib_dirs_list="$return_spack_store_lib_dirs_list"
|
system_rpath_dirs_list="$return_system_rpath_dirs_list"
|
||||||
system_lib_dirs_list="$return_system_lib_dirs_list"
|
isystem_was_used="$return_isystem_was_used"
|
||||||
lib_dirs_list="$return_lib_dirs_list"
|
isystem_system_include_dirs_list="$return_isystem_system_include_dirs_list"
|
||||||
|
isystem_include_dirs_list="$return_isystem_include_dirs_list"
|
||||||
spack_store_rpath_dirs_list="$return_spack_store_rpath_dirs_list"
|
other_args_list="$return_other_args_list"
|
||||||
system_rpath_dirs_list="$return_system_rpath_dirs_list"
|
|
||||||
rpath_dirs_list="$return_rpath_dirs_list"
|
|
||||||
|
|
||||||
isystem_spack_store_include_dirs_list="$return_isystem_spack_store_include_dirs_list"
|
|
||||||
isystem_system_include_dirs_list="$return_isystem_system_include_dirs_list"
|
|
||||||
isystem_include_dirs_list="$return_isystem_include_dirs_list"
|
|
||||||
|
|
||||||
isystem_was_used="$return_isystem_was_used"
|
|
||||||
other_args_list="$return_other_args_list"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Add flags from Spack's cppflags, cflags, cxxflags, fcflags, fflags, and
|
# Add flags from Spack's cppflags, cflags, cxxflags, fcflags, fflags, and
|
||||||
@@ -755,7 +730,7 @@ esac
|
|||||||
|
|
||||||
# Linker flags
|
# Linker flags
|
||||||
case "$mode" in
|
case "$mode" in
|
||||||
ccld)
|
ld|ccld)
|
||||||
extend spack_flags_list SPACK_LDFLAGS
|
extend spack_flags_list SPACK_LDFLAGS
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -763,25 +738,16 @@ esac
|
|||||||
IFS="$lsep"
|
IFS="$lsep"
|
||||||
categorize_arguments $spack_flags_list
|
categorize_arguments $spack_flags_list
|
||||||
unset IFS
|
unset IFS
|
||||||
|
spack_flags_include_dirs_list="$return_include_dirs_list"
|
||||||
spack_flags_isystem_spack_store_include_dirs_list="$return_isystem_spack_store_include_dirs_list"
|
spack_flags_lib_dirs_list="$return_lib_dirs_list"
|
||||||
spack_flags_isystem_system_include_dirs_list="$return_isystem_system_include_dirs_list"
|
spack_flags_rpath_dirs_list="$return_rpath_dirs_list"
|
||||||
spack_flags_isystem_include_dirs_list="$return_isystem_include_dirs_list"
|
spack_flags_system_include_dirs_list="$return_system_include_dirs_list"
|
||||||
|
spack_flags_system_lib_dirs_list="$return_system_lib_dirs_list"
|
||||||
spack_flags_spack_store_include_dirs_list="$return_spack_store_include_dirs_list"
|
spack_flags_system_rpath_dirs_list="$return_system_rpath_dirs_list"
|
||||||
spack_flags_system_include_dirs_list="$return_system_include_dirs_list"
|
spack_flags_isystem_was_used="$return_isystem_was_used"
|
||||||
spack_flags_include_dirs_list="$return_include_dirs_list"
|
spack_flags_isystem_system_include_dirs_list="$return_isystem_system_include_dirs_list"
|
||||||
|
spack_flags_isystem_include_dirs_list="$return_isystem_include_dirs_list"
|
||||||
spack_flags_spack_store_lib_dirs_list="$return_spack_store_lib_dirs_list"
|
spack_flags_other_args_list="$return_other_args_list"
|
||||||
spack_flags_system_lib_dirs_list="$return_system_lib_dirs_list"
|
|
||||||
spack_flags_lib_dirs_list="$return_lib_dirs_list"
|
|
||||||
|
|
||||||
spack_flags_spack_store_rpath_dirs_list="$return_spack_store_rpath_dirs_list"
|
|
||||||
spack_flags_system_rpath_dirs_list="$return_system_rpath_dirs_list"
|
|
||||||
spack_flags_rpath_dirs_list="$return_rpath_dirs_list"
|
|
||||||
|
|
||||||
spack_flags_isystem_was_used="$return_isystem_was_used"
|
|
||||||
spack_flags_other_args_list="$return_other_args_list"
|
|
||||||
|
|
||||||
|
|
||||||
# On macOS insert headerpad_max_install_names linker flag
|
# On macOS insert headerpad_max_install_names linker flag
|
||||||
@@ -801,13 +767,11 @@ if [ "$mode" = ccld ] || [ "$mode" = ld ]; then
|
|||||||
# Append RPATH directories. Note that in the case of the
|
# Append RPATH directories. Note that in the case of the
|
||||||
# top-level package these directories may not exist yet. For dependencies
|
# top-level package these directories may not exist yet. For dependencies
|
||||||
# it is assumed that paths have already been confirmed.
|
# it is assumed that paths have already been confirmed.
|
||||||
extend spack_store_rpath_dirs_list SPACK_STORE_RPATH_DIRS
|
|
||||||
extend rpath_dirs_list SPACK_RPATH_DIRS
|
extend rpath_dirs_list SPACK_RPATH_DIRS
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$mode" = ccld ] || [ "$mode" = ld ]; then
|
if [ "$mode" = ccld ] || [ "$mode" = ld ]; then
|
||||||
extend spack_store_lib_dirs_list SPACK_STORE_LINK_DIRS
|
|
||||||
extend lib_dirs_list SPACK_LINK_DIRS
|
extend lib_dirs_list SPACK_LINK_DIRS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -834,50 +798,38 @@ case "$mode" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$mode" in
|
|
||||||
cpp|cc|as|ccld)
|
|
||||||
if [ "$spack_flags_isystem_was_used" = "true" ] || [ "$isystem_was_used" = "true" ]; then
|
|
||||||
extend isystem_spack_store_include_dirs_list SPACK_STORE_INCLUDE_DIRS
|
|
||||||
extend isystem_include_dirs_list SPACK_INCLUDE_DIRS
|
|
||||||
else
|
|
||||||
extend spack_store_include_dirs_list SPACK_STORE_INCLUDE_DIRS
|
|
||||||
extend include_dirs_list SPACK_INCLUDE_DIRS
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Finally, reassemble the command line.
|
# Finally, reassemble the command line.
|
||||||
#
|
#
|
||||||
args_list="$flags_list"
|
args_list="$flags_list"
|
||||||
|
|
||||||
# Include search paths partitioned by (in store, non-sytem, system)
|
# Insert include directories just prior to any system include directories
|
||||||
# NOTE: adding ${lsep} to the prefix here turns every added element into two
|
# NOTE: adding ${lsep} to the prefix here turns every added element into two
|
||||||
extend args_list spack_flags_spack_store_include_dirs_list -I
|
extend args_list spack_flags_include_dirs_list "-I"
|
||||||
extend args_list spack_store_include_dirs_list -I
|
extend args_list include_dirs_list "-I"
|
||||||
|
|
||||||
extend args_list spack_flags_include_dirs_list -I
|
|
||||||
extend args_list include_dirs_list -I
|
|
||||||
|
|
||||||
extend args_list spack_flags_isystem_spack_store_include_dirs_list "-isystem${lsep}"
|
|
||||||
extend args_list isystem_spack_store_include_dirs_list "-isystem${lsep}"
|
|
||||||
|
|
||||||
extend args_list spack_flags_isystem_include_dirs_list "-isystem${lsep}"
|
extend args_list spack_flags_isystem_include_dirs_list "-isystem${lsep}"
|
||||||
extend args_list isystem_include_dirs_list "-isystem${lsep}"
|
extend args_list isystem_include_dirs_list "-isystem${lsep}"
|
||||||
|
|
||||||
|
case "$mode" in
|
||||||
|
cpp|cc|as|ccld)
|
||||||
|
if [ "$spack_flags_isystem_was_used" = "true" ]; then
|
||||||
|
extend args_list SPACK_INCLUDE_DIRS "-isystem${lsep}"
|
||||||
|
elif [ "$isystem_was_used" = "true" ]; then
|
||||||
|
extend args_list SPACK_INCLUDE_DIRS "-isystem${lsep}"
|
||||||
|
else
|
||||||
|
extend args_list SPACK_INCLUDE_DIRS "-I"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
extend args_list spack_flags_system_include_dirs_list -I
|
extend args_list spack_flags_system_include_dirs_list -I
|
||||||
extend args_list system_include_dirs_list -I
|
extend args_list system_include_dirs_list -I
|
||||||
|
|
||||||
extend args_list spack_flags_isystem_system_include_dirs_list "-isystem${lsep}"
|
extend args_list spack_flags_isystem_system_include_dirs_list "-isystem${lsep}"
|
||||||
extend args_list isystem_system_include_dirs_list "-isystem${lsep}"
|
extend args_list isystem_system_include_dirs_list "-isystem${lsep}"
|
||||||
|
|
||||||
# Library search paths partitioned by (in store, non-sytem, system)
|
# Library search paths
|
||||||
extend args_list spack_flags_spack_store_lib_dirs_list "-L"
|
|
||||||
extend args_list spack_store_lib_dirs_list "-L"
|
|
||||||
|
|
||||||
extend args_list spack_flags_lib_dirs_list "-L"
|
extend args_list spack_flags_lib_dirs_list "-L"
|
||||||
extend args_list lib_dirs_list "-L"
|
extend args_list lib_dirs_list "-L"
|
||||||
|
|
||||||
extend args_list spack_flags_system_lib_dirs_list "-L"
|
extend args_list spack_flags_system_lib_dirs_list "-L"
|
||||||
extend args_list system_lib_dirs_list "-L"
|
extend args_list system_lib_dirs_list "-L"
|
||||||
|
|
||||||
@@ -887,12 +839,8 @@ case "$mode" in
|
|||||||
if [ -n "$dtags_to_add" ] ; then
|
if [ -n "$dtags_to_add" ] ; then
|
||||||
append args_list "$linker_arg$dtags_to_add"
|
append args_list "$linker_arg$dtags_to_add"
|
||||||
fi
|
fi
|
||||||
extend args_list spack_flags_spack_store_rpath_dirs_list "$rpath"
|
|
||||||
extend args_list spack_store_rpath_dirs_list "$rpath"
|
|
||||||
|
|
||||||
extend args_list spack_flags_rpath_dirs_list "$rpath"
|
extend args_list spack_flags_rpath_dirs_list "$rpath"
|
||||||
extend args_list rpath_dirs_list "$rpath"
|
extend args_list rpath_dirs_list "$rpath"
|
||||||
|
|
||||||
extend args_list spack_flags_system_rpath_dirs_list "$rpath"
|
extend args_list spack_flags_system_rpath_dirs_list "$rpath"
|
||||||
extend args_list system_rpath_dirs_list "$rpath"
|
extend args_list system_rpath_dirs_list "$rpath"
|
||||||
;;
|
;;
|
||||||
@@ -900,12 +848,8 @@ case "$mode" in
|
|||||||
if [ -n "$dtags_to_add" ] ; then
|
if [ -n "$dtags_to_add" ] ; then
|
||||||
append args_list "$dtags_to_add"
|
append args_list "$dtags_to_add"
|
||||||
fi
|
fi
|
||||||
extend args_list spack_flags_spack_store_rpath_dirs_list "-rpath${lsep}"
|
|
||||||
extend args_list spack_store_rpath_dirs_list "-rpath${lsep}"
|
|
||||||
|
|
||||||
extend args_list spack_flags_rpath_dirs_list "-rpath${lsep}"
|
extend args_list spack_flags_rpath_dirs_list "-rpath${lsep}"
|
||||||
extend args_list rpath_dirs_list "-rpath${lsep}"
|
extend args_list rpath_dirs_list "-rpath${lsep}"
|
||||||
|
|
||||||
extend args_list spack_flags_system_rpath_dirs_list "-rpath${lsep}"
|
extend args_list spack_flags_system_rpath_dirs_list "-rpath${lsep}"
|
||||||
extend args_list system_rpath_dirs_list "-rpath${lsep}"
|
extend args_list system_rpath_dirs_list "-rpath${lsep}"
|
||||||
;;
|
;;
|
||||||
@@ -969,3 +913,4 @@ fi
|
|||||||
# Execute the full command, preserving spaces with IFS set
|
# Execute the full command, preserving spaces with IFS set
|
||||||
# to the alarm bell separator.
|
# to the alarm bell separator.
|
||||||
IFS="$lsep"; exec $full_command_list
|
IFS="$lsep"; exec $full_command_list
|
||||||
|
|
||||||
|
|||||||
4
lib/spack/external/__init__.py
vendored
4
lib/spack/external/__init__.py
vendored
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
* Homepage: https://pypi.python.org/pypi/archspec
|
* Homepage: https://pypi.python.org/pypi/archspec
|
||||||
* Usage: Labeling, comparison and detection of microarchitectures
|
* Usage: Labeling, comparison and detection of microarchitectures
|
||||||
* Version: 0.2.5 (commit 38ce485258ffc4fc6dd6688f8dc90cb269478c47)
|
* Version: 0.2.2 (commit 1dc58a5776dd77e6fc6e4ba5626af5b1fb24996e)
|
||||||
|
|
||||||
astunparse
|
astunparse
|
||||||
----------------
|
----------------
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ def copy_attributes(self, t, memo=None):
|
|||||||
Tag.attrib, merge_attrib]:
|
Tag.attrib, merge_attrib]:
|
||||||
if hasattr(self, a):
|
if hasattr(self, a):
|
||||||
if memo is not None:
|
if memo is not None:
|
||||||
setattr(t, a, copy.deepcopy(getattr(self, a), memo))
|
setattr(t, a, copy.deepcopy(getattr(self, a, memo)))
|
||||||
else:
|
else:
|
||||||
setattr(t, a, getattr(self, a))
|
setattr(t, a, getattr(self, a))
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|||||||
3
lib/spack/external/archspec/__init__.py
vendored
3
lib/spack/external/archspec/__init__.py
vendored
@@ -1,3 +1,2 @@
|
|||||||
"""Init file to avoid namespace packages"""
|
"""Init file to avoid namespace packages"""
|
||||||
|
__version__ = "0.2.2"
|
||||||
__version__ = "0.2.4"
|
|
||||||
|
|||||||
1
lib/spack/external/archspec/__main__.py
vendored
1
lib/spack/external/archspec/__main__.py
vendored
@@ -3,7 +3,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from .cli import main
|
from .cli import main
|
||||||
|
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|||||||
6
lib/spack/external/archspec/cli.py
vendored
6
lib/spack/external/archspec/cli.py
vendored
@@ -46,11 +46,7 @@ def _make_parser() -> argparse.ArgumentParser:
|
|||||||
|
|
||||||
def cpu() -> int:
|
def cpu() -> int:
|
||||||
"""Run the `archspec cpu` subcommand."""
|
"""Run the `archspec cpu` subcommand."""
|
||||||
try:
|
print(archspec.cpu.host())
|
||||||
print(archspec.cpu.host())
|
|
||||||
except FileNotFoundError as exc:
|
|
||||||
print(exc)
|
|
||||||
return 1
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
19
lib/spack/external/archspec/cpu/__init__.py
vendored
19
lib/spack/external/archspec/cpu/__init__.py
vendored
@@ -5,23 +5,16 @@
|
|||||||
"""The "cpu" package permits to query and compare different
|
"""The "cpu" package permits to query and compare different
|
||||||
CPU microarchitectures.
|
CPU microarchitectures.
|
||||||
"""
|
"""
|
||||||
from .detect import brand_string, host
|
from .microarchitecture import Microarchitecture, UnsupportedMicroarchitecture
|
||||||
from .microarchitecture import (
|
from .microarchitecture import TARGETS, generic_microarchitecture
|
||||||
TARGETS,
|
from .microarchitecture import version_components
|
||||||
InvalidCompilerVersion,
|
from .detect import host
|
||||||
Microarchitecture,
|
|
||||||
UnsupportedMicroarchitecture,
|
|
||||||
generic_microarchitecture,
|
|
||||||
version_components,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"brand_string",
|
|
||||||
"host",
|
|
||||||
"TARGETS",
|
|
||||||
"InvalidCompilerVersion",
|
|
||||||
"Microarchitecture",
|
"Microarchitecture",
|
||||||
"UnsupportedMicroarchitecture",
|
"UnsupportedMicroarchitecture",
|
||||||
|
"TARGETS",
|
||||||
"generic_microarchitecture",
|
"generic_microarchitecture",
|
||||||
|
"host",
|
||||||
"version_components",
|
"version_components",
|
||||||
]
|
]
|
||||||
|
|||||||
420
lib/spack/external/archspec/cpu/detect.py
vendored
420
lib/spack/external/archspec/cpu/detect.py
vendored
@@ -4,17 +4,15 @@
|
|||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
"""Detection of CPU microarchitectures"""
|
"""Detection of CPU microarchitectures"""
|
||||||
import collections
|
import collections
|
||||||
|
import functools
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
import struct
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Dict, List, Optional, Set, Tuple, Union
|
|
||||||
|
|
||||||
from ..vendor.cpuid.cpuid import CPUID
|
from .microarchitecture import generic_microarchitecture, TARGETS
|
||||||
from .microarchitecture import TARGETS, Microarchitecture, generic_microarchitecture
|
from .schema import TARGETS_JSON
|
||||||
from .schema import CPUID_JSON, TARGETS_JSON
|
|
||||||
|
|
||||||
#: Mapping from operating systems to chain of commands
|
#: Mapping from operating systems to chain of commands
|
||||||
#: to obtain a dictionary of raw info on the current cpu
|
#: to obtain a dictionary of raw info on the current cpu
|
||||||
@@ -24,51 +22,43 @@
|
|||||||
#: functions checking the compatibility of the host with a given target
|
#: functions checking the compatibility of the host with a given target
|
||||||
COMPATIBILITY_CHECKS = {}
|
COMPATIBILITY_CHECKS = {}
|
||||||
|
|
||||||
# Constants for commonly used architectures
|
|
||||||
X86_64 = "x86_64"
|
|
||||||
AARCH64 = "aarch64"
|
|
||||||
PPC64LE = "ppc64le"
|
|
||||||
PPC64 = "ppc64"
|
|
||||||
RISCV64 = "riscv64"
|
|
||||||
|
|
||||||
|
def info_dict(operating_system):
|
||||||
def detection(operating_system: str):
|
"""Decorator to mark functions that are meant to return raw info on
|
||||||
"""Decorator to mark functions that are meant to return partial information on the current cpu.
|
the current cpu.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
operating_system: operating system where this function can be used.
|
operating_system (str or tuple): operating system for which the marked
|
||||||
|
function is a viable factory of raw info dictionaries.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(factory):
|
def decorator(factory):
|
||||||
INFO_FACTORY[operating_system].append(factory)
|
INFO_FACTORY[operating_system].append(factory)
|
||||||
return factory
|
|
||||||
|
@functools.wraps(factory)
|
||||||
|
def _impl():
|
||||||
|
info = factory()
|
||||||
|
|
||||||
|
# Check that info contains a few mandatory fields
|
||||||
|
msg = 'field "{0}" is missing from raw info dictionary'
|
||||||
|
assert "vendor_id" in info, msg.format("vendor_id")
|
||||||
|
assert "flags" in info, msg.format("flags")
|
||||||
|
assert "model" in info, msg.format("model")
|
||||||
|
assert "model_name" in info, msg.format("model_name")
|
||||||
|
|
||||||
|
return info
|
||||||
|
|
||||||
|
return _impl
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
def partial_uarch(
|
@info_dict(operating_system="Linux")
|
||||||
name: str = "",
|
def proc_cpuinfo():
|
||||||
vendor: str = "",
|
"""Returns a raw info dictionary by parsing the first entry of
|
||||||
features: Optional[Set[str]] = None,
|
``/proc/cpuinfo``
|
||||||
generation: int = 0,
|
"""
|
||||||
cpu_part: str = "",
|
info = {}
|
||||||
) -> Microarchitecture:
|
|
||||||
"""Construct a partial microarchitecture, from information gathered during system scan."""
|
|
||||||
return Microarchitecture(
|
|
||||||
name=name,
|
|
||||||
parents=[],
|
|
||||||
vendor=vendor,
|
|
||||||
features=features or set(),
|
|
||||||
compilers={},
|
|
||||||
generation=generation,
|
|
||||||
cpu_part=cpu_part,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@detection(operating_system="Linux")
|
|
||||||
def proc_cpuinfo() -> Microarchitecture:
|
|
||||||
"""Returns a partial Microarchitecture, obtained from scanning ``/proc/cpuinfo``"""
|
|
||||||
data = {}
|
|
||||||
with open("/proc/cpuinfo") as file: # pylint: disable=unspecified-encoding
|
with open("/proc/cpuinfo") as file: # pylint: disable=unspecified-encoding
|
||||||
for line in file:
|
for line in file:
|
||||||
key, separator, value = line.partition(":")
|
key, separator, value = line.partition(":")
|
||||||
@@ -80,122 +70,11 @@ def proc_cpuinfo() -> Microarchitecture:
|
|||||||
#
|
#
|
||||||
# we are on a blank line separating two cpus. Exit early as
|
# we are on a blank line separating two cpus. Exit early as
|
||||||
# we want to read just the first entry in /proc/cpuinfo
|
# we want to read just the first entry in /proc/cpuinfo
|
||||||
if separator != ":" and data:
|
if separator != ":" and info:
|
||||||
break
|
break
|
||||||
|
|
||||||
data[key.strip()] = value.strip()
|
info[key.strip()] = value.strip()
|
||||||
|
return info
|
||||||
architecture = _machine()
|
|
||||||
if architecture == X86_64:
|
|
||||||
return partial_uarch(
|
|
||||||
vendor=data.get("vendor_id", "generic"), features=_feature_set(data, key="flags")
|
|
||||||
)
|
|
||||||
|
|
||||||
if architecture == AARCH64:
|
|
||||||
return partial_uarch(
|
|
||||||
vendor=_canonicalize_aarch64_vendor(data),
|
|
||||||
features=_feature_set(data, key="Features"),
|
|
||||||
cpu_part=data.get("CPU part", ""),
|
|
||||||
)
|
|
||||||
|
|
||||||
if architecture in (PPC64LE, PPC64):
|
|
||||||
generation_match = re.search(r"POWER(\d+)", data.get("cpu", ""))
|
|
||||||
try:
|
|
||||||
generation = int(generation_match.group(1))
|
|
||||||
except AttributeError:
|
|
||||||
# There might be no match under emulated environments. For instance
|
|
||||||
# emulating a ppc64le with QEMU and Docker still reports the host
|
|
||||||
# /proc/cpuinfo and not a Power
|
|
||||||
generation = 0
|
|
||||||
return partial_uarch(generation=generation)
|
|
||||||
|
|
||||||
if architecture == RISCV64:
|
|
||||||
if data.get("uarch") == "sifive,u74-mc":
|
|
||||||
data["uarch"] = "u74mc"
|
|
||||||
return partial_uarch(name=data.get("uarch", RISCV64))
|
|
||||||
|
|
||||||
return generic_microarchitecture(architecture)
|
|
||||||
|
|
||||||
|
|
||||||
class CpuidInfoCollector:
|
|
||||||
"""Collects the information we need on the host CPU from cpuid"""
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
def __init__(self):
|
|
||||||
self.cpuid = CPUID()
|
|
||||||
|
|
||||||
registers = self.cpuid.registers_for(**CPUID_JSON["vendor"]["input"])
|
|
||||||
self.highest_basic_support = registers.eax
|
|
||||||
self.vendor = struct.pack("III", registers.ebx, registers.edx, registers.ecx).decode(
|
|
||||||
"utf-8"
|
|
||||||
)
|
|
||||||
|
|
||||||
registers = self.cpuid.registers_for(**CPUID_JSON["highest_extension_support"]["input"])
|
|
||||||
self.highest_extension_support = registers.eax
|
|
||||||
|
|
||||||
self.features = self._features()
|
|
||||||
|
|
||||||
def _features(self):
|
|
||||||
result = set()
|
|
||||||
|
|
||||||
def check_features(data):
|
|
||||||
registers = self.cpuid.registers_for(**data["input"])
|
|
||||||
for feature_check in data["bits"]:
|
|
||||||
current = getattr(registers, feature_check["register"])
|
|
||||||
if self._is_bit_set(current, feature_check["bit"]):
|
|
||||||
result.add(feature_check["name"])
|
|
||||||
|
|
||||||
for call_data in CPUID_JSON["flags"]:
|
|
||||||
if call_data["input"]["eax"] > self.highest_basic_support:
|
|
||||||
continue
|
|
||||||
check_features(call_data)
|
|
||||||
|
|
||||||
for call_data in CPUID_JSON["extension-flags"]:
|
|
||||||
if call_data["input"]["eax"] > self.highest_extension_support:
|
|
||||||
continue
|
|
||||||
check_features(call_data)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def _is_bit_set(self, register: int, bit: int) -> bool:
|
|
||||||
mask = 1 << bit
|
|
||||||
return register & mask > 0
|
|
||||||
|
|
||||||
def brand_string(self) -> Optional[str]:
|
|
||||||
"""Returns the brand string, if available."""
|
|
||||||
if self.highest_extension_support < 0x80000004:
|
|
||||||
return None
|
|
||||||
|
|
||||||
r1 = self.cpuid.registers_for(eax=0x80000002, ecx=0)
|
|
||||||
r2 = self.cpuid.registers_for(eax=0x80000003, ecx=0)
|
|
||||||
r3 = self.cpuid.registers_for(eax=0x80000004, ecx=0)
|
|
||||||
result = struct.pack(
|
|
||||||
"IIIIIIIIIIII",
|
|
||||||
r1.eax,
|
|
||||||
r1.ebx,
|
|
||||||
r1.ecx,
|
|
||||||
r1.edx,
|
|
||||||
r2.eax,
|
|
||||||
r2.ebx,
|
|
||||||
r2.ecx,
|
|
||||||
r2.edx,
|
|
||||||
r3.eax,
|
|
||||||
r3.ebx,
|
|
||||||
r3.ecx,
|
|
||||||
r3.edx,
|
|
||||||
).decode("utf-8")
|
|
||||||
return result.strip("\x00")
|
|
||||||
|
|
||||||
|
|
||||||
@detection(operating_system="Windows")
|
|
||||||
def cpuid_info():
|
|
||||||
"""Returns a partial Microarchitecture, obtained from running the cpuid instruction"""
|
|
||||||
architecture = _machine()
|
|
||||||
if architecture == X86_64:
|
|
||||||
data = CpuidInfoCollector()
|
|
||||||
return partial_uarch(vendor=data.vendor, features=data.features)
|
|
||||||
|
|
||||||
return generic_microarchitecture(architecture)
|
|
||||||
|
|
||||||
|
|
||||||
def _check_output(args, env):
|
def _check_output(args, env):
|
||||||
@@ -204,25 +83,14 @@ def _check_output(args, env):
|
|||||||
return str(output.decode("utf-8"))
|
return str(output.decode("utf-8"))
|
||||||
|
|
||||||
|
|
||||||
WINDOWS_MAPPING = {
|
|
||||||
"AMD64": X86_64,
|
|
||||||
"ARM64": AARCH64,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def _machine():
|
def _machine():
|
||||||
"""Return the machine architecture we are on"""
|
""" "Return the machine architecture we are on"""
|
||||||
operating_system = platform.system()
|
operating_system = platform.system()
|
||||||
|
|
||||||
# If we are not on Darwin or Windows, trust what Python tells us
|
# If we are not on Darwin, trust what Python tells us
|
||||||
if operating_system not in ("Darwin", "Windows"):
|
if operating_system != "Darwin":
|
||||||
return platform.machine()
|
return platform.machine()
|
||||||
|
|
||||||
# Normalize windows specific names
|
|
||||||
if operating_system == "Windows":
|
|
||||||
platform_machine = platform.machine()
|
|
||||||
return WINDOWS_MAPPING.get(platform_machine, platform_machine)
|
|
||||||
|
|
||||||
# On Darwin it might happen that we are on M1, but using an interpreter
|
# On Darwin it might happen that we are on M1, but using an interpreter
|
||||||
# built for x86_64. In that case "platform.machine() == 'x86_64'", so we
|
# built for x86_64. In that case "platform.machine() == 'x86_64'", so we
|
||||||
# need to fix that.
|
# need to fix that.
|
||||||
@@ -235,47 +103,54 @@ def _machine():
|
|||||||
if "Apple" in output:
|
if "Apple" in output:
|
||||||
# Note that a native Python interpreter on Apple M1 would return
|
# Note that a native Python interpreter on Apple M1 would return
|
||||||
# "arm64" instead of "aarch64". Here we normalize to the latter.
|
# "arm64" instead of "aarch64". Here we normalize to the latter.
|
||||||
return AARCH64
|
return "aarch64"
|
||||||
|
|
||||||
return X86_64
|
return "x86_64"
|
||||||
|
|
||||||
|
|
||||||
@detection(operating_system="Darwin")
|
@info_dict(operating_system="Darwin")
|
||||||
def sysctl_info() -> Microarchitecture:
|
def sysctl_info_dict():
|
||||||
"""Returns a raw info dictionary parsing the output of sysctl."""
|
"""Returns a raw info dictionary parsing the output of sysctl."""
|
||||||
child_environment = _ensure_bin_usrbin_in_path()
|
child_environment = _ensure_bin_usrbin_in_path()
|
||||||
|
|
||||||
def sysctl(*args: str) -> str:
|
def sysctl(*args):
|
||||||
return _check_output(["sysctl"] + list(args), env=child_environment).strip()
|
return _check_output(["sysctl"] + list(args), env=child_environment).strip()
|
||||||
|
|
||||||
if _machine() == X86_64:
|
if _machine() == "x86_64":
|
||||||
features = (
|
flags = (
|
||||||
f'{sysctl("-n", "machdep.cpu.features").lower()} '
|
sysctl("-n", "machdep.cpu.features").lower()
|
||||||
f'{sysctl("-n", "machdep.cpu.leaf7_features").lower()}'
|
+ " "
|
||||||
|
+ sysctl("-n", "machdep.cpu.leaf7_features").lower()
|
||||||
)
|
)
|
||||||
features = set(features.split())
|
info = {
|
||||||
|
"vendor_id": sysctl("-n", "machdep.cpu.vendor"),
|
||||||
|
"flags": flags,
|
||||||
|
"model": sysctl("-n", "machdep.cpu.model"),
|
||||||
|
"model name": sysctl("-n", "machdep.cpu.brand_string"),
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
model = "unknown"
|
||||||
|
model_str = sysctl("-n", "machdep.cpu.brand_string").lower()
|
||||||
|
if "m2" in model_str:
|
||||||
|
model = "m2"
|
||||||
|
elif "m1" in model_str:
|
||||||
|
model = "m1"
|
||||||
|
elif "apple" in model_str:
|
||||||
|
model = "m1"
|
||||||
|
|
||||||
# Flags detected on Darwin turned to their linux counterpart
|
info = {
|
||||||
for darwin_flag, linux_flag in TARGETS_JSON["conversions"]["darwin_flags"].items():
|
"vendor_id": "Apple",
|
||||||
if darwin_flag in features:
|
"flags": [],
|
||||||
features.update(linux_flag.split())
|
"model": model,
|
||||||
|
"CPU implementer": "Apple",
|
||||||
return partial_uarch(vendor=sysctl("-n", "machdep.cpu.vendor"), features=features)
|
"model name": sysctl("-n", "machdep.cpu.brand_string"),
|
||||||
|
}
|
||||||
model = "unknown"
|
return info
|
||||||
model_str = sysctl("-n", "machdep.cpu.brand_string").lower()
|
|
||||||
if "m2" in model_str:
|
|
||||||
model = "m2"
|
|
||||||
elif "m1" in model_str:
|
|
||||||
model = "m1"
|
|
||||||
elif "apple" in model_str:
|
|
||||||
model = "m1"
|
|
||||||
|
|
||||||
return partial_uarch(name=model, vendor="Apple")
|
|
||||||
|
|
||||||
|
|
||||||
def _ensure_bin_usrbin_in_path():
|
def _ensure_bin_usrbin_in_path():
|
||||||
# Make sure that /sbin and /usr/sbin are in PATH as sysctl is usually found there
|
# Make sure that /sbin and /usr/sbin are in PATH as sysctl is
|
||||||
|
# usually found there
|
||||||
child_environment = dict(os.environ.items())
|
child_environment = dict(os.environ.items())
|
||||||
search_paths = child_environment.get("PATH", "").split(os.pathsep)
|
search_paths = child_environment.get("PATH", "").split(os.pathsep)
|
||||||
for additional_path in ("/sbin", "/usr/sbin"):
|
for additional_path in ("/sbin", "/usr/sbin"):
|
||||||
@@ -285,10 +160,22 @@ def _ensure_bin_usrbin_in_path():
|
|||||||
return child_environment
|
return child_environment
|
||||||
|
|
||||||
|
|
||||||
def _canonicalize_aarch64_vendor(data: Dict[str, str]) -> str:
|
def adjust_raw_flags(info):
|
||||||
"""Adjust the vendor field to make it human-readable"""
|
"""Adjust the flags detected on the system to homogenize
|
||||||
if "CPU implementer" not in data:
|
slightly different representations.
|
||||||
return "generic"
|
"""
|
||||||
|
# Flags detected on Darwin turned to their linux counterpart
|
||||||
|
flags = info.get("flags", [])
|
||||||
|
d2l = TARGETS_JSON["conversions"]["darwin_flags"]
|
||||||
|
for darwin_flag, linux_flag in d2l.items():
|
||||||
|
if darwin_flag in flags:
|
||||||
|
info["flags"] += " " + linux_flag
|
||||||
|
|
||||||
|
|
||||||
|
def adjust_raw_vendor(info):
|
||||||
|
"""Adjust the vendor field to make it human readable"""
|
||||||
|
if "CPU implementer" not in info:
|
||||||
|
return
|
||||||
|
|
||||||
# Mapping numeric codes to vendor (ARM). This list is a merge from
|
# Mapping numeric codes to vendor (ARM). This list is a merge from
|
||||||
# different sources:
|
# different sources:
|
||||||
@@ -298,37 +185,43 @@ def _canonicalize_aarch64_vendor(data: Dict[str, str]) -> str:
|
|||||||
# https://github.com/gcc-mirror/gcc/blob/master/gcc/config/aarch64/aarch64-cores.def
|
# https://github.com/gcc-mirror/gcc/blob/master/gcc/config/aarch64/aarch64-cores.def
|
||||||
# https://patchwork.kernel.org/patch/10524949/
|
# https://patchwork.kernel.org/patch/10524949/
|
||||||
arm_vendors = TARGETS_JSON["conversions"]["arm_vendors"]
|
arm_vendors = TARGETS_JSON["conversions"]["arm_vendors"]
|
||||||
arm_code = data["CPU implementer"]
|
arm_code = info["CPU implementer"]
|
||||||
return arm_vendors.get(arm_code, arm_code)
|
if arm_code in arm_vendors:
|
||||||
|
info["CPU implementer"] = arm_vendors[arm_code]
|
||||||
|
|
||||||
|
|
||||||
def _feature_set(data: Dict[str, str], key: str) -> Set[str]:
|
def raw_info_dictionary():
|
||||||
return set(data.get(key, "").split())
|
"""Returns a dictionary with information on the cpu of the current host.
|
||||||
|
|
||||||
|
This function calls all the viable factories one after the other until
|
||||||
def detected_info() -> Microarchitecture:
|
there's one that is able to produce the requested information.
|
||||||
"""Returns a partial Microarchitecture with information on the CPU of the current host.
|
|
||||||
|
|
||||||
This function calls all the viable factories one after the other until there's one that is
|
|
||||||
able to produce the requested information. Falls-back to a generic microarchitecture, if none
|
|
||||||
of the calls succeed.
|
|
||||||
"""
|
"""
|
||||||
# pylint: disable=broad-except
|
# pylint: disable=broad-except
|
||||||
|
info = {}
|
||||||
for factory in INFO_FACTORY[platform.system()]:
|
for factory in INFO_FACTORY[platform.system()]:
|
||||||
try:
|
try:
|
||||||
return factory()
|
info = factory()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
warnings.warn(str(exc))
|
warnings.warn(str(exc))
|
||||||
|
|
||||||
return generic_microarchitecture(_machine())
|
if info:
|
||||||
|
adjust_raw_flags(info)
|
||||||
|
adjust_raw_vendor(info)
|
||||||
|
break
|
||||||
|
|
||||||
|
return info
|
||||||
|
|
||||||
|
|
||||||
def compatible_microarchitectures(info: Microarchitecture) -> List[Microarchitecture]:
|
def compatible_microarchitectures(info):
|
||||||
"""Returns an unordered list of known micro-architectures that are compatible with the
|
"""Returns an unordered list of known micro-architectures that are
|
||||||
partial Microarchitecture passed as input.
|
compatible with the info dictionary passed as argument.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
info (dict): dictionary containing information on the host cpu
|
||||||
"""
|
"""
|
||||||
architecture_family = _machine()
|
architecture_family = _machine()
|
||||||
# If a tester is not registered, assume no known target is compatible with the host
|
# If a tester is not registered, be conservative and assume no known
|
||||||
|
# target is compatible with the host
|
||||||
tester = COMPATIBILITY_CHECKS.get(architecture_family, lambda x, y: False)
|
tester = COMPATIBILITY_CHECKS.get(architecture_family, lambda x, y: False)
|
||||||
return [x for x in TARGETS.values() if tester(info, x)] or [
|
return [x for x in TARGETS.values() if tester(info, x)] or [
|
||||||
generic_microarchitecture(architecture_family)
|
generic_microarchitecture(architecture_family)
|
||||||
@@ -337,8 +230,8 @@ def compatible_microarchitectures(info: Microarchitecture) -> List[Microarchitec
|
|||||||
|
|
||||||
def host():
|
def host():
|
||||||
"""Detects the host micro-architecture and returns it."""
|
"""Detects the host micro-architecture and returns it."""
|
||||||
# Retrieve information on the host's cpu
|
# Retrieve a dictionary with raw information on the host's cpu
|
||||||
info = detected_info()
|
info = raw_info_dictionary()
|
||||||
|
|
||||||
# Get a list of possible candidates for this micro-architecture
|
# Get a list of possible candidates for this micro-architecture
|
||||||
candidates = compatible_microarchitectures(info)
|
candidates = compatible_microarchitectures(info)
|
||||||
@@ -351,10 +244,6 @@ def sorting_fn(item):
|
|||||||
generic_candidates = [c for c in candidates if c.vendor == "generic"]
|
generic_candidates = [c for c in candidates if c.vendor == "generic"]
|
||||||
best_generic = max(generic_candidates, key=sorting_fn)
|
best_generic = max(generic_candidates, key=sorting_fn)
|
||||||
|
|
||||||
# Relevant for AArch64. Filter on "cpu_part" if we have any match
|
|
||||||
if info.cpu_part != "" and any(c for c in candidates if info.cpu_part == c.cpu_part):
|
|
||||||
candidates = [c for c in candidates if info.cpu_part == c.cpu_part]
|
|
||||||
|
|
||||||
# Filter the candidates to be descendant of the best generic candidate.
|
# Filter the candidates to be descendant of the best generic candidate.
|
||||||
# This is to avoid that the lack of a niche feature that can be disabled
|
# This is to avoid that the lack of a niche feature that can be disabled
|
||||||
# from e.g. BIOS prevents detection of a reasonably performant architecture
|
# from e.g. BIOS prevents detection of a reasonably performant architecture
|
||||||
@@ -369,15 +258,16 @@ def sorting_fn(item):
|
|||||||
return max(candidates, key=sorting_fn)
|
return max(candidates, key=sorting_fn)
|
||||||
|
|
||||||
|
|
||||||
def compatibility_check(architecture_family: Union[str, Tuple[str, ...]]):
|
def compatibility_check(architecture_family):
|
||||||
"""Decorator to register a function as a proper compatibility check.
|
"""Decorator to register a function as a proper compatibility check.
|
||||||
|
|
||||||
A compatibility check function takes a partial Microarchitecture object as a first argument,
|
A compatibility check function takes the raw info dictionary as a first
|
||||||
and an arbitrary target Microarchitecture as the second argument. It returns True if the
|
argument and an arbitrary target as the second argument. It returns True
|
||||||
target is compatible with first argument, False otherwise.
|
if the target is compatible with the info dictionary, False otherwise.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
architecture_family: architecture family for which this test can be used
|
architecture_family (str or tuple): architecture family for which
|
||||||
|
this test can be used, e.g. x86_64 or ppc64le etc.
|
||||||
"""
|
"""
|
||||||
# Turn the argument into something iterable
|
# Turn the argument into something iterable
|
||||||
if isinstance(architecture_family, str):
|
if isinstance(architecture_family, str):
|
||||||
@@ -390,70 +280,86 @@ def decorator(func):
|
|||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
@compatibility_check(architecture_family=(PPC64LE, PPC64))
|
@compatibility_check(architecture_family=("ppc64le", "ppc64"))
|
||||||
def compatibility_check_for_power(info, target):
|
def compatibility_check_for_power(info, target):
|
||||||
"""Compatibility check for PPC64 and PPC64LE architectures."""
|
"""Compatibility check for PPC64 and PPC64LE architectures."""
|
||||||
|
basename = platform.machine()
|
||||||
|
generation_match = re.search(r"POWER(\d+)", info.get("cpu", ""))
|
||||||
|
try:
|
||||||
|
generation = int(generation_match.group(1))
|
||||||
|
except AttributeError:
|
||||||
|
# There might be no match under emulated environments. For instance
|
||||||
|
# emulating a ppc64le with QEMU and Docker still reports the host
|
||||||
|
# /proc/cpuinfo and not a Power
|
||||||
|
generation = 0
|
||||||
|
|
||||||
# We can use a target if it descends from our machine type and our
|
# We can use a target if it descends from our machine type and our
|
||||||
# generation (9 for POWER9, etc) is at least its generation.
|
# generation (9 for POWER9, etc) is at least its generation.
|
||||||
arch_root = TARGETS[_machine()]
|
arch_root = TARGETS[basename]
|
||||||
return (
|
return (
|
||||||
target == arch_root or arch_root in target.ancestors
|
target == arch_root or arch_root in target.ancestors
|
||||||
) and target.generation <= info.generation
|
) and target.generation <= generation
|
||||||
|
|
||||||
|
|
||||||
@compatibility_check(architecture_family=X86_64)
|
@compatibility_check(architecture_family="x86_64")
|
||||||
def compatibility_check_for_x86_64(info, target):
|
def compatibility_check_for_x86_64(info, target):
|
||||||
"""Compatibility check for x86_64 architectures."""
|
"""Compatibility check for x86_64 architectures."""
|
||||||
|
basename = "x86_64"
|
||||||
|
vendor = info.get("vendor_id", "generic")
|
||||||
|
features = set(info.get("flags", "").split())
|
||||||
|
|
||||||
# We can use a target if it descends from our machine type, is from our
|
# We can use a target if it descends from our machine type, is from our
|
||||||
# vendor, and we have all of its features
|
# vendor, and we have all of its features
|
||||||
arch_root = TARGETS[X86_64]
|
arch_root = TARGETS[basename]
|
||||||
return (
|
return (
|
||||||
(target == arch_root or arch_root in target.ancestors)
|
(target == arch_root or arch_root in target.ancestors)
|
||||||
and target.vendor in (info.vendor, "generic")
|
and target.vendor in (vendor, "generic")
|
||||||
and target.features.issubset(info.features)
|
and target.features.issubset(features)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@compatibility_check(architecture_family=AARCH64)
|
@compatibility_check(architecture_family="aarch64")
|
||||||
def compatibility_check_for_aarch64(info, target):
|
def compatibility_check_for_aarch64(info, target):
|
||||||
"""Compatibility check for AARCH64 architectures."""
|
"""Compatibility check for AARCH64 architectures."""
|
||||||
# At the moment, it's not clear how to detect compatibility with
|
basename = "aarch64"
|
||||||
|
features = set(info.get("Features", "").split())
|
||||||
|
vendor = info.get("CPU implementer", "generic")
|
||||||
|
|
||||||
|
# At the moment it's not clear how to detect compatibility with
|
||||||
# a specific version of the architecture
|
# a specific version of the architecture
|
||||||
if target.vendor == "generic" and target.name != AARCH64:
|
if target.vendor == "generic" and target.name != "aarch64":
|
||||||
return False
|
return False
|
||||||
|
|
||||||
arch_root = TARGETS[AARCH64]
|
arch_root = TARGETS[basename]
|
||||||
arch_root_and_vendor = arch_root == target.family and target.vendor in (
|
arch_root_and_vendor = arch_root == target.family and target.vendor in (
|
||||||
info.vendor,
|
vendor,
|
||||||
"generic",
|
"generic",
|
||||||
)
|
)
|
||||||
|
|
||||||
# On macOS it seems impossible to get all the CPU features
|
# On macOS it seems impossible to get all the CPU features
|
||||||
# with syctl info, but for ARM we can get the exact model
|
# with syctl info, but for ARM we can get the exact model
|
||||||
if platform.system() == "Darwin":
|
if platform.system() == "Darwin":
|
||||||
model = TARGETS[info.name]
|
model_key = info.get("model", basename)
|
||||||
|
model = TARGETS[model_key]
|
||||||
return arch_root_and_vendor and (target == model or target in model.ancestors)
|
return arch_root_and_vendor and (target == model or target in model.ancestors)
|
||||||
|
|
||||||
return arch_root_and_vendor and target.features.issubset(info.features)
|
return arch_root_and_vendor and target.features.issubset(features)
|
||||||
|
|
||||||
|
|
||||||
@compatibility_check(architecture_family=RISCV64)
|
@compatibility_check(architecture_family="riscv64")
|
||||||
def compatibility_check_for_riscv64(info, target):
|
def compatibility_check_for_riscv64(info, target):
|
||||||
"""Compatibility check for riscv64 architectures."""
|
"""Compatibility check for riscv64 architectures."""
|
||||||
arch_root = TARGETS[RISCV64]
|
basename = "riscv64"
|
||||||
|
uarch = info.get("uarch")
|
||||||
|
|
||||||
|
# sifive unmatched board
|
||||||
|
if uarch == "sifive,u74-mc":
|
||||||
|
uarch = "u74mc"
|
||||||
|
# catch-all for unknown uarchs
|
||||||
|
else:
|
||||||
|
uarch = "riscv64"
|
||||||
|
|
||||||
|
arch_root = TARGETS[basename]
|
||||||
return (target == arch_root or arch_root in target.ancestors) and (
|
return (target == arch_root or arch_root in target.ancestors) and (
|
||||||
target.name == info.name or target.vendor == "generic"
|
target == uarch or target.vendor == "generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def brand_string() -> Optional[str]:
|
|
||||||
"""Returns the brand string of the host, if detected, or None."""
|
|
||||||
if platform.system() == "Darwin":
|
|
||||||
return _check_output(
|
|
||||||
["sysctl", "-n", "machdep.cpu.brand_string"], env=_ensure_bin_usrbin_in_path()
|
|
||||||
).strip()
|
|
||||||
|
|
||||||
if host().family == X86_64:
|
|
||||||
return CpuidInfoCollector().brand_string()
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|||||||
126
lib/spack/external/archspec/cpu/microarchitecture.py
vendored
126
lib/spack/external/archspec/cpu/microarchitecture.py
vendored
@@ -2,7 +2,9 @@
|
|||||||
# Archspec Project Developers. See the top-level COPYRIGHT file for details.
|
# Archspec Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
"""Types and functions to manage information on CPU microarchitectures."""
|
"""Types and functions to manage information
|
||||||
|
on CPU microarchitectures.
|
||||||
|
"""
|
||||||
import functools
|
import functools
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
@@ -11,7 +13,6 @@
|
|||||||
import archspec
|
import archspec
|
||||||
import archspec.cpu.alias
|
import archspec.cpu.alias
|
||||||
import archspec.cpu.schema
|
import archspec.cpu.schema
|
||||||
|
|
||||||
from .alias import FEATURE_ALIASES
|
from .alias import FEATURE_ALIASES
|
||||||
from .schema import LazyDictionary
|
from .schema import LazyDictionary
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ class Microarchitecture:
|
|||||||
which has "broadwell" as a parent, supports running binaries
|
which has "broadwell" as a parent, supports running binaries
|
||||||
optimized for "broadwell".
|
optimized for "broadwell".
|
||||||
vendor (str): vendor of the micro-architecture
|
vendor (str): vendor of the micro-architecture
|
||||||
features (set of str): supported CPU flags. Note that the semantic
|
features (list of str): supported CPU flags. Note that the semantic
|
||||||
of the flags in this field might vary among architectures, if
|
of the flags in this field might vary among architectures, if
|
||||||
at all present. For instance x86_64 processors will list all
|
at all present. For instance x86_64 processors will list all
|
||||||
the flags supported by a given CPU while Arm processors will
|
the flags supported by a given CPU while Arm processors will
|
||||||
@@ -63,31 +64,23 @@ class Microarchitecture:
|
|||||||
passed in as argument above.
|
passed in as argument above.
|
||||||
* versions: versions that support this micro-architecture.
|
* versions: versions that support this micro-architecture.
|
||||||
|
|
||||||
generation (int): generation of the micro-architecture, if relevant.
|
generation (int): generation of the micro-architecture, if
|
||||||
cpu_part (str): cpu part of the architecture, if relevant.
|
relevant.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments,too-many-instance-attributes
|
# pylint: disable=too-many-arguments
|
||||||
#: Aliases for micro-architecture's features
|
#: Aliases for micro-architecture's features
|
||||||
feature_aliases = FEATURE_ALIASES
|
feature_aliases = FEATURE_ALIASES
|
||||||
|
|
||||||
def __init__(self, name, parents, vendor, features, compilers, generation=0, cpu_part=""):
|
def __init__(self, name, parents, vendor, features, compilers, generation=0):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.parents = parents
|
self.parents = parents
|
||||||
self.vendor = vendor
|
self.vendor = vendor
|
||||||
self.features = features
|
self.features = features
|
||||||
self.compilers = compilers
|
self.compilers = compilers
|
||||||
# Only relevant for PowerPC
|
|
||||||
self.generation = generation
|
self.generation = generation
|
||||||
# Only relevant for AArch64
|
# Cache the ancestor computation
|
||||||
self.cpu_part = cpu_part
|
|
||||||
|
|
||||||
# Cache the "ancestor" computation
|
|
||||||
self._ancestors = None
|
self._ancestors = None
|
||||||
# Cache the "generic" computation
|
|
||||||
self._generic = None
|
|
||||||
# Cache the "family" computation
|
|
||||||
self._family = None
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ancestors(self):
|
def ancestors(self):
|
||||||
@@ -117,12 +110,8 @@ def __eq__(self, other):
|
|||||||
and self.parents == other.parents # avoid ancestors here
|
and self.parents == other.parents # avoid ancestors here
|
||||||
and self.compilers == other.compilers
|
and self.compilers == other.compilers
|
||||||
and self.generation == other.generation
|
and self.generation == other.generation
|
||||||
and self.cpu_part == other.cpu_part
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def __hash__(self):
|
|
||||||
return hash(self.name)
|
|
||||||
|
|
||||||
@coerce_target_names
|
@coerce_target_names
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return not self == other
|
return not self == other
|
||||||
@@ -153,8 +142,7 @@ def __repr__(self):
|
|||||||
cls_name = self.__class__.__name__
|
cls_name = self.__class__.__name__
|
||||||
fmt = (
|
fmt = (
|
||||||
cls_name + "({0.name!r}, {0.parents!r}, {0.vendor!r}, "
|
cls_name + "({0.name!r}, {0.parents!r}, {0.vendor!r}, "
|
||||||
"{0.features!r}, {0.compilers!r}, generation={0.generation!r}, "
|
"{0.features!r}, {0.compilers!r}, {0.generation!r})"
|
||||||
"cpu_part={0.cpu_part!r})"
|
|
||||||
)
|
)
|
||||||
return fmt.format(self)
|
return fmt.format(self)
|
||||||
|
|
||||||
@@ -179,54 +167,42 @@ def __contains__(self, feature):
|
|||||||
@property
|
@property
|
||||||
def family(self):
|
def family(self):
|
||||||
"""Returns the architecture family a given target belongs to"""
|
"""Returns the architecture family a given target belongs to"""
|
||||||
if self._family is None:
|
roots = [x for x in [self] + self.ancestors if not x.ancestors]
|
||||||
roots = [x for x in [self] + self.ancestors if not x.ancestors]
|
msg = "a target is expected to belong to just one architecture family"
|
||||||
msg = "a target is expected to belong to just one architecture family"
|
msg += f"[found {', '.join(str(x) for x in roots)}]"
|
||||||
msg += f"[found {', '.join(str(x) for x in roots)}]"
|
assert len(roots) == 1, msg
|
||||||
assert len(roots) == 1, msg
|
|
||||||
self._family = roots.pop()
|
|
||||||
|
|
||||||
return self._family
|
return roots.pop()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def generic(self):
|
def generic(self):
|
||||||
"""Returns the best generic architecture that is compatible with self"""
|
"""Returns the best generic architecture that is compatible with self"""
|
||||||
if self._generic is None:
|
generics = [x for x in [self] + self.ancestors if x.vendor == "generic"]
|
||||||
generics = [x for x in [self] + self.ancestors if x.vendor == "generic"]
|
return max(generics, key=lambda x: len(x.ancestors))
|
||||||
self._generic = max(generics, key=lambda x: len(x.ancestors))
|
|
||||||
return self._generic
|
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self, return_list_of_items=False):
|
||||||
"""Returns a dictionary representation of this object."""
|
"""Returns a dictionary representation of this object.
|
||||||
return {
|
|
||||||
"name": str(self.name),
|
|
||||||
"vendor": str(self.vendor),
|
|
||||||
"features": sorted(str(x) for x in self.features),
|
|
||||||
"generation": self.generation,
|
|
||||||
"parents": [str(x) for x in self.parents],
|
|
||||||
"compilers": self.compilers,
|
|
||||||
"cpupart": self.cpu_part,
|
|
||||||
}
|
|
||||||
|
|
||||||
@staticmethod
|
Args:
|
||||||
def from_dict(data) -> "Microarchitecture":
|
return_list_of_items (bool): if True returns an ordered list of
|
||||||
"""Construct a microarchitecture from a dictionary representation."""
|
items instead of the dictionary
|
||||||
return Microarchitecture(
|
"""
|
||||||
name=data["name"],
|
list_of_items = [
|
||||||
parents=[TARGETS[x] for x in data["parents"]],
|
("name", str(self.name)),
|
||||||
vendor=data["vendor"],
|
("vendor", str(self.vendor)),
|
||||||
features=set(data["features"]),
|
("features", sorted(str(x) for x in self.features)),
|
||||||
compilers=data.get("compilers", {}),
|
("generation", self.generation),
|
||||||
generation=data.get("generation", 0),
|
("parents", [str(x) for x in self.parents]),
|
||||||
cpu_part=data.get("cpupart", ""),
|
]
|
||||||
)
|
if return_list_of_items:
|
||||||
|
return list_of_items
|
||||||
|
|
||||||
|
return dict(list_of_items)
|
||||||
|
|
||||||
def optimization_flags(self, compiler, version):
|
def optimization_flags(self, compiler, version):
|
||||||
"""Returns a string containing the optimization flags that needs
|
"""Returns a string containing the optimization flags that needs
|
||||||
to be used to produce code optimized for this micro-architecture.
|
to be used to produce code optimized for this micro-architecture.
|
||||||
|
|
||||||
The version is expected to be a string of dot separated digits.
|
|
||||||
|
|
||||||
If there is no information on the compiler passed as argument the
|
If there is no information on the compiler passed as argument the
|
||||||
function returns an empty string. If it is known that the compiler
|
function returns an empty string. If it is known that the compiler
|
||||||
version we want to use does not support this architecture the function
|
version we want to use does not support this architecture the function
|
||||||
@@ -235,11 +211,6 @@ def optimization_flags(self, compiler, version):
|
|||||||
Args:
|
Args:
|
||||||
compiler (str): name of the compiler to be used
|
compiler (str): name of the compiler to be used
|
||||||
version (str): version of the compiler to be used
|
version (str): version of the compiler to be used
|
||||||
|
|
||||||
Raises:
|
|
||||||
UnsupportedMicroarchitecture: if the requested compiler does not support
|
|
||||||
this micro-architecture.
|
|
||||||
ValueError: if the version doesn't match the expected format
|
|
||||||
"""
|
"""
|
||||||
# If we don't have information on compiler at all return an empty string
|
# If we don't have information on compiler at all return an empty string
|
||||||
if compiler not in self.family.compilers:
|
if compiler not in self.family.compilers:
|
||||||
@@ -256,14 +227,6 @@ def optimization_flags(self, compiler, version):
|
|||||||
msg = msg.format(compiler, best_target, best_target.family)
|
msg = msg.format(compiler, best_target, best_target.family)
|
||||||
raise UnsupportedMicroarchitecture(msg)
|
raise UnsupportedMicroarchitecture(msg)
|
||||||
|
|
||||||
# Check that the version matches the expected format
|
|
||||||
if not re.match(r"^(?:\d+\.)*\d+$", version):
|
|
||||||
msg = (
|
|
||||||
"invalid format for the compiler version argument. "
|
|
||||||
"Only dot separated digits are allowed."
|
|
||||||
)
|
|
||||||
raise InvalidCompilerVersion(msg)
|
|
||||||
|
|
||||||
# If we have information on this compiler we need to check the
|
# If we have information on this compiler we need to check the
|
||||||
# version being used
|
# version being used
|
||||||
compiler_info = self.compilers[compiler]
|
compiler_info = self.compilers[compiler]
|
||||||
@@ -308,7 +271,9 @@ def tuplify(ver):
|
|||||||
flags = flags_fmt.format(**compiler_entry)
|
flags = flags_fmt.format(**compiler_entry)
|
||||||
return flags
|
return flags
|
||||||
|
|
||||||
msg = "cannot produce optimized binary for micro-architecture '{0}' with {1}@{2}"
|
msg = (
|
||||||
|
"cannot produce optimized binary for micro-architecture '{0}' with {1}@{2}"
|
||||||
|
)
|
||||||
if compiler_info:
|
if compiler_info:
|
||||||
versions = [x["versions"] for x in compiler_info]
|
versions = [x["versions"] for x in compiler_info]
|
||||||
msg += f' [supported compiler versions are {", ".join(versions)}]'
|
msg += f' [supported compiler versions are {", ".join(versions)}]'
|
||||||
@@ -324,7 +289,9 @@ def generic_microarchitecture(name):
|
|||||||
Args:
|
Args:
|
||||||
name (str): name of the micro-architecture
|
name (str): name of the micro-architecture
|
||||||
"""
|
"""
|
||||||
return Microarchitecture(name, parents=[], vendor="generic", features=set(), compilers={})
|
return Microarchitecture(
|
||||||
|
name, parents=[], vendor="generic", features=[], compilers={}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def version_components(version):
|
def version_components(version):
|
||||||
@@ -377,10 +344,9 @@ def fill_target_from_dict(name, data, targets):
|
|||||||
features = set(values["features"])
|
features = set(values["features"])
|
||||||
compilers = values.get("compilers", {})
|
compilers = values.get("compilers", {})
|
||||||
generation = values.get("generation", 0)
|
generation = values.get("generation", 0)
|
||||||
cpu_part = values.get("cpupart", "")
|
|
||||||
|
|
||||||
targets[name] = Microarchitecture(
|
targets[name] = Microarchitecture(
|
||||||
name, parents, vendor, features, compilers, generation=generation, cpu_part=cpu_part
|
name, parents, vendor, features, compilers, generation
|
||||||
)
|
)
|
||||||
|
|
||||||
known_targets = {}
|
known_targets = {}
|
||||||
@@ -402,15 +368,7 @@ def fill_target_from_dict(name, data, targets):
|
|||||||
TARGETS = LazyDictionary(_known_microarchitectures)
|
TARGETS = LazyDictionary(_known_microarchitectures)
|
||||||
|
|
||||||
|
|
||||||
class ArchspecError(Exception):
|
class UnsupportedMicroarchitecture(ValueError):
|
||||||
"""Base class for errors within archspec"""
|
|
||||||
|
|
||||||
|
|
||||||
class UnsupportedMicroarchitecture(ArchspecError, ValueError):
|
|
||||||
"""Raised if a compiler version does not support optimization for a given
|
"""Raised if a compiler version does not support optimization for a given
|
||||||
micro-architecture.
|
micro-architecture.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class InvalidCompilerVersion(ArchspecError, ValueError):
|
|
||||||
"""Raised when an invalid format is used for compiler versions in archspec."""
|
|
||||||
|
|||||||
68
lib/spack/external/archspec/cpu/schema.py
vendored
68
lib/spack/external/archspec/cpu/schema.py
vendored
@@ -7,9 +7,7 @@
|
|||||||
"""
|
"""
|
||||||
import collections.abc
|
import collections.abc
|
||||||
import json
|
import json
|
||||||
import os
|
import os.path
|
||||||
import pathlib
|
|
||||||
from typing import Tuple
|
|
||||||
|
|
||||||
|
|
||||||
class LazyDictionary(collections.abc.MutableMapping):
|
class LazyDictionary(collections.abc.MutableMapping):
|
||||||
@@ -48,65 +46,21 @@ def __len__(self):
|
|||||||
return len(self.data)
|
return len(self.data)
|
||||||
|
|
||||||
|
|
||||||
#: Environment variable that might point to a directory with a user defined JSON file
|
def _load_json_file(json_file):
|
||||||
DIR_FROM_ENVIRONMENT = "ARCHSPEC_CPU_DIR"
|
json_dir = os.path.join(os.path.dirname(__file__), "..", "json", "cpu")
|
||||||
|
json_dir = os.path.abspath(json_dir)
|
||||||
|
|
||||||
#: Environment variable that might point to a directory with extensions to JSON files
|
def _factory():
|
||||||
EXTENSION_DIR_FROM_ENVIRONMENT = "ARCHSPEC_EXTENSION_CPU_DIR"
|
filename = os.path.join(json_dir, json_file)
|
||||||
|
with open(filename, "r", encoding="utf-8") as file:
|
||||||
|
return json.load(file)
|
||||||
|
|
||||||
|
return _factory
|
||||||
def _json_file(filename: str, allow_custom: bool = False) -> Tuple[pathlib.Path, pathlib.Path]:
|
|
||||||
"""Given a filename, returns the absolute path for the main JSON file, and an
|
|
||||||
optional absolute path for an extension JSON file.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
filename: filename for the JSON file
|
|
||||||
allow_custom: if True, allows overriding the location where the file resides
|
|
||||||
"""
|
|
||||||
json_dir = pathlib.Path(__file__).parent / ".." / "json" / "cpu"
|
|
||||||
if allow_custom and DIR_FROM_ENVIRONMENT in os.environ:
|
|
||||||
json_dir = pathlib.Path(os.environ[DIR_FROM_ENVIRONMENT])
|
|
||||||
json_dir = json_dir.absolute()
|
|
||||||
json_file = json_dir / filename
|
|
||||||
|
|
||||||
extension_file = None
|
|
||||||
if allow_custom and EXTENSION_DIR_FROM_ENVIRONMENT in os.environ:
|
|
||||||
extension_dir = pathlib.Path(os.environ[EXTENSION_DIR_FROM_ENVIRONMENT])
|
|
||||||
extension_dir.absolute()
|
|
||||||
extension_file = extension_dir / filename
|
|
||||||
|
|
||||||
return json_file, extension_file
|
|
||||||
|
|
||||||
|
|
||||||
def _load(json_file: pathlib.Path, extension_file: pathlib.Path):
|
|
||||||
with open(json_file, "r", encoding="utf-8") as file:
|
|
||||||
data = json.load(file)
|
|
||||||
|
|
||||||
if not extension_file or not extension_file.exists():
|
|
||||||
return data
|
|
||||||
|
|
||||||
with open(extension_file, "r", encoding="utf-8") as file:
|
|
||||||
extension_data = json.load(file)
|
|
||||||
|
|
||||||
top_level_sections = list(data.keys())
|
|
||||||
for key in top_level_sections:
|
|
||||||
if key not in extension_data:
|
|
||||||
continue
|
|
||||||
|
|
||||||
data[key].update(extension_data[key])
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
#: In memory representation of the data in microarchitectures.json,
|
#: In memory representation of the data in microarchitectures.json,
|
||||||
#: loaded on first access
|
#: loaded on first access
|
||||||
TARGETS_JSON = LazyDictionary(_load, *_json_file("microarchitectures.json", allow_custom=True))
|
TARGETS_JSON = LazyDictionary(_load_json_file("microarchitectures.json"))
|
||||||
|
|
||||||
#: JSON schema for microarchitectures.json, loaded on first access
|
#: JSON schema for microarchitectures.json, loaded on first access
|
||||||
TARGETS_JSON_SCHEMA = LazyDictionary(_load, *_json_file("microarchitectures_schema.json"))
|
SCHEMA = LazyDictionary(_load_json_file("microarchitectures_schema.json"))
|
||||||
|
|
||||||
#: Information on how to call 'cpuid' to get information on the HOST CPU
|
|
||||||
CPUID_JSON = LazyDictionary(_load, *_json_file("cpuid.json", allow_custom=True))
|
|
||||||
|
|
||||||
#: JSON schema for cpuid.json, loaded on first access
|
|
||||||
CPUID_JSON_SCHEMA = LazyDictionary(_load, *_json_file("cpuid_schema.json"))
|
|
||||||
|
|||||||
10
lib/spack/external/archspec/json/README.md
vendored
10
lib/spack/external/archspec/json/README.md
vendored
@@ -9,11 +9,11 @@ language specific APIs.
|
|||||||
|
|
||||||
Currently the repository contains the following JSON files:
|
Currently the repository contains the following JSON files:
|
||||||
```console
|
```console
|
||||||
cpu/
|
.
|
||||||
├── cpuid.json # Contains information on CPUID calls to retrieve vendor and features on x86_64
|
├── COPYRIGHT
|
||||||
├── cpuid_schema.json # Schema for the file above
|
└── cpu
|
||||||
├── microarchitectures.json # Contains information on CPU microarchitectures
|
├── microarchitectures.json # Contains information on CPU microarchitectures
|
||||||
└── microarchitectures_schema.json # Schema for the file above
|
└── microarchitectures_schema.json # Schema for the file above
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1050
lib/spack/external/archspec/json/cpu/cpuid.json
vendored
1050
lib/spack/external/archspec/json/cpu/cpuid.json
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,134 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
||||||
"title": "Schema for microarchitecture definitions and feature aliases",
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"vendor": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"input": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"eax": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ecx": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"highest_extension_support": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"input": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"eax": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ecx": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flags": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"input": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"eax": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ecx": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"bits": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"register": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"bit": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extension-flags": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"input": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"eax": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ecx": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"bits": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"register": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"bit": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user