@@ -5,13 +5,15 @@ var supportedOperatingSystems = new Map([
5
5
[ 'win' , 'windows' ] ,
6
6
] ) ;
7
7
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' ] ) } ]
13
12
] ) ;
14
13
14
+ let version_map = { { ACC ARCH MAP } }
15
+ let stable_version = { { VERSION } } ;
16
+
15
17
var default_selected_os = getAnchorSelectedOS ( ) || getDefaultSelectedOS ( ) ;
16
18
var opts = {
17
19
cuda : getPreferredCuda ( default_selected_os ) ,
@@ -103,53 +105,39 @@ function getPreferredCuda(os) {
103
105
104
106
// Disable compute platform not supported on OS
105
107
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 ) ;
110
112
return ;
111
113
}
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
+ }
115
119
}
116
120
117
121
// 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
+ }
150
134
}
135
+ var stable_element = document . getElementById ( "stable" ) ;
136
+ stable_element . children [ 0 ] . textContent = stable_version ;
151
137
}
152
138
139
+
140
+
153
141
// Change accnone name depending on OS type
154
142
function changeAccNoneName ( osname ) {
155
143
var accnone_element = document . getElementById ( "accnone" ) ;
@@ -201,7 +189,7 @@ function selectedOption(option, selection, category) {
201
189
}
202
190
}
203
191
} else if ( category == "ptbuild" ) {
204
- changeCUDAVersion ( opts . ptbuild ) ;
192
+ changeVersion ( opts . ptbuild ) ;
205
193
}
206
194
commandMessage ( buildMatcher ( ) ) ;
207
195
if ( category === "os" ) {
@@ -272,3 +260,6 @@ function commandMessage(key) {
272
260
$ ( "#command" ) . html ( "<pre>" + object [ key ] + "</pre>" ) ;
273
261
}
274
262
}
263
+
264
+ // Set cuda version right away
265
+ changeVersion ( "stable" )
0 commit comments