Skip to content

Commit fe1c2c6

Browse files
committed
test
test Refactor quick start module code
1 parent fdf8d1a commit fe1c2c6

9 files changed

+157
-599
lines changed

.github/workflows/check-quickstartmodule.yml

Lines changed: 0 additions & 110 deletions
This file was deleted.

.github/workflows/update-quick-start-module.yml

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,53 @@
11
name: Update quick start module
22
on:
3-
workflow_dispatch:
4-
inputs:
5-
channel:
6-
description: "Channel to use (nightly, test, release)"
7-
required: true
8-
type: choice
9-
options:
10-
- release
11-
- nightly
12-
- test
13-
version:
14-
description: "Version to update"
15-
required: false
16-
type: string
17-
3+
pull_request:
4+
paths:
5+
- .github/workflows/update-quick-start-module.yml
6+
- /scripts/gen_quick_start_module.py
187
jobs:
19-
validate-binaries:
20-
uses: pytorch/builder/.github/workflows/validate-binaries.yml@main
8+
linux-nightly-matrix:
9+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
2110
with:
22-
os: all
23-
channel: ${{ inputs.channel }}
24-
linux-matrix:
25-
needs: [validate-binaries]
11+
package-type: all
12+
os: linux
13+
channel: "nightly"
14+
windows-nightly-matrix:
15+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
16+
with:
17+
package-type: all
18+
os: windows
19+
channel: "nightly"
20+
macos-nightly-matrix:
21+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
22+
with:
23+
package-type: all
24+
os: macos
25+
channel: "nightly"
26+
linux-release-matrix:
27+
needs: [linux-nightly-matrix]
2628
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
2729
with:
2830
package-type: all
2931
os: linux
30-
channel: ${{ inputs.channel }}
31-
windows-matrix:
32-
needs: [validate-binaries]
32+
channel: "release"
33+
windows-release-matrix:
34+
needs: [windows-nightly-matrix]
3335
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
3436
with:
3537
package-type: all
3638
os: windows
37-
channel: ${{ inputs.channel }}
38-
macos-matrix:
39-
needs: [validate-binaries]
39+
channel: "release"
40+
macos-release-matrix:
41+
needs: [macos-nightly-matrix]
4042
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
4143
with:
4244
package-type: all
4345
os: macos
44-
channel: ${{ inputs.channel }}
46+
channel: "release"
4547

4648
generate-json-file:
47-
needs: [linux-matrix, windows-matrix, macos-matrix]
49+
needs: [linux-nightly-matrix, windows-nightly-matrix, macos-nightly-matrix,
50+
linux-release-matrix, windows-release-matrix, macos-release-matrix]
4851
runs-on: "ubuntu-18.04"
4952
steps:
5053
- name: Checkout builder
@@ -57,21 +60,21 @@ jobs:
5760
- name: Create json file
5861
shell: bash
5962
env:
60-
LINUX_MATRIX: ${{ needs.linux-matrix.outputs.matrix }}
61-
WINDOWS_MATRIX: ${{ needs.windows-matrix.outputs.matrix }}
62-
MACOS_MATRIX: ${{ needs.macos-matrix.outputs.matrix }}
63-
VERSION: ${{ inputs.version }}
63+
LINUX_NIGHTLY_MATRIX: ${{ needs.linux-nightly-matrix.outputs.matrix }}
64+
WINDOWS_NIGHTLY_MATRIX: ${{ needs.windows-nightly-matrix.outputs.matrix }}
65+
MACOS_NIGHTLY_MATRIX: ${{ needs.macos-nightly-matrix.outputs.matrix }}
66+
LINUX_RELEASE_MATRIX: ${{ needs.linux-release-matrix.outputs.matrix }}
67+
WINDOWS_RELEASE_MATRIX: ${{ needs.windows-release-matrix.outputs.matrix }}
68+
MACOS_RELEASE_MATRIX: ${{ needs.macos-release-matrix.outputs.matrix }}
6469
run: |
6570
set -ex
66-
printf '%s\n' "$LINUX_MATRIX" > linux_matrix.json
67-
printf '%s\n' "$WINDOWS_MATRIX" > windows_matrix.json
68-
printf '%s\n' "$MACOS_MATRIX" > macos_matrix.json
69-
if [ -z "${VERSION}" ]; then
70-
python3 ./scripts/gen_quick_start_module.py --autogenerate enable
71-
else
72-
python3 ./scripts/gen_quick_start_module.py --autogenerate enable --version "${VERSION}"
73-
fi
74-
71+
printf '%s\n' "$LINUX_NIGHTLY_MATRIX" > linux_nightly_matrix.json
72+
printf '%s\n' "$WINDOWS_NIGHTLY_MATRIX" > windows_nightly_matrix.json
73+
printf '%s\n' "$MACOS_NIGHTLY_MATRIX" > macos_nightly_matrix.json
74+
printf '%s\n' "$LINUX_RELEASE_MATRIX" > linux_release_matrix.json
75+
printf '%s\n' "$WINDOWS_RELEASE_MATRIX" > windows_release_matrix.json
76+
printf '%s\n' "$MACOS_RELEASE_MATRIX" > macos_release_matrix.json
77+
python3 ./scripts/gen_quick_start_module.py --autogenerate enable > assets/quick-start-module.js
7578
rm *_matrix.json
7679
- name: Create Pull Request
7780
uses: peter-evans/create-pull-request@v3

