Changeset 8543 for trunk/anuga_core/source/anuga_parallel
- Timestamp:
- Aug 30, 2012, 2:48:35 PM (13 years ago)
- Location:
- trunk/anuga_core/source/anuga_parallel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga_parallel/distribute_mesh.py
r8538 r8543 1076 1076 1077 1077 myid = pypar.rank() 1078 nprocs = pypar.size() 1078 1079 1079 1080 if verbose: print 'P%d: Sending submesh to P%d' %(myid, p) … … 1094 1095 counter = counter+1 1095 1096 1097 1098 def protocol(x): 1099 vanilla=False 1100 control_info, x = pypar.create_control_info(x, vanilla, return_object=True) 1101 print 'protocol', control_info[0] 1102 1103 # FIXME SR: Creates cPickle dump 1104 print 'tagmap', tagmap 1105 protocol(tagmap) 1096 1106 pypar.send(tagmap, p) 1097 1107 1098 1108 # send the quantities key information 1099 1109 1110 # FIXME SR: Creates cPickle dump 1111 print 'full_quant keys', submesh["full_quan"].keys() 1112 protocol(submesh["full_quan"].keys()) 1100 1113 pypar.send(submesh["full_quan"].keys(), p) 1101 1114 1102 # send the number of triangles per processor1103 1104 pypar.send(triangles_per_proc, p)1105 1106 # ghost layer width1107 1108 pypar.send(submesh["ghost_layer_width"][p], p)1109 1110 1115 # compress full_commun 1111 1112 1116 flat_full_commun = [] 1113 1117 … … 1128 1132 setup_array[7] = len(flat_full_commun) 1129 1133 setup_array[8] = len(submesh["full_quan"]) 1130 1131 pypar.send(num.array(setup_array, num.int), p) 1132 1134 1135 i=0 1136 i +=1 ; print 'send', i 1137 protocol(num.array(setup_array, num.int)) 1138 pypar.send(setup_array, p, bypass=True) 1139 1140 1141 # ghost layer width 1142 i +=1 ; print 'send', i 1143 protocol(num.array(submesh["ghost_layer_width"][p], num.int)) 1144 pypar.send(num.array(submesh["ghost_layer_width"][p], num.int), p, bypass=True) 1145 1146 1147 # send the number of triangles per processor 1148 i +=1 ; print 'send', i 1149 protocol(num.array(triangles_per_proc)) 1150 pypar.send(num.array(triangles_per_proc), p, bypass=True) 1151 1133 1152 # send the nodes 1134 1153 i +=1 ; print 'send', i 1154 protocol(num.array(submesh["full_nodes"][p], num.float)) 1155 #pypar.send(num.array(submesh["full_nodes"][p], num.float), p, bypass=False) 1135 1156 pypar.send(num.array(submesh["full_nodes"][p], num.float), p) 1136 pypar.send(num.array(submesh["ghost_nodes"][p], num.float),p) 1157 1158 1159 i +=1 ; print 'send', i 1160 protocol(num.array(submesh["ghost_nodes"][p], num.float)) 1161 pypar.send(num.array(submesh["ghost_nodes"][p], num.float),p, bypass=False) 1137 1162 1138 1163 # send the triangles 1139 1164 1140 pypar.send(num.array(submesh["full_triangles"][p], num.int), p) 1141 pypar.send(num.array(submesh["ghost_triangles"][p], num.int), p) 1165 i +=1 ; print 'send', i 1166 protocol(num.array(submesh["full_triangles"][p], num.int)) 1167 pypar.send(num.array(submesh["full_triangles"][p], num.int), p, bypass=False) 1168 i +=1 ; print 'send', i 1169 protocol(num.array(submesh["ghost_triangles"][p], num.int)) 1170 pypar.send(num.array(submesh["ghost_triangles"][p], num.int), p, bypass=False) 1142 1171 1143 1172 # send the boundary … … 1147 1176 bc.append([b[0], b[1], tagmap[submesh["full_boundary"][p][b]]]) 1148 1177 1149 1150 pypar.send(num.array(bc, num.int), p) 1178 i +=1 ; print 'send', i 1179 protocol(num.array(bc, num.int)) 1180 pypar.send(num.array(bc, num.int), p, bypass=False) 1151 1181 1152 1182 bc = [] … … 1154 1184 bc.append([b[0], b[1], tagmap[submesh["ghost_boundary"][p][b]]]) 1155 1185 1156 pypar.send(num.array(bc, num.int), p) 1186 i +=1 ; print 'send', i 1187 protocol(num.array(bc, num.int)) 1188 pypar.send(num.array(bc, num.int), p, bypass=False) 1157 1189 1158 1190 # send the communication pattern 1159 1191 1160 pypar.send(submesh["ghost_commun"][p], p) 1161 1162 pypar.send(num.array(flat_full_commun, num.int), p) 1192 # submesh["ghost_commun"][p] is numpy array 1193 i +=1 ; print 'send', i 1194 protocol(submesh["ghost_commun"][p]) 1195 pypar.send(submesh["ghost_commun"][p], p, bypass=False) 1196 1197 i +=1 ; print 'send', i 1198 protocol(num.array(flat_full_commun, num.int)) 1199 pypar.send(num.array(flat_full_commun, num.int), p, bypass=False) 1163 1200 1164 1201 # send the quantities 1202 1165 1203 1166 1204 for k in submesh["full_quan"]: 1167 pypar.send(num.array(submesh["full_quan"][k][p], num.float), p) 1205 print 'send full', ++i, k 1206 protocol(num.array(submesh["full_quan"][k][p], num.float)) 1207 pypar.send(num.array(submesh["full_quan"][k][p], num.float), p, bypass=False) 1168 1208 1169 1209 for k in submesh["ghost_quan"]: 1170 pypar.send(num.array(submesh["ghost_quan"][k][p], num.float),p) 1210 print 'send ghost', ++i, k 1211 protocol(num.array(submesh["ghost_quan"][k][p], num.float)) 1212 pypar.send(num.array(submesh["ghost_quan"][k][p], num.float),p, bypass=False) 1171 1213 1172 1214 … … 1192 1234 import pypar 1193 1235 1194 numproc = pypar.size()1236 numprocs = pypar.size() 1195 1237 myid = pypar.rank() 1196 1238 … … 1211 1253 qkeys = pypar.receive(p) 1212 1254 1213 # receive the number of triangles per processor1214 1215 triangles_per_proc = pypar.receive(p)1216 1217 # ghost layer width1218 1219 submesh_cell["ghost_layer_width"] = pypar.receive(p)1220 1255 1221 1256 # recieve information about the array sizes 1222 1257 1223 setup_array = pypar.receive(p) 1258 x = num.zeros((9,),num.int) 1259 pypar.receive(p, buffer=x, bypass=True) 1260 setup_array = x 1224 1261 1225 1262 no_full_nodes = setup_array[0] … … 1232 1269 no_full_commun = setup_array[7] 1233 1270 no_quantities = setup_array[8] 1234 1271 1272 1273 # ghost layer width 1274 x = num.zeros((1,),num.int) 1275 pypar.receive(p, buffer=x, bypass=True) 1276 submesh_cell["ghost_layer_width"] = x[0] 1277 1278 1279 # receive the number of triangles per processor 1280 x = num.zeros((numprocs,),num.int) 1281 pypar.receive(p, buffer=x, bypass=True) 1282 triangles_per_proc = x 1283 1235 1284 # receive the full nodes 1285 # x = num.zeros((no_full_nodes,),num.int) 1286 # pypar.receive(p, buffer=x, bypass=True) 1287 # submesh_cell["full_nodes"] = x 1288 1236 1289 1237 1290 submesh_cell["full_nodes"] = pypar.receive(p) 1238 1239 1291 # receive the ghost nodes 1240 1292 1241 submesh_cell["ghost_nodes"] = pypar.receive(p )1293 submesh_cell["ghost_nodes"] = pypar.receive(p, bypass=False) 1242 1294 1243 1295 # receive the full triangles 1244 1296 1245 submesh_cell["full_triangles"] = pypar.receive(p )1297 submesh_cell["full_triangles"] = pypar.receive(p, bypass=False) 1246 1298 1247 1299 # receive the ghost triangles 1248 1300 1249 submesh_cell["ghost_triangles"] = pypar.receive(p )1301 submesh_cell["ghost_triangles"] = pypar.receive(p, bypass=False) 1250 1302 1251 1303 # receive the full boundary 1252 1304 1253 bnd_c = pypar.receive(p )1305 bnd_c = pypar.receive(p, bypass=False) 1254 1306 1255 1307 submesh_cell["full_boundary"] = {} … … 1259 1311 # receive the ghost boundary 1260 1312 1261 bnd_c = pypar.receive(p )1313 bnd_c = pypar.receive(p, bypass=False) 1262 1314 1263 1315 submesh_cell["ghost_boundary"] = {} … … 1267 1319 # receive the ghost communication pattern 1268 1320 1269 submesh_cell["ghost_commun"] = pypar.receive(p )1321 submesh_cell["ghost_commun"] = pypar.receive(p, bypass=False) 1270 1322 1271 1323 # receive the full communication pattern 1272 1324 1273 full_commun = pypar.receive(p )1325 full_commun = pypar.receive(p, bypass=False) 1274 1326 1275 1327 submesh_cell["full_commun"] = {} … … 1284 1336 1285 1337 for i in range(no_quantities): 1286 tmp = pypar.receive(p )1338 tmp = pypar.receive(p, bypass=False) 1287 1339 submesh_cell["full_quan"][qkeys[i]]=num.zeros((no_full_triangles,3), num.float) 1288 1340 submesh_cell["full_quan"][qkeys[i]][:] = tmp[:] … … 1290 1342 submesh_cell["ghost_quan"]={} 1291 1343 for i in range(no_quantities): 1292 tmp = pypar.receive(p )1344 tmp = pypar.receive(p, bypass=False) 1293 1345 submesh_cell["ghost_quan"][qkeys[i]]= num.zeros((no_ghost_triangles,3), num.float) 1294 1346 submesh_cell["ghost_quan"][qkeys[i]][:] = tmp[:] -
trunk/anuga_core/source/anuga_parallel/parallel_api.py
r8538 r8543 57 57 58 58 59 60 61 if not pypar_available: return domain # Bypass 59 if not pypar_available or numprocs == 1 : return domain # Bypass 62 60 63 61 # For some obscure reason this communication must happen prior to … … 75 73 76 74 for p in range(1, numprocs): 75 # FIXME SR: Creates cPickle dump 77 76 send((domain_name, domain_dir, domain_store, \ 78 77 domain_minimum_storable_height, georef, \ … … 130 129 # Send serial to parallel (s2p) and parallel to serial (p2s) triangle mapping to proc 1 .. numprocs 131 130 for p in range(1, numprocs): 131 # FIXME SR: Creates cPickle dump 132 132 send(s2p_map, p) 133 # FIXME SR: Creates cPickle dump 133 134 send(p2s_map, p) 134 135 … … 250 251 if verbose: print 'Distribute submeshes' 251 252 for p in range(1, numprocs): 252 send_submesh(submesh, triangles_per_proc, p, verbose)253 send_submesh(submesh, triangles_per_proc, p, verbose) 253 254 254 255 # Build the local mesh for processor 0 -
trunk/anuga_core/source/anuga_parallel/run_parallel_sw_rectangular_cross.py
r8542 r8543 33 33 t0 = time.time() 34 34 35 verbose = False35 verbose = True 36 36 37 37 #-------------------------------------------------------------------------- … … 41 41 length = 2.0 42 42 width = 2.0 43 dx = dy = 0.005 43 #dx = dy = 0.005 44 dx = dy = 0.01 44 45 domain = rectangular_cross_domain(int(length/dx), int(width/dy), 45 46 len1=length, len2=width) … … 159 160 160 161 161 #domain.dump_triangulation(filename="rectangular_cross_%g.png"% numprocs) 162 if domain.number_of_global_triangles < 50000: 163 print 'Create dump of triangulation for {0} triangles'.format(domain.number_of_global_triangles) 164 domain.dump_triangulation(filename="rectangular_cross_%g.png"% numprocs) 162 165 163 166 finalize()
Note: See TracChangeset
for help on using the changeset viewer.