@@ -23,8 +23,8 @@ def generate_content(_options)
23
23
"{{Portal|User}}\n " +
24
24
"<div class=\" sitelink\" >Hardware: [[Hardware|Global]] | " + G5K ::SITES . map { |e | "[[#{ e . capitalize } :Hardware|#{ e . capitalize } ]]" } . join ( " | " ) + "</div>\n " +
25
25
"'''See also:''' [[#{ @site . capitalize } :Network|Network topology for #{ @site . capitalize } ]]\n " +
26
- "\n = Summary = \n " +
27
- "''' #{ generate_oneline_summary } ''' \n " +
26
+ "#{ SiteHardwareGenerator . generate_header_summary ( { @site => G5K :: get_global_hash [ 'sites' ] [ @site ] } ) } \n " +
27
+ "= Clusters = \n " +
28
28
self . class . generate_summary ( @site , false ) +
29
29
( has_reservable_disks ? "''*: disk is [[Disk_reservation|reservable]]''" : '' ) +
30
30
self . class . generate_description ( @site ) +
@@ -42,21 +42,53 @@ def self.generate_all_clusters
42
42
MW . generate_table ( 'class="wikitable sortable"' , table_columns , table_data ) + "\n "
43
43
end
44
44
45
- def generate_oneline_summary
46
- h = G5K ::get_global_hash [ 'sites' ] [ @site ]
47
- # remove retired nodes
48
- # FIXME this should probably move to a helper
49
- h [ 'clusters' ] . each_pair do |cl , v |
50
- v [ 'nodes' ] . delete_if { |n , v2 | v2 [ 'status' ] == 'retired' }
45
+ def self . generate_header_summary ( sites_hash )
46
+ sites = sites_hash . length
47
+ clusters = 0
48
+ nodes = 0
49
+ cores = 0
50
+ gpus = 0
51
+ hdds = 0
52
+ ssds = 0
53
+ storage_space = 0
54
+ ram = 0
55
+ pmem = 0
56
+ flops = 0
57
+
58
+ sites_hash . sort . to_h . each do |site_uid , site_hash |
59
+ clusters += site_hash [ 'clusters' ] . length
60
+ site_hash [ 'clusters' ] . sort . to_h . each do |cluster_uid , cluster_hash |
61
+ cluster_hash [ 'nodes' ] . sort . to_h . each do |node_uid , node_hash |
62
+ next if node_hash [ 'status' ] == 'retired'
63
+ nodes += 1
64
+ cores += node_hash [ 'architecture' ] [ 'nb_cores' ]
65
+ ram += node_hash [ 'main_memory' ] [ 'ram_size' ]
66
+ pmem += node_hash [ 'main_memory' ] [ 'pmem_size' ] if node_hash [ 'main_memory' ] [ 'pmem_size' ]
67
+ if node_hash [ 'gpu_devices' ]
68
+ gpus += node_hash [ 'gpu_devices' ] . length
69
+ end
70
+ ssds += node_hash [ 'storage_devices' ] . select { |d | d [ 'storage' ] == 'SSD' } . length
71
+ hdds += node_hash [ 'storage_devices' ] . select { |d | d [ 'storage' ] == 'HDD' } . length
72
+ node_hash [ 'storage_devices' ] . each do |i |
73
+ storage_space += i [ 'size' ]
74
+ end
75
+ flops += node_hash [ 'performance' ] [ 'node_flops' ]
76
+ end
77
+ end
51
78
end
52
- h [ 'clusters' ] . delete_if { |k , v | v [ 'nodes' ] . empty? }
53
-
54
- clusters = h [ 'clusters' ] . length
55
- nodes = h [ 'clusters' ] . inject ( 0 ) { |a , b | a + b [ 1 ] [ 'nodes' ] . values . length }
56
- cores = h [ 'clusters' ] . inject ( 0 ) { |a , b | cnodes = b [ 1 ] [ 'nodes' ] . values ; a + cnodes . length * cnodes . first [ 'architecture' ] [ 'nb_cores' ] }
57
- flops = h [ 'clusters' ] . inject ( 0 ) { |a , b | cnodes = b [ 1 ] [ 'nodes' ] . values ; a + cnodes . length * ( cnodes . first [ 'performance' ] [ 'node_flops' ] rescue 0 ) }
58
79
tflops = sprintf ( "%.1f" , flops . to_f / ( 10 **12 ) )
59
- return "#{ clusters } cluster#{ clusters > 1 ? 's' : '' } , #{ nodes } node#{ nodes > 1 ? 's' : '' } , #{ cores } core#{ cores > 1 ? 's' : '' } , #{ tflops } TFLOPS"
80
+
81
+ summary = "= Summary =\n "
82
+ summary += sites > 1 ? "* #{ sites } sites\n " :''
83
+ summary += "* #{ clusters } clusters\n "
84
+ summary += "* #{ nodes } nodes\n "
85
+ summary += "* #{ cores } CPU cores\n "
86
+ summary += "* #{ gpus } GPUs\n "
87
+ summary += "* #{ G5K . get_size ( ram ) } RAM"
88
+ summary += pmem > 0 ? " + #{ G5K . get_size ( pmem ) } PMEM\n " :"\n "
89
+ summary += "* #{ ssds } SSDs and #{ hdds } HDDs on nodes (total: #{ G5K . get_size ( storage_space , 'metric' ) } )\n "
90
+ summary += "* #{ tflops } TFLOPS (excluding GPUs)\n "
91
+ summary
60
92
end
61
93
62
94
def self . generate_summary ( site , with_sites )
0 commit comments