Commit fcf66cc9 authored by RINGOT Patrice's avatar RINGOT Patrice

[wikigen] use the new GPU representation to generate wiki informations

parent d600098b
Pipeline #89589 passed with stages
in 3 minutes and 4 seconds
......@@ -39,8 +39,8 @@ class G5KHardwareGenerator < WikiGenerator
next if node_hash['status'] == 'retired'
nodes += 1
cores += node_hash['architecture']['nb_cores']
if node_hash['gpu'] and node_hash['gpu']['gpu_count']
gpus += node_hash['gpu']['gpu_count']
if node_hash['gpu_devices']
gpus += node_hash['gpu_devices'].length
end
ssds += node_hash['storage_devices'].select { |d| d['storage'] == 'SSD' }.length
hdds += node_hash['storage_devices'].select { |d| d['storage'] == 'HDD' }.length
......@@ -154,23 +154,46 @@ class G5KHardwareGenerator < WikiGenerator
}
# Accelerators
g = node_hash['gpu']
m = node_hash['mic']
gpu_families = {}
gpu_families[[g['gpu_vendor']]] = g['gpu_count'] if g and g['gpu']
mic_families = {}
mic_families[[m['mic_vendor']]] = m['mic_count'] if m and m['mic']
mic_details = {}
mic_details[["#{m['mic_vendor']} #{m['mic_model']}"]] = [m['mic_count'], m['mic_cores']] if m and m['mic']
lg = node_hash['gpu_devices']
gpu_families = {}
gpu_details = {}
unless lg.nil?
lg.each { |g|
d = g[1]
vendor = d['vendor']
cmodel = d['model']
model = GPURef.getGrid5000LegacyNameFor(cmodel)
nbcores = GPURef.getNumberOfCoresFor(cmodel)
family = gpu_families[[vendor]]
if family.nil?
gpu_families[[vendor]] = 1
else
gpu_families[[vendor]] += 1
end
details = gpu_details[["#{vendor} #{model}"]]
if details.nil?
gpu_details[["#{vendor} #{model}"]] = [1, nbcores]
else
gpu_details[["#{vendor} #{model}"]] = [details[0]+1, details[1]+nbcores]
end
}
end
gpu_families.merge(mic_families).sort.to_h.each { |k, v|
init(data, 'acc_families', k)
data['acc_families'][k][site_uid] += v
}
gpu_details = {}
gpu_details[["#{g['gpu_vendor']} #{g['gpu_model']}"]] = [g['gpu_count'], g['gpu_cores']] if g and g['gpu']
mic_details = {}
mic_details[["#{m['mic_vendor']} #{m['mic_model']}"]] = [m['mic_count'], m['mic_cores']] if m and m['mic']
gpu_details.merge(mic_details).sort.to_h.each { |k, v|
init(data, 'acc_models', k)
data['acc_models'][k][site_uid] += v[0]
......
# coding: utf-8
class GPURef
@@gpu2cores = {
"GeForce RTX 2080 Ti" => 4352,
"GeForce GTX 1080 Ti" => 3584,
"Tesla P100-PCIE-16GB" => 3584,
"Tesla V100-PCIE-32GB" => 5120,
"Tesla M2075" => 448,
"GeForce GTX TITAN Black" => 2880,
"GeForce GTX 980" => 2048,
"Tesla K40m" => 2880,
}
@@new_gpu_names2old_ones = {
"GeForce RTX 2080 Ti" => "RTX 2080 Ti",
"GeForce GTX 1080 Ti" => "GTX 1080 Ti",
"Tesla P100-PCIE-16GB" => "Tesla P100",
"Tesla V100-PCIE-32GB" => "Tesla V100",
"Tesla M2075" => "Tesla M2075",
"GeForce GTX TITAN Black" => "Titan Black",
"GeForce GTX 980" => "GTX 980",
"Tesla K40m" => "Tesla K40M",
}
def self.getNumberOfCoresFor(model)
if @@gpu2cores[model]
return @@gpu2cores[model]
else
raise "Fix me: #{model} is missing"
end
end
# will not keep this, just to ease manual testing for bug #10436
def self.getGrid5000LegacyNameFor(model)
if @@new_gpu_names2old_ones[model]
return @@new_gpu_names2old_ones[model]
else
return model
end
end
end
class SiteHardwareGenerator < WikiGenerator
def initialize(page_name, site)
......@@ -316,9 +358,25 @@ def get_hardware(sites)
s
end.join('<br />')
gpu = node_hash['gpu']
hard['gpu_str'] = if gpu && gpu['gpu']
(gpu['gpu_count'].to_i == 1 ? '' : gpu['gpu_count'].to_s + '&nbsp;x&nbsp;') + gpu['gpu_vendor'].to_s + ' ' + gpu['gpu_model'].to_s.gsub(' ', '&nbsp;')
lgpu = node_hash['gpu_devices']
hard['gpu_str'] = if lgpu
bymodel = {}
lgpu.each { |g|
d = g[1]
vendor = d['vendor']
model = GPURef.getGrid5000LegacyNameFor(d['model'])
vm = vendor.to_s + ' ' + model.to_s.gsub(' ', '&nbsp;')
if bymodel[vm]
bymodel[vm] += 1
else
bymodel[vm] = 1
end
}
res = []
bymodel.each { |model,count|
res << (count == 1 ? '' : count.to_s + '&nbsp;x&nbsp;') + model
}
res.join(", ")
else
''
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment