@@ -11,22 +11,32 @@ def initialize(page_name, site)
11
11
12
12
def generate_content ( _options )
13
13
has_reservable_disks = false
14
+ has_unsupported_gpu = false
14
15
G5K ::get_global_hash [ 'sites' ] [ @site ] [ 'clusters' ] . each do |_ , c |
15
16
c [ 'nodes' ] . each do |_ , n |
16
17
n [ 'storage_devices' ] . each do |d |
17
18
has_reservable_disks ||= d [ 'reservation' ]
18
19
end
20
+
21
+ if ! n [ 'gpu_devices' ] . nil?
22
+ has_unsupported_gpu ||= n [ 'gpu_devices' ] . map { |_ , g | g [ 'model' ] } . uniq
23
+ . map { |gpu_model | GPURef . is_gpu_supported? ( gpu_model ) } . reduce ( :& )
24
+ end
19
25
end
20
26
end
21
27
28
+ asterisks = [ ]
29
+ asterisks << "''*: disk is [[Disk_reservation|reservable]]''" if has_reservable_disks
30
+ asterisks << "''**: crossed GPUs are not supported by Grid'5000 default environments''" if has_unsupported_gpu
31
+
22
32
@generated_content = "__NOTOC__\n __NOEDITSECTION__\n " +
23
33
"{{Portal|User}}\n " +
24
34
"<div class=\" sitelink\" >Hardware: [[Hardware|Global]] | " + G5K ::SITES . map { |e | "[[#{ e . capitalize } :Hardware|#{ e . capitalize } ]]" } . join ( " | " ) + "</div>\n " +
25
35
"'''See also:''' [[#{ @site . capitalize } :Network|Network topology for #{ @site . capitalize } ]]\n " +
26
36
"#{ SiteHardwareGenerator . generate_header_summary ( { @site => G5K ::get_global_hash [ 'sites' ] [ @site ] } ) } \n " +
27
37
"= Clusters =\n " +
28
38
self . class . generate_summary ( @site , false ) +
29
- ( has_reservable_disks ? "''*: disk is [[Disk_reservation|reservable]]''" : '' ) +
39
+ asterisks . join ( " \n \n " ) +
30
40
self . class . generate_description ( @site ) +
31
41
MW . italic ( MW . small ( generated_date_string ) ) +
32
42
MW ::LINE_FEED
@@ -302,39 +312,35 @@ def sort_data(data, key)
302
312
303
313
def gpu_description ( node_hash , long_names )
304
314
lgpu = node_hash [ 'gpu_devices' ]
315
+ res = [ ]
305
316
if lgpu
306
- bymodel = { }
307
- memgib = ( node_hash [ 'gpu_devices' ] . first ( ) [ 1 ] [ 'memory' ] . to_f /2 **30 ) . round ( 0 )
308
- lgpu . each { |g |
309
- d = g [ 1 ]
310
- vendor = d [ 'vendor' ]
311
- if long_names
312
- model = d [ 'model' ]
313
- else
314
- model = GPURef . model2shortname ( d [ 'model' ] )
315
- end
316
- vm = vendor . to_s + ' ' + model . to_s . gsub ( ' ' , ' ' ) + " (#{ memgib } GiB)"
317
- if long_names
318
- cc = GPURef . get_compute_capability ( d [ 'model' ] )
319
- vm += "<br>Compute capability: #{ cc } " if cc
320
- end
317
+ gpu_types = lgpu . values . group_by { |device_hash | device_hash [ 'model' ] } . map do |model_name , device_hashes |
318
+ description = gpu_model_description ( device_hashes . first , long_names )
319
+ [ model_name , { number : device_hashes . length , description : description } ]
320
+ end . to_h
321
321
322
- if bymodel [ vm ]
323
- bymodel [ vm ] += 1
324
- else
325
- bymodel [ vm ] = 1
326
- end
327
- }
328
- res = [ ]
329
- bymodel . each { |model , count |
330
- res << ( count == 1 ? '' : count . to_s + ' x ' ) + model
322
+ gpu_types . each { |_model , hash |
323
+ res << ( hash [ :number ] == 1 ? '' : hash [ :number ] . to_s + ' x ' ) + hash [ :description ]
331
324
}
332
- else
333
- res = [ ]
325
+
334
326
end
335
- res . join ( ", " )
327
+ return res . join ( ", " )
336
328
end
337
329
330
+ def gpu_model_description ( device_hash , long_name )
331
+ model = long_name ? device_hash [ 'model' ] : GPURef . model2shortname ( device_hash [ 'model' ] )
332
+ memgib = ( device_hash [ 'memory' ] . to_f /2 **30 ) . round ( 0 )
333
+ vendor = device_hash [ 'vendor' ]
334
+ description = vendor . to_s + ' ' + model . to_s . gsub ( ' ' , ' ' ) + " (#{ memgib } GiB)"
335
+ if long_name
336
+ cc = GPURef . get_compute_capability ( model )
337
+ description += "<br>Compute capability: #{ cc } " if cc
338
+ description = "<s>" + description + "</s><br>''not supported by Grid'5000 default environments''" if !GPURef . is_gpu_supported? ( device_hash )
339
+ else
340
+ description = "<s>" + description + "</s>**" if !GPURef . is_gpu_supported? ( device_hash )
341
+ end
342
+ return description
343
+ end
338
344
339
345
def get_hardware ( sites )
340
346
global_hash = G5K ::get_global_hash
0 commit comments