diff --git a/_includes/quick-start-module.js b/_includes/quick-start-module.js index 345c1d0434bb..41a155bbd232 100644 --- a/_includes/quick-start-module.js +++ b/_includes/quick-start-module.js @@ -142,17 +142,43 @@ function changeVersion(ptbuild) { var elems = document.querySelectorAll('[id^="'+arch_key+'"]'); for (var i=0; i < elems.length;i++) { if(archMap[elems[i].id]) { + elems[i].style.display = ""; elems[i].style.textDecoration = ""; elems[i].children[0].textContent = info.title + " " + archMap[elems[i].id][1] + } else if (arch_key == "cuda") { + // The channel ships fewer CUDA versions than there are boxes. + elems[i].style.display = "none"; } else { elems[i].style.textDecoration = "line-through"; } } } + layoutCudaOptions(); var stable_element = document.getElementById("stable"); stable_element.children[0].textContent = stable_version; } +// The CUDA boxes share 6 of the row's 12 columns; widen them when some are +// hidden, and move the selection off a hidden box. +function layoutCudaOptions() { + var elems = Array.from(document.querySelectorAll('[id^="cuda"]')); + var visible = elems.filter(function(e) { return e.style.display != "none"; }); + if (visible.length == 0) { + return; + } + var width = "col-md-" + Math.floor(6 / visible.length); + for (var i = 0; i < elems.length; i++) { + elems[i].classList.remove("col-md-2", "col-md-3", "col-md-6"); + elems[i].classList.add(width); + } + var selected = document.getElementById(opts.cuda); + if (selected && selected.style.display == "none") { + $(cuda).removeClass("selected"); + $(visible[0]).addClass("selected"); + opts.cuda = visible[0].id; + } +} + // Change accnone name depending on OS type diff --git a/scripts/gen_quick_start_module.py b/scripts/gen_quick_start_module.py index 7654c59ecdf4..1f074da6031c 100755 --- a/scripts/gen_quick_start_module.py +++ b/scripts/gen_quick_start_module.py @@ -107,6 +107,8 @@ def get_package_type(pkg_key: str, os_key: OperatingSystem) -> str: def get_gpu_info(acc_key, instr, acc_arch_map): + if acc_key not in acc_arch_map: + return (None, None) gpu_arch_type, gpu_arch_version = acc_arch_map[acc_key] if DEFAULT in instr: gpu_arch_type, gpu_arch_version = acc_arch_map["accnone"] @@ -146,6 +148,23 @@ def update_versions(versions, release_matrix, release_version): == (package_type, gpu_arch_type, gpu_arch_version) ] + if gpu_arch_type is None: + continue + + # A CUDA version the channel ships but this OS does not (e.g. no + # Windows build): say so instead of keeping a stale command. + if gpu_arch_type == "cuda": + if pkg_arch_matrix: + instr["note"] = None + if package_type == "libtorch" and instr.get("versions") is None: + instr["versions"] = {} + else: + instr["note"] = ( + f"NOTE: CUDA {gpu_arch_version} is not available " + f"on {os_key.capitalize()}" + ) + instr["command" if package_type != "libtorch" else "versions"] = None + if pkg_arch_matrix: if package_type != "libtorch": instr["command"] = pkg_arch_matrix[0]["installation"] @@ -236,8 +255,13 @@ def gen_ver_list(chan, gpu_arch_type): rocm_ver_list = gen_ver_list(chan, "rocm") cuda_list = sorted(cuda_ver_list.values()) acc_arch_ver_map[chan]["rocm5.x"] = ("rocm", max(rocm_ver_list.values())) - for cuda_ver, label in zip(cuda_list, ["cuda.x", "cuda.y", "cuda.z"]): + cuda_labels = ["cuda.x", "cuda.y", "cuda.z"] + for cuda_ver, label in zip(cuda_list, cuda_labels): acc_arch_ver_map[chan][label] = ("cuda", cuda_ver) + # Drop labels the channel has no CUDA version for, so the page strikes + # them out instead of showing the hard-coded defaults. + for label in cuda_labels[len(cuda_list):]: + acc_arch_ver_map[chan].pop(label, None) def main():