Changeset 1559
- Timestamp:
- Jun 30, 2005, 2:50:49 PM (19 years ago)
- Location:
- inundation/ga/storm_surge/parallel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/parallel/build_commun.py
r1555 r1559 18 18 ######################################################### 19 19 20 from Numeric import array, Int, Float 20 21 import logging, logging.config 21 22 logger = logging.getLogger('parallel') … … 49 50 50 51 print "pypar sending submesh to processor ",p 51 52 52 53 # build and send the tagmap for the boundary conditions 53 54 … … 87 88 88 89 pypar.send(setup_array, p) 89 90 90 91 # send the nodes 91 92 … … 94 95 95 96 # send the triangles 96 97 98 pypar.send(submesh["full_triangles"][p], p, use_buffer=True) 97 98 pypar.send(array(submesh["full_triangles"][p], Int), p, use_buffer=True) 99 99 pypar.send(submesh["ghost_triangles"][p], p, use_buffer=True) 100 100 … … 110 110 pypar.send(submesh["ghost_commun"][p], p, use_buffer=True) 111 111 pypar.send(flat_full_commun, p, use_buffer=True) 112 113 112 114 113 … … 177 176 178 177 no_full_triangles = setup_array[2] 179 full_triangles= []178 submesh_cell["full_triangles"] = [] 180 179 for i in range(no_full_triangles): 181 full_triangles.append([0.0, 0.0, 0.0]) 182 submesh_cell["full_triangles"] = pypar.receive(p, full_triangles) 180 submesh_cell["full_triangles"].append([0, 0, 0]) 181 182 full_triangles = pypar.receive(p, array(submesh_cell["full_triangles"], Int)) 183 184 for i in range(no_full_triangles): 185 submesh_cell["full_triangles"][i][0] = full_triangles[i][0] 186 submesh_cell["full_triangles"][i][1] = full_triangles[i][1] 187 submesh_cell["full_triangles"][i][2] = full_triangles[i][2] 183 188 184 189 # receive the ghost triangles … … 240 245 # datastructure 241 246 242 [GAnodes, GAtriangles, boundary, ghost_rec, full_send] = build_local_mesh(submesh_cell, lower_t, upper_t, numproc) 247 [GAnodes, GAtriangles, boundary, ghost_rec, full_send] = \ 248 build_local_mesh(submesh_cell, lower_t, upper_t, \ 249 numproc) 243 250 244 251 return GAnodes, GAtriangles, boundary, ghost_rec, full_send -
inundation/ga/storm_surge/parallel/build_submesh.py
r1500 r1559 382 382 return submeshg 383 383 384 385 386 387 388 389 384 ######################################################### 385 # 386 # Extract the submesh that will belong to the 387 # "host processor" (i.e. processor zero) 388 # 389 # *) See the documentation for build_submesh 390 # 391 # ------------------------------------------------------- 392 # 393 # *) A dictionary containing the full_triangles, 394 # full_nodes, full_boundary, ghost_triangles, ghost_nodes, 395 # ghost_commun and full_commun belonging to processor zero 396 # are returned. 397 # 398 ######################################################### 399 def extract_hostmesh(submesh): 400 401 submesh_cell = {} 402 submesh_cell["full_nodes"] = submesh["full_nodes"][0] 403 submesh_cell["ghost_nodes"] = submesh["ghost_nodes"][0] 404 submesh_cell["full_triangles"] = submesh["full_triangles"][0] 405 submesh_cell["ghost_triangles"] = submesh["ghost_triangles"][0] 406 submesh_cell["full_boundary"] = submesh["full_boundary"][0] 407 submesh_cell["ghost_commun"] = submesh["ghost_commun"][0] 408 submesh_cell["full_commun"] = submesh["full_commun"][0] 409 410 return submesh_cell 411 412 413 -
inundation/ga/storm_surge/parallel/pmesh_divide.py
r1556 r1559 175 175 triangles.append(t) 176 176 177 # the boundary labels have to changed in accoradance tothe177 # the boundary labels have to changed in accoradance with the 178 178 # new triangle ordering, proc_sum and tri_index help with this 179 179 -
inundation/ga/storm_surge/parallel/run_parallel_merimbula.py
r1558 r1559 17 17 # grid partitioning are 18 18 # +) mg2ga.py: read in the test files. 19 # +) pmesh_divide.py: subdivide a pmesh 19 20 # +) build_submesh.py: build the submeshes on the host 20 21 # processor. … … 25 26 # 26 27 # *) Things still to do: 27 # +) Fix host commun: The host processor (processor 0)28 # currently uses MPI to communicate the submesh to itself.29 # This is good for testing the communication but is very30 # inefficient and should be removed.31 28 # +) Overlap the communication and computation: The 32 29 # communication routines in build_commun.py should be … … 82 79 # read in the test files 83 80 84 filename = 'test-100.tsh' 85 [nodes, triangles, boundary, triangles_per_proc, rect] = \ 86 pmesh_divide(filename, Advection_Domain, 2, 1) 87 81 # filename = 'test-100.tsh' 82 filename = 'merimbula_10785.tsh' 83 nx = 3 84 ny = 1 85 if nx*ny != numprocs: 86 print "WARNING: number of subboxes is not equal to the number of proc" 87 88 [nodes, triangles, boundary, triangles_per_proc, rect] =\ 89 pmesh_divide(filename, Advection_Domain, nx, ny) 90 88 91 # subdivide the mesh 89 92 … … 95 98 96 99 # send the mesh partition to the appropriate processor 97 98 for p in range( numprocs):100 101 for p in range(1, numprocs): 99 102 send_submesh(submesh, triangles_per_proc, p) 100 103 104 hostmesh = extract_hostmesh(submesh) 105 [points, vertices, boundary, ghost_recv_dict, full_send_dict] = \ 106 build_local_mesh(hostmesh, 0, triangles_per_proc[0], numprocs) 107 101 108 # read in the mesh partition that belongs to this 102 109 # processor (note that the information is in the 103 110 # correct form for the GA data structure 104 111 105 106 107 108 [points, vertices, boundary, ghost_recv_dict, full_send_dict] = rec_submesh(0) 112 else: 113 [points, vertices, boundary, ghost_recv_dict, full_send_dict] = \ 114 rec_submesh(0) 109 115 110 116 #if myid == 0: … … 130 136 131 137 T = Transmissive_boundary(domain) 132 domain.set_boundary( {'outflow': T, 'inflow': T, 'inner':T, 'exterior': T } )138 domain.set_boundary( {'outflow': T, 'inflow': T, 'inner':T, 'exterior': T, 'open':T} ) 133 139 134 140 class Set_Stage: … … 144 150 return self.h*((x>self.x0)&(x<self.x1)) 145 151 146 domain.set_quantity('stage', Set_Stage(250.0,300.0,1.0)) 152 #domain.set_quantity('stage', Set_Stage(250.0,300.0,1.0)) 153 domain.set_quantity('stage', Set_Stage(756000.0,756500.0,1.0)) 147 154 148 155 #--------- … … 150 157 t0 = time.time() 151 158 domain.visualise = True 152 yieldstep = 1 153 finaltime = 4000 159 #yieldstep = 1 160 yieldstep = 1000 161 finaltime = 50000 162 # finaltime = 4000 154 163 for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime): 155 164 if myid == 0: -
inundation/ga/storm_surge/parallel/run_parallel_mesh.py
r1555 r1559 25 25 # 26 26 # *) Things still to do: 27 # +) Fix host commun: The host processor (processor 0)28 # currently uses MPI to communicate the submesh to itself.29 # This is good for testing the communication but is very30 # inefficient and should be removed.31 27 # +) Overlap the communication and computation: The 32 28 # communication routines in build_commun.py should be … … 107 103 # send the mesh partition to the appropriate processor 108 104 109 for p in range( numprocs):105 for p in range(1, numprocs): 110 106 send_submesh(submesh, triangles_per_proc, p) 111 107 108 hostmesh = extract_hostmesh(submesh) 109 [points, vertices, boundary, ghost_recv_dict, full_send_dict] = \ 110 build_local_mesh(hostmesh, 0, triangles_per_proc[0], \ 111 numprocs) 112 112 113 # read in the mesh partition that belongs to this 113 114 # processor (note that the information is in the 114 115 # correct form for the GA data structure 115 116 116 [points, vertices, boundary, ghost_recv_dict, full_send_dict] = rec_submesh(0) 117 else: 118 [points, vertices, boundary, ghost_recv_dict, full_send_dict] = rec_submesh(0) 117 119 118 120 # define the computation domain
Note: See TracChangeset
for help on using the changeset viewer.