From 6b91c0d1cab7b4afd140692a859ddd411a0b4625 Mon Sep 17 00:00:00 2001 From: Guillaume Raffy Date: Thu, 1 Oct 2020 11:01:08 +0200 Subject: [PATCH] decoupled config genration from plot This allows the user to choose another set of configurations without touching plot code --- concho/dell.py | 4 +- concho/procs_chooser.py | 81 ++++++++++++++++++++++------------------- cpu_table.dat | 2 + tests/test1.py | 41 +++++++++++++++++++-- 4 files changed, 85 insertions(+), 43 deletions(-) diff --git a/concho/dell.py b/concho/dell.py index 4e3ddf6..06fc3eb 100644 --- a/concho/dell.py +++ b/concho/dell.py @@ -726,7 +726,7 @@ class DellMatinfoCsvConfigurator(Configurator): continue # 2 processeurs Intel Xeon Silver 4210R 2.4GHz, 13.75M Cache,9.60GT/s, 2UPI, Turbo, HT,10C/20T (100W) - DDR4-2400 - match = re.match(r'^2 processeurs Intel Xeon (?PSilver|Gold|Platinium) (?P[0-9][0-9][0-9][0-9][RLYU]?).*$', label) + match = re.match(r'^2 processeurs Intel Xeon (?PSilver|Gold|Platinium) (?P[0-9][0-9][0-9][0-9][RLYUM]?) .*$', label) if match: cpu_class = match['cpu_class'].lower() if cpu_class == 'platinium': @@ -738,7 +738,7 @@ class DellMatinfoCsvConfigurator(Configurator): self.base_config.set_cpu(Cpu(base_cpu_id)) continue - match = re.match(r'^Passage à 2 Processeurs Intel Xeon (?PSilver|Gold|Platinium) (?P[0-9][0-9][0-9][0-9][RLYU]?).*', label) + match = re.match(r'^Passage à 2 Processeurs Intel Xeon (?PSilver|Gold|Platinium) (?P[0-9][0-9][0-9][0-9][RLYUM]?) .*', label) if match: price = DellConfiguratorParser.price_str_as_float(line_cells[COLUMN_PRICE]) cpu_class = match['cpu_class'].lower() diff --git a/concho/procs_chooser.py b/concho/procs_chooser.py index 3acab28..489c983 100644 --- a/concho/procs_chooser.py +++ b/concho/procs_chooser.py @@ -67,7 +67,11 @@ def create_unique_marker(config_index): config_index = config_index // alphabet_size return marker_string -def plot_system_efficiency(): +def plot_system_efficiency(configs): + """ + Args: + configs (list(Config)): the tist of configurations to plot + """ cpuTable = numpy.genfromtxt('cpu_table.dat', dtype=("|U15", float, int, float, float, float), names=True, delimiter='\t') #cpuTable = numpy.genfromtxt('dell_ivybridge_table.dat', dtype=(('id', "|S10"), ('clock', float), ('num_cores', int), ('price', float, float)), names=None, delimiter='\t') @@ -134,41 +138,28 @@ def plot_system_efficiency(): item_power_consumption = numpy.array([]) item_speed = numpy.array([]) item_label = numpy.array([]) - configurators = [ - dell.DellMatinfoCsvConfigurator('c6420-20200716-price.tsv'), - dell.DellMatinfoConfigurator('rcrc1406676-4834664 - Cat2 Conf4 PowerEdge R640 - Dell.html'), - dell.DellMatinfoConfigurator('rcrc1406676-4824727 - Cat 2 Conf 7 PowerEdge R940 - Dell.html'), - # dell.DellPowerEdgeR940(), - ] - for configurator in configurators: - for cpu in configurator.get_cpu_options(): - if not cpu.architecture in ['coffeelake', 'skylake','cascadelake']: - continue - config = configurator.create_config() - config.num_cpu_per_server = config.configurator.chassis.item.num_cpu_slots_per_server - config.set_cpu(cpu) - config.set_ram(ram_per_core=4.0e9) - - config_label = str(config.num_servers) + '_' + config.chassis.uid + '_' + cpu.uid + '_' + str(config.ram_size/config.num_servers) + 'gb' - item_label = numpy.append( item_label, config_label) - # print('procOptionPrice', procOptionPrice) - # config_price = procOptionPrice - # config_price += config.get_empty_price() - # print('config.get_empty_price()', config.get_empty_price()) - # ram_update_price = config.get_ram_update_price(cpu=cpu, ram_per_core=4.0e9) - # # ram_update_price = config.get_ram_update_price(cpu=cpu, ram_per_server=192.0e9) - # # ram_update_price = config.get_ram_update_price(cpu=cpu, ram_per_cpu=96.0e9) - # print('ram_update_price', ram_update_price) - # config_price += ram_update_price - # config_price += config.get_guarantee_price(5) - # print('config.config.get_guarantee_price(5)', config.get_guarantee_price(5)) - # config_price += config.get_disk_upgrade_price(2.0e12) - # print('config.get_disk_upgrade_price(2.0e12)', config.get_disk_upgrade_price(2.0e12)) - # print(item_label, config.get_price(), config.get_power_consumption()) - item_price = numpy.append( item_price, config.get_price() ) - item_power_consumption = numpy.append( item_power_consumption, config.get_power_consumption()) - # # print(hostTypeId, procId, item_power_consumption[-1]) - item_speed = numpy.append( item_speed, config.get_flops()) + for config in configs: + cpu = config.cpu + config_label = str(config.num_servers) + '_' + config.chassis.uid + '_' + cpu.uid + '_' + str(config.ram_size/config.num_servers) + 'gb' + item_label = numpy.append( item_label, config_label) + # print('procOptionPrice', procOptionPrice) + # config_price = procOptionPrice + # config_price += config.get_empty_price() + # print('config.get_empty_price()', config.get_empty_price()) + # ram_update_price = config.get_ram_update_price(cpu=cpu, ram_per_core=4.0e9) + # # ram_update_price = config.get_ram_update_price(cpu=cpu, ram_per_server=192.0e9) + # # ram_update_price = config.get_ram_update_price(cpu=cpu, ram_per_cpu=96.0e9) + # print('ram_update_price', ram_update_price) + # config_price += ram_update_price + # config_price += config.get_guarantee_price(5) + # print('config.config.get_guarantee_price(5)', config.get_guarantee_price(5)) + # config_price += config.get_disk_upgrade_price(2.0e12) + # print('config.get_disk_upgrade_price(2.0e12)', config.get_disk_upgrade_price(2.0e12)) + # print(item_label, config.get_price(), config.get_power_consumption()) + item_price = numpy.append( item_price, config.get_price() ) + item_power_consumption = numpy.append( item_power_consumption, config.get_power_consumption()) + # # print(hostTypeId, procId, item_power_consumption[-1]) + item_speed = numpy.append( item_speed, config.get_flops()) #pylab.plot(x, y, '+') #pylab.xlabel('speed/price ratio [core.MHz/euros]') @@ -259,5 +250,21 @@ def plot_system_efficiency(): plt.show() #plotCpuPassmark(): + +def plot_efficiency(configurators, ram_per_core, cpu_filter=lambda cpu : True): + configs = [] + for configurator in configurators: + for cpu in configurator.get_cpu_options(): + if cpu_filter(cpu): + config = configurator.create_config() + config.num_cpu_per_server = config.configurator.chassis.item.num_cpu_slots_per_server + config.set_cpu(cpu) + config.set_ram(ram_per_core=ram_per_core) + configs.append(config) + + plot_system_efficiency(configs) + + + if __name__ == '__main__': - plot_system_efficiency() + plot_2020_matinfo_configs diff --git a/cpu_table.dat b/cpu_table.dat index 55f8210..b64789f 100644 --- a/cpu_table.dat +++ b/cpu_table.dat @@ -123,9 +123,11 @@ intel-xeon-gold-6230r 2.1 26 150 0 0 intel-xeon-gold-6234 3.3 8 130 0 0 intel-xeon-gold-6238 2.1 22 140 0 0 intel-xeon-gold-6238l 2.1 22 140 0 0 +intel-xeon-gold-6238m 2.1 22 140 0 0 intel-xeon-gold-6238r 2.2 28 165 0 0 intel-xeon-gold-6240 2.6 18 150 0 0 intel-xeon-gold-6240l 2.6 18 150 0 0 +intel-xeon-gold-6240m 2.6 18 150 0 0 intel-xeon-gold-6240r 2.4 24 165 0 0 intel-xeon-gold-6240y 2.6 18 150 0 0 intel-xeon-gold-6242 2.8 16 150 0 0 diff --git a/tests/test1.py b/tests/test1.py index b1f7f5a..c4919b7 100644 --- a/tests/test1.py +++ b/tests/test1.py @@ -1,10 +1,43 @@ -from concho.dell import DellConfiguratorParser +from concho.dell import DellMatinfoCsvConfigurator +from concho.dell import DellMatinfoConfigurator from concho.procs_chooser import plot_system_efficiency +from concho.procs_chooser import plot_efficiency -def test_function(): +def test_all_matinfo_2020_configs(): # configurator = DellMatinfoConfigurator('rcrc1406676-4834664 - Cat2 Conf4 PowerEdge R640 - Dell.html') # print(configurator) - plot_system_efficiency() + configurators = [ + DellMatinfoCsvConfigurator('c6420-20200716-price.tsv'), + DellMatinfoConfigurator('rcrc1406676-4834664 - Cat2 Conf4 PowerEdge R640 - Dell.html'), + DellMatinfoConfigurator('rcrc1406676-4824727 - Cat 2 Conf 7 PowerEdge R940 - Dell.html'), + # dell.DellPowerEdgeR940(), + ] + + plot_efficiency(configurators=configurators, ram_per_core=4.0e9) + +def test_credits_2020_configs(): + # configurator = DellMatinfoConfigurator('rcrc1406676-4834664 - Cat2 Conf4 PowerEdge R640 - Dell.html') + # print(configurator) + configurators = [ + DellMatinfoCsvConfigurator('c6420-20200716-price.tsv'), + DellMatinfoConfigurator('rcrc1406676-4834664 - Cat2 Conf4 PowerEdge R640 - Dell.html'), + DellMatinfoConfigurator('rcrc1406676-4824727 - Cat 2 Conf 7 PowerEdge R940 - Dell.html'), + # dell.DellPowerEdgeR940(), + ] + + cpu_filter = lambda cpu : cpu.uid in [ + 'intel-xeon-gold-5222', + 'intel-xeon-gold-6226r', + 'intel-xeon-gold-6230r', + 'intel-xeon-gold-6234r', + 'intel-xeon-gold-6240r', + 'intel-xeon-gold-6248r', + 'intel-xeon-gold-6230', + 'intel-xeon-gold-6240', + ] + + plot_efficiency(configurators=configurators, ram_per_core=4.0e9, cpu_filter=cpu_filter) + if __name__ == '__main__': - test_function() \ No newline at end of file + test_all_matinfo_2020_configs() \ No newline at end of file