Mesh_westfirst.py (11666:10d59d546ea2) | Mesh_westfirst.py (13731:67cd980cb20f) |
---|---|
1# Copyright (c) 2010 Advanced Micro Devices, Inc. 2# 2016 Georgia Institute of Technology 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 68 unchanged lines hidden (view full) --- 77 78 # link counter to set unique link ids 79 link_count = 0 80 81 # Add all but the remainder nodes to the list of nodes to be uniformly 82 # distributed across the network. 83 network_nodes = [] 84 remainder_nodes = [] | 1# Copyright (c) 2010 Advanced Micro Devices, Inc. 2# 2016 Georgia Institute of Technology 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 68 unchanged lines hidden (view full) --- 77 78 # link counter to set unique link ids 79 link_count = 0 80 81 # Add all but the remainder nodes to the list of nodes to be uniformly 82 # distributed across the network. 83 network_nodes = [] 84 remainder_nodes = [] |
85 for node_index in xrange(len(nodes)): | 85 for node_index in range(len(nodes)): |
86 if node_index < (len(nodes) - remainder): 87 network_nodes.append(nodes[node_index]) 88 else: 89 remainder_nodes.append(nodes[node_index]) 90 91 # Connect each node to the appropriate router 92 ext_links = [] 93 for (i, n) in enumerate(network_nodes): --- 15 unchanged lines hidden (view full) --- 109 link_count += 1 110 111 network.ext_links = ext_links 112 113 # Create the mesh links. 114 int_links = [] 115 116 # East output to West input links (weight = 2) | 86 if node_index < (len(nodes) - remainder): 87 network_nodes.append(nodes[node_index]) 88 else: 89 remainder_nodes.append(nodes[node_index]) 90 91 # Connect each node to the appropriate router 92 ext_links = [] 93 for (i, n) in enumerate(network_nodes): --- 15 unchanged lines hidden (view full) --- 109 link_count += 1 110 111 network.ext_links = ext_links 112 113 # Create the mesh links. 114 int_links = [] 115 116 # East output to West input links (weight = 2) |
117 for row in xrange(num_rows): 118 for col in xrange(num_columns): | 117 for row in range(num_rows): 118 for col in range(num_columns): |
119 if (col + 1 < num_columns): 120 east_out = col + (row * num_columns) 121 west_in = (col + 1) + (row * num_columns) 122 int_links.append(IntLink(link_id=link_count, 123 src_node=routers[east_out], 124 dst_node=routers[west_in], 125 latency = link_latency, 126 weight=2)) 127 link_count += 1 128 129 # West output to East input links (weight = 1) | 119 if (col + 1 < num_columns): 120 east_out = col + (row * num_columns) 121 west_in = (col + 1) + (row * num_columns) 122 int_links.append(IntLink(link_id=link_count, 123 src_node=routers[east_out], 124 dst_node=routers[west_in], 125 latency = link_latency, 126 weight=2)) 127 link_count += 1 128 129 # West output to East input links (weight = 1) |
130 for row in xrange(num_rows): 131 for col in xrange(num_columns): | 130 for row in range(num_rows): 131 for col in range(num_columns): |
132 if (col + 1 < num_columns): 133 east_in = col + (row * num_columns) 134 west_out = (col + 1) + (row * num_columns) 135 int_links.append(IntLink(link_id=link_count, 136 src_node=routers[west_out], 137 dst_node=routers[east_in], 138 latency = link_latency, 139 weight=1)) 140 link_count += 1 141 142 143 # North output to South input links (weight = 2) | 132 if (col + 1 < num_columns): 133 east_in = col + (row * num_columns) 134 west_out = (col + 1) + (row * num_columns) 135 int_links.append(IntLink(link_id=link_count, 136 src_node=routers[west_out], 137 dst_node=routers[east_in], 138 latency = link_latency, 139 weight=1)) 140 link_count += 1 141 142 143 # North output to South input links (weight = 2) |
144 for col in xrange(num_columns): 145 for row in xrange(num_rows): | 144 for col in range(num_columns): 145 for row in range(num_rows): |
146 if (row + 1 < num_rows): 147 north_out = col + (row * num_columns) 148 south_in = col + ((row + 1) * num_columns) 149 int_links.append(IntLink(link_id=link_count, 150 src_node=routers[north_out], 151 dst_node=routers[south_in], 152 latency = link_latency, 153 weight=2)) 154 link_count += 1 155 156 # South output to North input links (weight = 2) | 146 if (row + 1 < num_rows): 147 north_out = col + (row * num_columns) 148 south_in = col + ((row + 1) * num_columns) 149 int_links.append(IntLink(link_id=link_count, 150 src_node=routers[north_out], 151 dst_node=routers[south_in], 152 latency = link_latency, 153 weight=2)) 154 link_count += 1 155 156 # South output to North input links (weight = 2) |
157 for col in xrange(num_columns): 158 for row in xrange(num_rows): | 157 for col in range(num_columns): 158 for row in range(num_rows): |
159 if (row + 1 < num_rows): 160 north_in = col + (row * num_columns) 161 south_out = col + ((row + 1) * num_columns) 162 int_links.append(IntLink(link_id=link_count, 163 src_node=routers[south_out], 164 dst_node=routers[north_in], 165 latency = link_latency, 166 weight=2)) 167 link_count += 1 168 169 170 network.int_links = int_links | 159 if (row + 1 < num_rows): 160 north_in = col + (row * num_columns) 161 south_out = col + ((row + 1) * num_columns) 162 int_links.append(IntLink(link_id=link_count, 163 src_node=routers[south_out], 164 dst_node=routers[north_in], 165 latency = link_latency, 166 weight=2)) 167 link_count += 1 168 169 170 network.int_links = int_links |