Skip to content

Commit 0df4909

Browse files
rwgkcursoragent
andcommitted
toolshed: modernize conda_create_for_pathfinder_testing scripts
Bring the bash and PowerShell helpers used to spin up CUDA-pathfinder test environments into line with how cuda_pathfinder/pyproject.toml is now organized, and harden them so common shell mistakes surface immediately. Highlights: - Add ``set -euo pipefail`` (bash) and ``Set-StrictMode -Version Latest`` (PowerShell) so unset variables and non-zero exit codes fail loudly. - Pick the Python version from the CUDA major: ``12.x`` -> 3.12, ``13.x`` -> 3.14. Reject other CUDA majors with a clear error instead of silently installing 3.13. - Bash: wrap ``conda activate`` and ``conda install`` in ``set +u`` / ``set -u`` because conda's shims dereference unset variables, which otherwise abort the script under ``set -u``. - Realign the conda package lists with the platform-scoped groups in ``cuda_pathfinder/pyproject.toml``: - Add ``cutlass`` (Linux + Windows) and ``libcusolvermp-dev`` (Linux). - Drop ``libnvpl-fft-dev`` from the unconditional Linux list and from Windows entirely. - On Linux, install ``libnvpl-fft-dev`` only on ``aarch64`` and add ``libcudla-dev`` for the ``cu13``/``aarch64`` combination. - Drop ``libcublasmp-dev``, ``libcufftmp-dev``, ``libnvshmem3``, and ``libnvshmem-dev`` from the Windows list to match what ``pyproject`` installs there. - Refresh SPDX copyright to ``2025-2026``. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 64e2e6a commit 0df4909

2 files changed

Lines changed: 67 additions & 22 deletions

File tree

toolshed/conda_create_for_pathfinder_testing.ps1

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION
22
# SPDX-License-Identifier: Apache-2.0
33

44
param(
@@ -7,22 +7,30 @@ param(
77
)
88

99
$ErrorActionPreference = "Stop"
10+
Set-StrictMode -Version Latest
11+
12+
$cudaMajor = $CudaVersion.Split(".", 2)[0]
13+
switch ($cudaMajor) {
14+
"12" { $pythonVersion = "3.12" }
15+
"13" { $pythonVersion = "3.14" }
16+
default {
17+
throw "Unsupported CUDA major version for this helper: $cudaMajor. Expected a 12.x or 13.x toolkit version."
18+
}
19+
}
1020

1121
& "$env:CONDA_EXE" "shell.powershell" "hook" | Out-String | Invoke-Expression
1222

13-
conda create --yes -n "pathfinder_testing_cu$CudaVersion" python=3.13 "cuda-toolkit=$CudaVersion"
23+
conda create --yes -n "pathfinder_testing_cu$CudaVersion" "python=$pythonVersion" "cuda-toolkit=$CudaVersion"
1424
conda activate "pathfinder_testing_cu$CudaVersion"
1525

26+
# Keep this list aligned with the Windows-installable subset of
27+
# cuda_pathfinder/pyproject.toml.
1628
$cpkgs = @(
1729
"cusparselt-dev",
1830
"cutensor",
19-
"libcublasmp-dev",
31+
"cutlass",
2032
"libcudss-dev",
21-
"libcufftmp-dev",
22-
"libmathdx-dev",
23-
"libnvshmem3",
24-
"libnvshmem-dev",
25-
"libnvpl-fft-dev"
33+
"libmathdx-dev"
2634
)
2735

2836
foreach ($cpkg in $cpkgs) {
Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,65 @@
11
#!/bin/bash
22

3-
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
# SPDX-License-Identifier: Apache-2.0
55

6+
set -euo pipefail
7+
68
if [[ $# -ne 1 ]]; then
79
echo "Usage: $(basename "$0") ctk-major-minor-patch" 1>&2
810
exit 1
911
fi
1012

13+
cuda_version="$1"
14+
cuda_major="${cuda_version%%.*}"
15+
uname_m="$(uname -m)"
16+
case "$cuda_major" in
17+
12)
18+
python_version=3.12
19+
;;
20+
13)
21+
python_version=3.14
22+
;;
23+
*)
24+
echo "Unsupported CUDA major version for this helper: $cuda_major" 1>&2
25+
echo "Expected a 12.x or 13.x toolkit version." 1>&2
26+
exit 1
27+
;;
28+
esac
29+
1130
eval "$(conda shell.bash hook)"
1231

13-
conda create --yes -n "pathfinder_testing_cu$1" python=3.13 cuda-toolkit="$1"
14-
conda activate "pathfinder_testing_cu$1"
15-
16-
for cpkg in \
17-
cusparselt-dev \
18-
cutensor \
19-
libcublasmp-dev \
20-
libcudss-dev \
21-
libcufftmp-dev \
22-
libmathdx-dev \
23-
libnvshmem3 \
24-
libnvshmem-dev \
25-
libnvpl-fft-dev; do
32+
conda create --yes -n "pathfinder_testing_cu$cuda_version" "python=$python_version" cuda-toolkit="$cuda_version"
33+
set +u
34+
conda activate "pathfinder_testing_cu$cuda_version"
35+
set -u
36+
37+
# Keep this list aligned with the Linux-installable subset of
38+
# cuda_pathfinder/pyproject.toml.
39+
cpkgs=(
40+
"cusparselt-dev"
41+
"cutensor"
42+
"cutlass"
43+
"libcublasmp-dev"
44+
"libcudss-dev"
45+
"libcufftmp-dev"
46+
"libcusolvermp-dev"
47+
"libmathdx-dev"
48+
"libnvshmem3"
49+
"libnvshmem-dev"
50+
)
51+
52+
# Keep the conda environment aligned with platform-scoped pyproject groups.
53+
if [[ "$uname_m" == "aarch64" ]]; then
54+
cpkgs+=("libnvpl-fft-dev")
55+
if [[ "$cuda_major" == "13" ]]; then
56+
cpkgs+=("libcudla-dev")
57+
fi
58+
fi
59+
60+
for cpkg in "${cpkgs[@]}"; do
2661
echo "CONDA INSTALL: $cpkg"
62+
set +u
2763
conda install -y -c conda-forge "$cpkg"
64+
set -u
2865
done

0 commit comments

Comments
 (0)