Skip to content

Commit

Permalink
sstsimulator#574: Updated the python file
Browse files Browse the repository at this point in the history
Add the extent info for port topology
  • Loading branch information
meriadegp committed May 26, 2021
1 parent e87cfc2 commit f7cdb08
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
35 changes: 28 additions & 7 deletions python/snappr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -179,4 +201,3 @@

sst.setStatisticLoadLevel(7)
sst.setStatisticOutput("sst.vtkstatisticoutputexodus")
sst.macro.debug("mpi")
9 changes: 8 additions & 1 deletion sstmac/sst_core/python_topology.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit f7cdb08

Please sign in to comment.