Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CUDA version ranges in release selector. #524

Merged
merged 17 commits into from
Jul 24, 2024
72 changes: 52 additions & 20 deletions _includes/selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@
</div>
</template>
</div>
<div class="options-section" x-show="active_method !== 'pip'">
<div class="options-section" x-show="active_method === 'Conda'">
<div class="option-label">ENV. CUDA</div>
<template x-for="version in cuda_vers">
<div x-on:click="(e) => cudaClickHandler(e, version)"
x-bind:class="{'active': version === active_cuda_ver, 'disabled': disableUnsupportedCuda(version)}"
class="option" x-text="'CUDA ' + version"></div>
<template x-for="version in conda_cuda_vers">
<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 ' + getCondaVersionSupport(version)['label']"></div>
</template>
</div>
<div class="options-section" x-show="active_method === 'pip'">
Expand All @@ -260,6 +260,14 @@
x-text="'CUDA ' + version"></div>
</template>
</div>
<div class="options-section" x-show="active_method === 'Docker'">
<div class="option-label">Image CUDA</div>
<template x-for="version in docker_cuda_vers">
<div x-on:click="(e) => dockerCUDAClickHandler(e, version)"
x-bind:class="{'active': version === active_docker_cuda_ver, 'disabled': disableUnsupportedCuda(version)}"
class="option" x-text="'CUDA ' + version"></div>
</template>
</div>
<div class="options-section" x-show="active_method !== 'pip'">
<div class="option-label">Python</div>
<template x-for="version in python_vers">
Expand Down Expand Up @@ -360,8 +368,9 @@
Alpine.data('rapids_selector', () => ({
// default values
active_python_ver: "3.11",
active_cuda_ver: "12.2",
active_conda_cuda_ver: "12",
active_pip_cuda_ver: "12",
active_docker_cuda_ver: "12.2",
active_method: "Conda",
active_release: "Stable",
active_img_type: "Base",
Expand All @@ -371,8 +380,9 @@

// all possible values
python_vers: ["3.9", "3.10", "3.11"],
cuda_vers: ["11.2", "11.8", "12.0", "12.2", "12.5"],
pip_cuda_vers: ["11.2 - 11.8", "12"],
conda_cuda_vers: ["11", "12"],
pip_cuda_vers: ["11.4 - 11.8", "12"],
docker_cuda_vers: ["11.8", "12.0", "12.2", "12.5"],
methods: ["Conda", "pip", "Docker"],
releases: ["Stable", "Nightly"],
img_loc: ["NGC", "Dockerhub"],
Expand Down Expand Up @@ -424,6 +434,25 @@
}
return pkg_components[0] + channel_pkg_separator + this.highlightPkgOrImg(pkg_components[1]);
},
getCondaVersionSupport(version) {
var cuda_version_info = {
"Stable": {
"11": ["11.4", "11.8"],
"12": ["12.0", "12.2"]
},
"Nightly": {
"11": ["11.4", "11.8"],
"12": ["12.0", "12.5"]
}
};
Comment on lines +438 to +447
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if we can collect this info next to the "all possible values" section. That way there would be one place to change all of the versions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggled with this. I don't know why, but I couldn't get the JavaScript to work happily when I did that. See my attempt here (I force-pushed it out of the history for this PR since it wasn't going well): 3a6e9a5

var bounds = cuda_version_info[this.active_release][version];
var lower_bound = bounds[0];
var upper_bound = bounds[1];
return {
"label": lower_bound + " - " + upper_bound,
"pinning": ">=" + lower_bound + ",<=" + upper_bound
};
},
getAdditionalPkgName(pkg) {
var dask_prefix = this.active_release === "Nightly" ? "dask/label/dev::" : "";
var pkg_names = {
Expand All @@ -437,8 +466,8 @@
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 = this.active_cuda_ver;
var py_cuda_pkgs = [this.highlightPkgOrImg("python") + "=" + python_version, this.highlightPkgOrImg("cuda-version") + "=" + cuda_version].join(" ");
var cuda_version_pinning = this.getCondaVersionSupport(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 + " ")
.join("");
Expand Down Expand Up @@ -501,7 +530,7 @@
var cuda_suffix = "-cu12";
var indentation = " ";

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

Expand Down Expand Up @@ -583,7 +612,7 @@

var imgTag = [
(isNightly ? this.getNightlyVersion() + "a" : this.getStableVersion()),
"cuda" + this.active_cuda_ver,
"cuda" + this.active_docker_cuda_ver,
"py" + this.active_python_ver
].join("-");

Expand All @@ -603,7 +632,7 @@
},
getDockerNotes() {
var notes = [];
if (this.active_cuda_ver.startsWith("12") && this.active_release === "Stable") {
if (this.active_docker_cuda_ver.startsWith("12") && this.active_release === "Stable") {
var pkgs_html = this.rapids_meta_pkgs.map(pkg => "<code>" + pkg + "</code>").join(", ");
notes = [...notes]
} else {
Expand Down Expand Up @@ -673,8 +702,7 @@
},
disableUnsupportedCuda(cuda_version) {
var isDisabled = false;
if (this.active_additional_packages.includes("TensorFlow") && (cuda_version !== "12.0")) isDisabled = true;
if (this.active_method === "Docker" && cuda_version < "11.8") isDisabled = true;
if (this.active_additional_packages.includes("TensorFlow") && (!cuda_version.startsWith("12"))) isDisabled = true;
if (this.active_release === "Stable" && cuda_version === "12.5") isDisabled = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if we could use a variable for 12.5 here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we leave this for a later PR? I think this ties in with the above thread, where I struggled to get a "structured" JSON format to work.

return isDisabled;
},
Expand Down Expand Up @@ -705,22 +733,26 @@
releaseClickHandler(e, release) {
if (this.isDisabled(e.target)) return;
this.active_release = release;
if ( this.active_release === "Stable" && this.active_cuda_ver === "12.5") {
this.active_cuda_ver = "12.2";
if (this.active_release === "Stable" && this.active_docker_cuda_ver === "12.5") {
this.active_docker_cuda_ver = "12.2";
}
Comment on lines +736 to 738
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about capturing 12.5 & 12.2 in variables in the "all possible values" section?

Perhaps we could do something like...?

Suggested change
if (this.active_release === "Stable" && this.active_docker_cuda_ver === "12.5") {
this.active_docker_cuda_ver = "12.2";
}
if (this.active_release === "Stable" && this.active_docker_cuda_ver === this.nightly_docker_cuda_ver) {
this.active_docker_cuda_ver = this.stable_docker_cuda_ver;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we leave this for a later PR? I think this ties in with the above thread, where I struggled to get a "structured" JSON format to work.

},
imgTypeClickHandler(e, type) {
if (this.isDisabled(e.target)) return;
this.active_img_type = type;
},
cudaClickHandler(e, version) {
condaCUDAClickHandler(e, version) {
if (this.isDisabled(e.target)) return;
this.active_cuda_ver = version;
this.active_conda_cuda_ver = version;
},
pipCUDAClickHandler(e, version) {
if (this.isDisabled(e.target)) return;
this.active_pip_cuda_ver = version;
},
dockerCUDAClickHandler(e, version) {
if (this.isDisabled(e.target)) return;
this.active_docker_cuda_ver = version;
},
pythonClickHandler(e, version) {
if (this.isDisabled(e.target)) return;
this.active_python_ver = version;
Expand Down Expand Up @@ -789,7 +821,7 @@
return;
}
this.active_additional_packages = [...this.active_additional_packages, package];
if (this.active_additional_packages.includes("TensorFlow") && (this.active_cuda_ver !== "12.0")) this.active_cuda_ver = "12.0";
if (this.active_additional_packages.includes("TensorFlow") && this.active_conda_cuda_ver !== "12") this.active_conda_cuda_ver = "12";
bdice marked this conversation as resolved.
Show resolved Hide resolved
},
copyToClipboard() {
let range = document.createRange();
Expand Down