Changeset 1555
- Timestamp:
- Jun 29, 2005, 1:16:23 PM (19 years ago)
- Location:
- inundation/ga/storm_surge/parallel
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/parallel/build_commun.py
r1520 r1555 46 46 ######################################################### 47 47 48 def send_submesh(submesh, triangles_per_proc, tagmap, p): 48 def send_submesh(submesh, triangles_per_proc, p): 49 50 print "pypar sending submesh to processor ",p 51 52 # build and send the tagmap for the boundary conditions 53 54 tagmap = {} 55 counter = 1 56 for b in submesh["full_boundary"][p]: 57 bkey = submesh["full_boundary"][p][b] 58 if not tagmap.has_key(bkey): 59 tagmap[bkey] = counter 60 counter = counter+1 61 62 pypar.send(tagmap, p) 49 63 50 64 # send the number of triangles per processor 51 65 52 print "pypar send triangles per proc",p53 66 pypar.send(triangles_per_proc, p, use_buffer=True) 54 67 … … 72 85 setup_array[5] = len(submesh["ghost_commun"][p]) 73 86 setup_array[6] = len(flat_full_commun) 74 print "pypar send setup_array", p 87 75 88 pypar.send(setup_array, p) 76 89 77 90 # send the nodes 78 91 79 print "pypar send full_nodes", p80 92 pypar.send(submesh["full_nodes"][p], p, use_buffer=True) 81 82 print "pypar send ghost_nodes", p83 93 pypar.send(submesh["ghost_nodes"][p], p, use_buffer=True) 84 94 85 95 # send the triangles 86 96 87 print "pypar send full_triangles", p 97 88 98 pypar.send(submesh["full_triangles"][p], p, use_buffer=True) 89 90 print "pypar send ghost_triangles", p91 99 pypar.send(submesh["ghost_triangles"][p], p, use_buffer=True) 92 100 93 101 # send the boundary (is it quicker to send as an array?) 94 102 95 print "pypar send full_boundary", p96 103 bc = [] 97 104 for b in submesh["full_boundary"][p]: … … 101 108 # send the communication pattern 102 109 103 print "pypar send ghost_commun", p, len(submesh["ghost_commun"][p])104 110 pypar.send(submesh["ghost_commun"][p], p, use_buffer=True) 105 106 print "pypar send full_commun", p, len(flat_full_commun)107 111 pypar.send(flat_full_commun, p, use_buffer=True) 108 112 … … 126 130 ######################################################### 127 131 128 def rec_submesh( tagmap,p):132 def rec_submesh(p): 129 133 130 134 from Numeric import zeros, Float, Int … … 134 138 135 139 submesh_cell = {} 140 141 print "pypar receiving submesh from processor ",p 142 143 # receive the tagmap for the boundary conditions 144 145 tagmap = pypar.receive(p) 136 146 137 147 # receive the number of triangles per processor … … 141 151 triangles_per_proc.append([0]) 142 152 143 print "pypar rec triangles_per_proc", p144 153 triangles_per_proc = pypar.receive(p, triangles_per_proc) 145 154 … … 147 156 148 157 setup_array = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] 149 print "pypar rec setup_array", p150 158 setup_array = pypar.receive(p, setup_array) 151 159 … … 156 164 for i in range(no_full_nodes): 157 165 full_nodes.append([0.0, 0.0, 0.0]) 158 print "pypar rec full_nodes ", p159 166 submesh_cell["full_nodes"] = pypar.receive(p, full_nodes) 160 167 … … 165 172 for i in range(no_ghost_nodes): 166 173 ghost_nodes.append([0, 0.0, 0.0]) 167 print "pypar rec ghost_nodes ", p168 174 submesh_cell["ghost_nodes"] = pypar.receive(p, ghost_nodes) 169 175 … … 174 180 for i in range(no_full_triangles): 175 181 full_triangles.append([0.0, 0.0, 0.0]) 176 print "pypar rec full_triangles", p177 182 submesh_cell["full_triangles"] = pypar.receive(p, full_triangles) 178 183 … … 183 188 for i in range(no_ghost_triangles): 184 189 ghost_triangles.append([0, [0.0, 0.0, 0.0]]) 185 print "pypar rec ghost_triangles", p186 190 submesh_cell["ghost_triangles"] = pypar.receive(p, ghost_triangles) 187 191 188 192 # receive the full boundary 189 193 190 print "pypar rec full_boundary", p191 194 no_full_boundary = setup_array[4] 192 195 bc = [] … … 209 212 for i in range(no_ghost_commun): 210 213 ghost_commun.append([0.0, 0.0]) 211 print "pypar rec ghost_commun", p, len(ghost_commun) 214 212 215 submesh_cell["ghost_commun"] = pypar.receive(p, ghost_commun) 213 214 216 215 217 # receive the full communication pattern … … 219 221 for i in range(no_full_commun): 220 222 full_commun.append([0.0, 0.0]) 221 print "pypar rec full_commun", p 223 222 224 full_commun = pypar.receive(p, full_commun) 223 225 -
inundation/ga/storm_surge/parallel/run_parallel_mesh.py
r1550 r1555 25 25 # 26 26 # *) Things still to do: 27 # +) Fix tagmap: this is a hack used to communicate28 # the boundary tag information, it should be removed29 27 # +) Fix host commun: The host processor (processor 0) 30 28 # currently uses MPI to communicate the submesh to itself. … … 89 87 print "PROCESSOR ", myid, " HAS STARTED" 90 88 91 # hack to allow communication of the boundary tag92 # information (will be removed)93 94 tagmap={}95 tagmap['37']=196 97 89 # if this is the host processor 98 90 … … 108 100 f=open('test_3l_2c.out', 'r') 109 101 [nodes, triangles, boundary, triangles_per_proc] = mg2ga(f) 110 102 111 103 # subdivide the mesh 112 104 … … 116 108 117 109 for p in range(numprocs): 118 send_submesh(submesh, triangles_per_proc, tagmap,p)110 send_submesh(submesh, triangles_per_proc, p) 119 111 120 112 # read in the mesh partition that belongs to this … … 122 114 # correct form for the GA data structure 123 115 124 [points, vertices, boundary, ghost_recv_dict, full_send_dict] = rec_submesh( tagmap,0)116 [points, vertices, boundary, ghost_recv_dict, full_send_dict] = rec_submesh(0) 125 117 126 118 # define the computation domain … … 170 162 171 163 172 print "`````````````````````````````"173 164 pypar.finalize() 174 print "@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
Note: See TracChangeset
for help on using the changeset viewer.