Skip to content

Commit

Permalink
Encode conda CUDA support with a dictionary by release and major vers…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
bdice committed Jul 23, 2024
1 parent 269c18d commit 3a6e9a5
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions _includes/selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@
</div>
<div class="options-section" x-show="active_method === 'Conda'">
<div class="option-label">ENV. CUDA</div>
<template x-for="version in conda_cuda_vers">
<template x-for="version in conda_cuda_vers[active_release]">
<div x-on:click="(e) => condaCUDAClickHandler(e, version)"
x-bind:class="{'active': version === active_conda_cuda_ver, 'disabled': disableUnsupportedCuda(version)}"
class="option" x-text="'CUDA ' + version"></div>
class="option" x-text="'CUDA ' + conda_cuda_vers[active_release][version]['description']"></div>
</template>
</div>
<div class="options-section" x-show="active_method === 'pip'">
Expand Down Expand Up @@ -368,7 +368,7 @@
Alpine.data('rapids_selector', () => ({
// default values
active_python_ver: "3.11",
active_conda_cuda_ver: "12.0 - 12.2",
active_conda_cuda_ver: "12",
active_pip_cuda_ver: "12",
active_docker_cuda_ver: "12.2",
active_method: "Conda",
Expand All @@ -380,7 +380,31 @@

// all possible values
python_vers: ["3.9", "3.10", "3.11"],
conda_cuda_vers: ["11.4 - 11.8", "12.0 - 12.2", "12.0 - 12.5"],
// conda_cuda_vers is a dictionary structured such that
// conda_cuda_vers[release][version] gives a dictionary
// with a description and a cuda-version conda pinning.
conda_cuda_vers: {
"Stable": {
"11": {
"description": "11.4 - 11.8",
"pinning": ">=11.4.*,<=11.8.*"
},
"12": {
"description": "12.0 - 12.2",
"pinning": ">=12.0.*,<=12.2.*"
}
},
"Nightly": {
"11": {
"description": "11.4 - 11.8",
"pinning": ">=11.4.*,<=11.8.*"
},
"12": {
"description": "12.0 - 12.5",
"pinning": ">=12.0.*,<=12.5.*"
}
}
},
pip_cuda_vers: ["11.4 - 11.8", "12"],
docker_cuda_vers: ["11.8", "12.0", "12.2", "12.5"],
methods: ["Conda", "pip", "Docker"],
Expand Down Expand Up @@ -447,8 +471,7 @@
var rapids_channel = this.active_release === "Stable" ? "rapidsai" : "rapidsai-nightly";
var dask_prefix = this.active_release === "Nightly" ? "dask/label/dev::" : "";
var python_version = this.active_python_ver;
var cuda_version_bounds = this.active_conda_cuda_ver.split(" - ");
var cuda_version_pinning = ">=" + cuda_version_bounds[0] + ".*,<=" + cuda_version_bounds[1] + ".*";
var cuda_version_pinning = this.conda_cuda_vers[this.active_release][this.active_conda_cuda_ver]["pinning"];
var py_cuda_pkgs = [this.highlightPkgOrImg("python") + "=" + python_version, this.highlightPkgOrImg("cuda-version") + cuda_version_pinning].join(" ");
var conda_channels = [rapids_channel, "conda-forge", "nvidia"]
.map(ch => "-" + this.highlightFlag("c") + " " + ch + " ")
Expand Down Expand Up @@ -512,7 +535,7 @@
var cuda_suffix = "-cu12";
var indentation = " ";

if (this.active_pip_cuda_ver === "11.2 - 11.8") {
if (this.active_pip_cuda_ver === "11.4 - 11.8") {
cuda_suffix = "-cu11";
}

Expand Down Expand Up @@ -685,8 +708,6 @@
disableUnsupportedCuda(cuda_version) {
var isDisabled = false;
if (this.active_additional_packages.includes("TensorFlow") && (!cuda_version.startsWith("12"))) isDisabled = true;
// Remove once stable releases support CUDA 12.5
if (this.active_release === "Stable" && cuda_version.includes("12.5")) isDisabled = true;
return isDisabled;
},
disableUnsupportedPython(python_version) {
Expand Down Expand Up @@ -717,9 +738,6 @@
if (this.isDisabled(e.target)) return;
this.active_release = release;
// Remove once stable releases support CUDA 12.5
if (this.active_release === "Stable" && this.active_conda_cuda_ver === "12.0 - 12.5") {
this.active_conda_cuda_ver = "12.0 - 12.2";
}
if (this.active_release === "Stable" && this.active_docker_cuda_ver === "12.5") {
this.active_docker_cuda_ver = "12.2";
}
Expand Down Expand Up @@ -808,7 +826,7 @@
return;
}
this.active_additional_packages = [...this.active_additional_packages, package];
if (this.active_additional_packages.includes("TensorFlow") && (!this.active_conda_cuda_ver.includes("12.0"))) this.active_conda_cuda_ver = "12.0 - 12.2";
if (this.active_additional_packages.includes("TensorFlow") && (this.active_conda_cuda_ver !== "12")) this.active_conda_cuda_ver = "12";
},
copyToClipboard() {
let range = document.createRange();
Expand Down

0 comments on commit 3a6e9a5

Please sign in to comment.