Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit be322dae authored by ramdsc's avatar ramdsc Committed by Millian Poquet
Browse files

Heterogeneous platform generation (core-grain)

parent 679ed19a
{
"clusters": [
{
"nodes": [
{ "type": "System x iDataPlex dx360 M4", "number": "158" }
],
"cluster_network": "InfiniBand FDR x4"
},
{ "nodes": [
{ "type": "System x iDataPlex dx360 M3", "number": "5" }
],
"cluster_network": "InfiniBand FDR x4"
},
{ "nodes": [
{ "type": "POWER 730 Express", "number": "10" }
],
"cluster_network": "InfiniBand FDR x4"
}
],
"dc_network": "InfiniBand FDR x4"
}
\ No newline at end of file
#!/usr/bin/env python3
import argparse
import json
import xml.etree.ElementTree as xml
import xml.dom.minidom as xml_format
def main():
description = "Generate Batsim heterogeneous platforms"
ap = argparse.ArgumentParser(description=description)
ap.add_argument("-p", "--platform-file", type=str, required=True,
help="JSON with platform description")
ap.add_argument("-o", "--output-xml", type=str, default="platform.xml",
help="XML output with platform ready for Batsim")
args = ap.parse_args()
with open(args.output_xml, "w") as output_f,\
open(args.platform_file, "r") as platform_f,\
open("network_types.json", "r") as network_types_f,\
open("node_types.json", "r") as node_types_f,\
open("processor_types.json", "r") as processor_types_f:
platform = json.load(platform_f)
network_types = json.load(network_types_f)
node_types = json.load(node_types_f)
processor_types = json.load(processor_types_f)
# DOCTYPE specification
doctype = "<!DOCTYPE platform SYSTEM \"https://simgrid.org/simgrid.dtd\">"
# Platform
platform_attrs = {"version": "4.1"}
platform_el = xml.Element("platform", attrib=platform_attrs)
# Main zone
main_zone_attrs = {"id": "main", "routing": "Full"}
main_zone_el = xml.SubElement(platform_el, "zone", attrib=main_zone_attrs)
# Master zone and master host
master_zone_attrs = {"id": "master", "routing": "None"}
master_zone_el = xml.SubElement(main_zone_el, "zone", attrib=master_zone_attrs)
mhost_attrs = {"id": "master_host", "speed": "1Gf"}
xml.SubElement(master_zone_el, "host", attrib=mhost_attrs)
# User config zone
config_zone_attrs = {"id": "config", "routing": "None"}
config_zone_el = xml.SubElement(main_zone_el, "zone", attrib=config_zone_attrs)
# Clusters
recorded_nodes = {}
cluster_idx = 0
for cluster in platform["clusters"]:
# Cluster
cluster_id = "clu_{}".format(cluster_idx)
cluster_attrs = {"id": cluster_id, "routing": "Cluster"}
cluster_el = xml.SubElement(main_zone_el, "zone", attrib=cluster_attrs)
# Nodes
for node in cluster["nodes"]:
node_template = node_types[node["type"]]
# Memory info
if node["type"] not in recorded_nodes:
mem_id = "mem_{}".format(node_template["id"])
mem_attrs = {"id": mem_id, "value": node_template["memory_gib"]}
xml.SubElement(config_zone_el, "prop", attrib=mem_attrs)
for node_idx in range(int(node["number"])):
node_id = "{}_{}_{}".format(node_template["id"], node_idx, cluster_id)
# Up / down link
udlink_id = "udl_{}".format(node_id)
udlink_attrs = {"id": udlink_id, "sharing_policy": "SHARED"}
udlink_attrs.update(network_types[cluster["cluster_network"]])
xml.SubElement(cluster_el, "link", attrib=udlink_attrs)
# Processors
for proc in node_template["processors"]:
proc_template = processor_types[proc["type"]][proc["model"]]
for proc_idx in range(int(proc["number"])):
proc_id = "{}_{}_{}".format(proc_template["id"], proc_idx, node_id)
# Cores
for core_idx in range(int(proc_template["nb_cores"])):
core_id = "cor_{}_{}".format(core_idx, proc_id)
core_attrs = {"id": core_id}
core_attrs.update(proc_template["core_attributes"])
core_el = xml.SubElement(cluster_el, "host", attrib=core_attrs)
for prop in proc_template["core_properties"]:
xml.SubElement(core_el, "prop", attrib=prop)
# Link association
hlink_attrs = {"id": core_id, "up": udlink_id, "down": udlink_id}
xml.SubElement(cluster_el, "host_link", attrib=hlink_attrs)
# Router
router_id = "rou_{}".format(cluster_idx)
router_attrs = {"id": router_id}
xml.SubElement(cluster_el, "router", attrib=router_attrs)
# Backbone network
backbone_id = "bbo_{}".format(cluster_idx)
backbone_attrs = {"id": backbone_id}
backbone_attrs.update(network_types[cluster["cluster_network"]])
xml.SubElement(cluster_el, "backbone", attrib=backbone_attrs)
cluster_idx += 1
# Links from clusters to master host
# Required to be stated after all clusters have been configured
cluster_idx = 0
for cluster in platform["clusters"]:
cluster_id = "clu_{}".format(cluster_idx)
ctmhlink_id = "tomh_{}".format(cluster_id)
ctmhlink_attrs = {"id": ctmhlink_id}
ctmhlink_attrs.update(network_types[platform["dc_network"]])
xml.SubElement(main_zone_el, "link", attrib=ctmhlink_attrs)
cluster_idx += 1
# Routes to master zone
# Required to be stated after all links have been configured
cluster_idx = 0
for cluster in platform["clusters"]:
cluster_id = "clu_{}".format(cluster_idx)
router_id = "rou_{}".format(cluster_idx)
ctmhlink_id = "tomh_{}".format(cluster_id)
route_attrs = {"src": cluster_id, "dst": "master", "gw_src": router_id, "gw_dst": "master_host"}
route_el = xml.SubElement(main_zone_el, "zoneRoute", attrib=route_attrs)
# Link association inside route
xml.SubElement(route_el, "link_ctn", attrib={"id": ctmhlink_id})
cluster_idx += 1
# Write the output
output_xml = xml_format.parseString("{}{}".format(doctype, xml.tostring(platform_el).decode()))
output_f.write(output_xml.toprettyxml(indent=" ", encoding="utf-8").decode())
if __name__ == "__main__":
main()
\ No newline at end of file
{
"InfiniBand FDR x4": {
"bandwidth": "54.54Gbps",
"latency": "0.7us"
}
}
\ No newline at end of file
{
"System x iDataPlex dx360 M4": {
"id": "dx360m4",
"processors": [
{ "type": "cpu", "model": "Xeon Sandy Bridge E5-2670", "number": "2" }
],
"memory_gib": "64"
},
"System x iDataPlex dx360 M3": {
"id": "dx360m3",
"processors": [
{ "type": "gpu", "model": "Tesla M2090", "number": "2" }
],
"memory_gib": "64"
},
"POWER 730 Express": {
"id": "p730ex",
"processors": [
{ "type": "cpu", "model": "POWER 7", "number": "2" }
],
"memory_gib": "64"
}
}
\ No newline at end of file
This diff is collapsed.
{
"cpu": {
"Xeon Sandy Bridge E5-2670": {
"id": "xsbe52670",
"nb_cores": "8",
"_metadata": {
"clock": "2.6GHz",
"tdp": "115W",
"vector": "AVX",
"vector_length_bits": "128"
},
"core_attributes": {
"speed": "20.4Gf, 18.36Gf, 16.32Gf, 14.28Gf, 12.24Gf, 0.0Gf, 0.0Gf, 0.0Gf"
},
"core_properties": [
{ "id": "sleep_pstates", "value": "5:6:7"},
{ "id": "watt_per_state", "value": "5.0:14.375, 5.0:12.9375, 5.0:11.5, 5.0:10.0625, 5.0:8.625, 2.0:2.0, 7.0:7.0, 6.0:6.0" },
{ "id": "watt_off", "value": "2.0" }
]
},
"POWER 7": {
"id": "power7",
"nb_cores": "8",
"_metadata": {
"clock": "3.0GHz",
"tdp": "180W",
"vector": "VMX and VSX",
"vector_length_bits": "128"
},
"core_attributes": {
"speed": "24.0Gf, 21.6Gf, 19.2Gf, 16.8Gf, 14.4Gf, 0.0Gf, 0.0Gf, 0.0Gf"
},
"core_properties": [
{ "id": "sleep_pstates", "value": "5:6:7"},
{ "id": "watt_per_state", "value": "8.0:22.5, 8.0:20.25, 8.0:18.0, 8.0:15.75, 8.0:13.5, 3.0:3.0, 11.0:11.0, 9.0:9.0" },
{ "id": "watt_off", "value": "3.0" }
]
}
},
"gpu": {
"Tesla M2090": {
"id": "teslam2090",
"nb_cores": "512",
"_metadata": {
"clock": "650MHz",
"tdp": "250W"
},
"core_attributes": {
"speed": "1.3Gf, 1.17Gf, 1.04Gf, 0.91Gf, 0.78Gf, 0.0Gf, 0.0Gf, 0.0Gf"
},
"core_properties": [
{ "id": "sleep_pstates", "value": "5:6:7"},
{ "id": "watt_per_state", "value": "0.2:0.5, 0.2:0.45, 0.2:0.4, 0.2:0.35, 0.2:0.3, 0.05:0.05, 0.25:0.25, 0.22:0.22" },
{ "id": "watt_off", "value": "0.05" }
]
}
}
}
\ No newline at end of file
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