Skip to content

Commit e9c703f

Browse files
committed
Re-add nvidia-cudnn-cu12 9.1.0.70 to the mirrored cudnn index
Add a RETAINED_WHEELS mechanism to re-inject wheels we still host that the upstream simple index has stopped publishing, and use it for nvidia-cudnn-cu12 9.1.0.70 on the root, cu121 and cu124 indexes across nightly, test and prod.
1 parent a339e80 commit e9c703f

1 file changed

Lines changed: 71 additions & 1 deletion

File tree

s3_management/update_dependencies.py

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import re
33
import time
4-
from typing import Dict, List
4+
from typing import Dict, List, NamedTuple
55
from urllib.parse import urljoin
66

77
import boto3 # type: ignore[import-untyped]
@@ -227,6 +227,14 @@
227227
{
228228
"project": "torch",
229229
},
230+
{
231+
"project": "torch",
232+
"target": "cu121",
233+
},
234+
{
235+
"project": "torch",
236+
"target": "cu124",
237+
},
230238
{
231239
"project": "torch",
232240
"target": "cu126",
@@ -919,6 +927,32 @@
919927
}
920928

921929

930+
class RetainedWheel(NamedTuple):
931+
filename: str
932+
url: str
933+
sha256: str
934+
targets: tuple[str, ...]
935+
936+
937+
# Wheels that download.pytorch.org still hosts but the upstream simple index has
938+
# stopped publishing, so mirroring alone drops them and pinned installs stop
939+
# resolving. Keyed by normalised package name; injected into the index for the
940+
# listed targets ("" is the channel root) on nightly, test and prod.
941+
RETAINED_WHEELS: Dict[str, List[RetainedWheel]] = {
942+
"nvidia_cudnn_cu12": [
943+
RetainedWheel(
944+
filename="nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl",
945+
url=(
946+
"https://download.pytorch.org/whl/cu124/"
947+
"nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl"
948+
),
949+
sha256="165764f44ef8c61fcdfdfdbe769d687e06374059fbb388b6c89ecb0e28793a6f",
950+
targets=("", "cu121", "cu124"),
951+
),
952+
],
953+
}
954+
955+
922956
def is_nvidia_package(pkg_name: str) -> bool:
923957
"""Check if a package is from NVIDIA and is therefore CUDA-target only"""
924958
return pkg_name.startswith("nvidia-") or pkg_name.startswith("cuda-")
@@ -1136,6 +1170,39 @@ def append_preview_numpy_wheels(html: str, pkg_name: str, prefix: str) -> str:
11361170
return f"{html}\n{block}\n"
11371171

11381172

1173+
def append_retained_wheels(html: str, pkg_name: str, prefix: str) -> str:
1174+
"""Merge :data:`RETAINED_WHEELS` links for *pkg_name* into *html*.
1175+
1176+
The target is the last segment of *prefix* ("whl/nightly/cu124" -> "cu124",
1177+
"whl/nightly" -> ""). Wheels the upstream index still lists are skipped, so
1178+
this becomes a no-op if a version is ever restored upstream.
1179+
"""
1180+
entries = RETAINED_WHEELS.get(normalize_pkg_name(pkg_name))
1181+
if not entries:
1182+
return html
1183+
1184+
last_segment = prefix.rsplit("/", 1)[-1]
1185+
target = last_segment if is_valid_target(last_segment) else ""
1186+
1187+
additions = [
1188+
f' <a href="{entry.url}#sha256={entry.sha256}">{entry.filename}</a><br/>'
1189+
for entry in entries
1190+
if target in entry.targets and entry.filename not in html
1191+
]
1192+
1193+
if not additions:
1194+
return html
1195+
1196+
print(
1197+
f"INFO: Merging {len(additions)} retained wheel link(s) "
1198+
f"for {pkg_name} under {prefix}"
1199+
)
1200+
block = "\n".join(additions)
1201+
if "</body>" in html:
1202+
return html.replace("</body>", f"{block}\n </body>", 1)
1203+
return f"{html}\n{block}\n"
1204+
1205+
11391206
def upload_package_using_simple_index(
11401207
pkg_name: str,
11411208
prefix: str,
@@ -1168,6 +1235,9 @@ def upload_package_using_simple_index(
11681235
# published on the scientific-python nightly wheelhouse so pip can resolve them.
11691236
raw_html = append_preview_numpy_wheels(raw_html, pkg_name, prefix)
11701237

1238+
# Re-add wheels we still host that upstream has stopped publishing.
1239+
raw_html = append_retained_wheels(raw_html, pkg_name, prefix)
1240+
11711241
# Upload modified index.html with absolute links
11721242
upload_index_html(pkg_name, prefix, raw_html, source_url, dry_run=dry_run)
11731243

0 commit comments

Comments
 (0)