Changeset 2152 for inundation/parallel/run_parallel_sw_merimbula.py
- Timestamp:
- Dec 16, 2005, 9:59:58 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/parallel/run_parallel_sw_merimbula.py
r2131 r2152 7 7 # file. 8 8 # 9 # *) The test files currently avaliable are of the form10 # test*.out, eg test_5l_4c.out. The term infront of the l11 # corresponds to the number of levels of refinement12 # required to build the grid, i.e. a higher number13 # corresponds to a finer grid. The term infront of the c14 # corresponds to the number of processors.15 9 # 16 10 # *) The (new) files that have been added to manage the … … 40 34 # 41 35 ######################################################### 36 42 37 import sys 43 38 import pypar # The Python-MPI interface 44 39 import time 45 40 46 47 41 from os import sep 48 42 sys.path.append('..'+sep+'pyvolution') 49 43 50 from Numeric import array 44 # Numeric arrays 45 46 from Numeric import array, zeros, Float 47 51 48 # pmesh 52 53 #from shallow_water import Domain54 49 55 50 from shallow_water import Domain 56 51 from parallel_shallow_water import Parallel_Domain 57 58 # mesh partition routines 52 from pmesh2domain import pmesh_to_domain_instance 53 54 # Reuse previous mesh import 55 56 from caching import cache 57 58 # Mesh partition routines 59 59 60 60 from pmesh_divide import pmesh_divide, pmesh_divide_steve 61 from build_submesh import * 62 from build_local import * 63 from build_commun import * 64 from pmesh2domain import pmesh_to_domain_instance 65 66 # read in the processor information 61 from build_submesh import build_submesh, extract_hostmesh 62 from build_local import build_local_mesh 63 from build_commun import send_submesh, rec_submesh 64 65 66 ############################### 67 # Read in processor information 68 ############################### 67 69 68 70 numprocs = pypar.size() … … 70 72 processor_name = pypar.Get_processor_name() 71 73 72 #------- 73 # Domain 74 ############################ 75 # Set the initial conditions 76 ############################ 77 74 78 rect = zeros( 4, Float) # Buffer for results 75 79 … … 86 90 return self.h*((x>self.x0)&(x<self.x1)) 87 91 92 ####################### 93 # Partition the domain 94 ####################### 88 95 89 96 if myid == 0: 90 97 91 # read in the test files98 # Read in the test files 92 99 93 100 # filename = 'test-100.tsh' … … 98 105 print "WARNING: number of subboxes is not equal to the number of proc" 99 106 100 domain_full = pmesh_to_domain_instance(filename, Domain) 101 107 # Build the whole domain 108 109 # domain_full = pmesh_to_domain_instance(filename, Domain) 110 111 domain_full = cache(pmesh_to_domain_instance, 112 (filename, Domain), 113 dependencies = [filename]) 114 115 rect = array(domain_full.xy_extent, Float) 116 117 # Initialise the wave 118 102 119 # domain_full.set_quantity('stage', Set_Stage(200.0,300.0,1.0)) 103 120 domain_full.set_quantity('stage', Set_Stage(756000.0,756500.0,2.0)) 104 121 122 # Subdivide the domain 123 105 124 nodes, triangles, boundary, triangles_per_proc, quantities = \ 106 125 pmesh_divide_steve(domain_full, nx, ny) 107 126 108 rect = array(domain_full.xy_extent, Float)109 110 127 submesh = build_submesh(nodes, triangles, boundary,\ 111 128 quantities, triangles_per_proc) 112 129 113 # send the mesh partition to the appropriate processor130 # Send the mesh partition to the appropriate processor 114 131 115 132 for p in range(1, numprocs): 116 133 send_submesh(submesh, triangles_per_proc, p) 117 134 135 # Build the local mesh for processor 0 136 118 137 hostmesh = extract_hostmesh(submesh) 119 120 points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict = \ 121 build_local_mesh(hostmesh, 0, triangles_per_proc[0], numprocs) 122 123 # read in the mesh partition that belongs to this 138 points, vertices, boundary, quantities, ghost_recv_dict, \ 139 full_send_dict = build_local_mesh(hostmesh, 0, \ 140 triangles_per_proc[0], \ 141 numprocs) 142 143 # Read in the mesh partition that belongs to this 124 144 # processor (note that the information is in the 125 145 # correct form for the GA data structure 126 146 127 147 else: 128 points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict \ 129 = rec_submesh(0) 130 148 points, vertices, boundary, quantities, ghost_recv_dict, \ 149 full_send_dict = rec_submesh(0) 150 151 152 ########################################### 153 # Start the computations on each subpartion 154 ########################################### 131 155 132 156 ## ########### start profile testing … … 149 173 ######## end profile testing 150 174 151 175 176 # The visualiser needs to know the size of the whole domain 177 152 178 pypar.broadcast(rect,0) 153 #print rect 179 154 180 155 181 domain = Parallel_Domain(points, vertices, boundary, 156 182 full_send_dict = full_send_dict, 157 183 ghost_recv_dict = ghost_recv_dict) 158 159 184 160 185 try:
Note: See TracChangeset
for help on using the changeset viewer.