_includes/quick-start-module.js

Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ var supportedOperatingSystems = new Map([
55
['win', 'windows'],
66
]);
77

8-
var supportedComputePlatforms = new Map([
9-
['cuda.x', new Set(['linux', 'windows'])],
10-
['cuda.y', new Set(['linux', 'windows'])],
11-
['rocm5.x', new Set(['linux'])],
12-
['accnone', new Set(['linux', 'macos', 'windows'])],
8+
var archInfoMap = new Map([
9+
['cuda', {title: "CUDA", platforms: new Set(['linux', 'windows'])}],
10+
['rocm', {title: "ROCm", platforms: new Set(['linux'])}],
11+
['accnone', {title: "CPU", platforms: new Set(['linux', 'macos', 'windows'])}]
1312
]);
1413

14+
let version_map={{ ACC ARCH MAP }}
15+
let stable_version={{ VERSION }};
16+
1517
var default_selected_os = getAnchorSelectedOS() || getDefaultSelectedOS();
1618
var opts = {
1719
cuda: getPreferredCuda(default_selected_os),
@@ -103,53 +105,39 @@ function getPreferredCuda(os) {
103105

104106
// Disable compute platform not supported on OS
105107
function disableUnsupportedPlatforms(os) {
106-
supportedComputePlatforms.forEach( (oses, platform, arr) => {
107-
var element = document.getElementById(platform);
108-
if (element == null) {
109-
console.log("Failed to find element for platform " + platform);
108+
for (const [arch_key, info] of archInfoMap) {
109+
var elems = document.querySelectorAll('[id^="'+arch_key+'"]');
110+
if (elems == null) {
111+
console.log("Failed to find element for architecture " + arch_key);
110112
return;
111113
}
112-
var supported = oses.has(os);
113-
element.style.textDecoration = supported ? "" : "line-through";
114-
});
114+
for (var i=0; i < elems.length;i++) {
115+
var supported = info.platforms.has(os);
116+
elems[i].style.textDecoration = supported ? "" : "line-through";
117+
}
118+
}
115119
}
116120

117121
// Change compute versions depending on build type
118-
function changeCUDAVersion(ptbuild) {
119-
var cuda_element_x = document.getElementById("cuda.x");
120-
var cuda_element_y = document.getElementById("cuda.y");
121-
var rocm_element = document.getElementById("rocm5.x");
122-
if (cuda_element_x == null || cuda_element_y == null) {
123-
console.log("Failed to find cuda11 elements");
124-
return;
125-
}
126-
if (cuda_element_x.childElementCount != 1 || cuda_element_y.childElementCount != 1) {
127-
console.log("Unexpected number of children for cuda11 element");
128-
return;
129-
}
130-
if (rocm_element == null) {
131-
console.log("Failed to find rocm5.x element");
132-
return;
133-
}
134-
if (rocm_element.childElementCount != 1) {
135-
console.log("Unexpected number of children for rocm5.x element");
136-
return;
137-
}
138-
if (ptbuild == "preview") {
139-
rocm_element.children[0].textContent = "ROCm 5.2";
140-
cuda_element_x.children[0].textContent = "CUDA 11.6";
141-
cuda_element_y.children[0].textContent = "CUDA 11.7";
142-
} else if (ptbuild == "stable") {
143-
rocm_element.children[0].textContent = "ROCm 5.2";
144-
cuda_element_x.children[0].textContent = "CUDA 11.6";
145-
cuda_element_y.children[0].textContent = "CUDA 11.7";
146-
} else {
147-
rocm_element.children[0].textContent = "ROCm 5.2";
148-
cuda_element_x.children[0].textContent = "CUDA 10.2";
149-
cuda_element_y.children[0].textContent = "CUDA 11.1";
122+
function changeVersion(ptbuild) {
123+
124+
if(ptbuild == "preview")
125+
archMap = version_map.nightly
126+
else
127+
archMap = version_map.release
128+
129+
for (const [arch_key, info] of archInfoMap) {
130+
var elems = document.querySelectorAll('[id^="'+arch_key+'"]');
131+
for (var i=0; i < elems.length;i++) {
132+
elems[i].children[0].textContent = info.title + " " + archMap[elems[i].id][1]
133+
}
150134
}
135+
var stable_element = document.getElementById("stable");
136+
stable_element.children[0].textContent = stable_version;
151137
}
152138

139+
140+
153141
// Change accnone name depending on OS type
154142
function changeAccNoneName(osname) {
155143
var accnone_element = document.getElementById("accnone");
@@ -201,7 +189,7 @@ function selectedOption(option, selection, category) {
201189
}
202190
}
203191
} else if (category == "ptbuild") {
204-
changeCUDAVersion(opts.ptbuild);
192+
changeVersion(opts.ptbuild);
205193
}
206194
commandMessage(buildMatcher());
207195
if (category === "os") {
@@ -272,3 +260,6 @@ function commandMessage(key) {
272260
$("#command").html("<pre>" + object[key] + "</pre>");
273261
}
274262
}
263+
264+
// Set cuda version right away
265+
changeVersion("stable")

_includes/quick_start_local.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<div class="option-text">PyTorch Build</div>
3434
</div>
3535
<div class="col-md-6 option block version selected" id="stable">
36-
<div class="option-text">Stable (1.13.0)</div>
36+
<div class="option-text">Stable (X.XX.X)</div>
3737
</div>
3838
<div class="col-md-6 option block version" id="preview">
3939
<div class="option-text">Preview (Nightly)</div>
@@ -86,13 +86,13 @@
8686
<div class="option-text">Compute Platform</div>
8787
</div>
8888
<div class="col-md-3 option block version" id="cuda.x">
89-
<div class="option-text">CUDA 11.6</div>
89+
<div class="option-text">CUDA 11.x</div>
9090
</div>
9191
<div class="col-md-3 option block version" id="cuda.y">
92-
<div class="option-text">CUDA 11.7</div>
92+
<div class="option-text">CUDA 11.y</div>
9393
</div>
9494
<div class="col-md-3 option block version" id="rocm5.x">
95-
<div class="option-text">ROCm 5.2</div>
95+
<div class="option-text">ROCm 5.x</div>
9696
</div>
9797
<div class="col-md-3 option block version" id="accnone">
9898
<div class="option-text">CPU</div>

0 commit comments

Comments
 (0)