From f7cdb0872ee6b2de0cb39b16496e0bfbf17ea9ec Mon Sep 17 00:00:00 2001 From: meriadeg perrinel Date: Wed, 26 May 2021 18:06:58 +0200 Subject: [PATCH] #574: Updated the python file Add the extent info for port topology --- python/snappr.py | 35 ++++++++++++++++++++++++------ sstmac/sst_core/python_topology.cc | 9 +++++++- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/python/snappr.py b/python/snappr.py index 17fdcdfb4..9877ec209 100644 --- a/python/snappr.py +++ b/python/snappr.py @@ -46,7 +46,7 @@ node.addParams({ "proc.frequency" : "2GHz", "app1.name" : "mpi_ping_all", - "app1.launch_cmd" : "aprun -n 8 -N 1", + "app1.launch_cmd" : "aprun -n 20 -N 1", "id" : i, "app1.message_size" : "20KB", "memory.name" : "snappr", @@ -80,7 +80,6 @@ for i in range(num_switches): connections = system.switchConnections(i) switch = switches[i] - switch_geometry = system.switchGeometry(i) for src_id, dst_id, src_outport, dst_inport in connections: link_name = "network%d:%d->%d:%d" % (src_id,src_outport,dst_id,dst_inport) link = sst.Link(link_name) @@ -94,6 +93,7 @@ print("Connecting endpoints") for sw_id in range(num_switches): connections = system.ejectionConnections(sw_id) + switch_geometry = system.switchGeometry(sw_id) for ep_id, switch_port, ej_port in connections: if first_ej_port == -1: first_ej_port = switch_port @@ -111,8 +111,15 @@ ep.addLink(link,port_name,link_latency) sc = switch.setSubComponent("outport%d" % switch_port, "macro.snappr_outport") p = p + 1 + px = switch_geometry[2][switch_port][0] + py = switch_geometry[2][switch_port][1] + pz = switch_geometry[2][switch_port][2] + ex = switch_geometry[2][switch_port][3] + ey = switch_geometry[2][switch_port][4] + ez = switch_geometry[2][switch_port][5] + sc.enableStatistic("traffic_intensity", - {"type": "sst.IntensityStatistic", "origin": [1, p, 1], "size": [sideX, sideY, sideZ], "shape": "line"}) + {"type": "sst.IntensityStatistic", "origin": [px, py, pz], "size": [ex, ey, ez], "shape": "cube"}) connections = system.ejectionConnections(sw_id) for ep_id, switch_port, inj_port, in connections: @@ -130,19 +137,34 @@ sc = ep.setSubComponent("outport%d" % ej_port, "macro.snappr_outport") p = p + 1 + px = switch_geometry[2][ej_port][0] + py = switch_geometry[2][ej_port][1] + pz = switch_geometry[2][ej_port][2] + ex = switch_geometry[2][ej_port][3] + ey = switch_geometry[2][ej_port][4] + ez = switch_geometry[2][ej_port][5] + sc.enableStatistic("traffic_intensity", - {"type": "sst.IntensityStatistic", "origin": [1, p, 1], "size": [sideX, sideY, sideZ], "shape": "line"}) + {"type": "sst.IntensityStatistic", "origin": [px, py, pz], "size": [ex, ey, ez], "shape": "cube"}) # have to do it this way because every slot gets a subcomponent, # but not every port gets a link for sw_id in range(num_switches): switch = switches[sw_id] - for j in range(0,first_ej_port): + switch_geometry = system.switchGeometry(sw_id) + for j in range(0,first_ej_port): port = switch.setSubComponent("outport%d" % j, "macro.snappr_outport") p = p + 1 + px = switch_geometry[2][j][0] + py = switch_geometry[2][j][1] + pz = switch_geometry[2][j][2] + ex = switch_geometry[2][j][3] + ey = switch_geometry[2][j][4] + ez = switch_geometry[2][j][5] + port.enableStatistic("traffic_intensity", - {"type": "sst.IntensityStatistic", "origin": [1, p, 1], "size": [sideX, sideY, sideZ], "shape": "line"}) + {"type": "sst.IntensityStatistic", "origin": [px, py, pz], "size": [ex, ey, ez], "shape": "cube"}) nproc = sst.getMPIRankCount() * sst.getThreadCount() logp_switches = [None]*nproc @@ -179,4 +201,3 @@ sst.setStatisticLoadLevel(7) sst.setStatisticOutput("sst.vtkstatisticoutputexodus") -sst.macro.debug("mpi") diff --git a/sstmac/sst_core/python_topology.cc b/sstmac/sst_core/python_topology.cc index 50da122f7..580ab318e 100644 --- a/sstmac/sst_core/python_topology.cc +++ b/sstmac/sst_core/python_topology.cc @@ -306,13 +306,20 @@ sys_get_switch_geometry(SystemPy_t *self, PyObject *idx) for (int p=0; p < geom.ports.size(); ++p){ sstmac::hw::Topology::xyz port_xyz = geom.get_port_geometry(p).origin(); - PyObject* portTuple = PyTuple_New(3); + sstmac::hw::Topology::xyz port_extent = geom.get_port_geometry(p).extent(); + PyObject* portTuple = PyTuple_New(6); PyObject* portX = ConvertToPythonDouble(port_xyz.x); PyObject* portY = ConvertToPythonDouble(port_xyz.y); PyObject* portZ = ConvertToPythonDouble(port_xyz.z); + PyObject* extentX = ConvertToPythonDouble(port_extent.x); + PyObject* extentY = ConvertToPythonDouble(port_extent.y); + PyObject* extentZ = ConvertToPythonDouble(port_extent.z); PyTuple_SetItem(portTuple, 0, portX); PyTuple_SetItem(portTuple, 1, portY); PyTuple_SetItem(portTuple, 2, portZ); + PyTuple_SetItem(portTuple, 3, extentX); + PyTuple_SetItem(portTuple, 4, extentY); + PyTuple_SetItem(portTuple, 5, extentZ); PyTuple_SetItem(portsTuple, p, portTuple); }