Changeset 123 for pypar/pytiming
- Timestamp:
- Jul 11, 2005, 3:20:03 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pypar/pytiming
r85 r123 14 14 import pypar 15 15 16 #from mpiext import send_array, receive_array #most direct methods 17 #Not available in final install - use bypass form for now 18 16 19 #-------------------------------------------------------------- 17 20 18 raw = 1 # Use raw communication (1) or user friendly (0) 19 vanilla = 0 # Force use of vanilla format (1) 20 consistency_check = 1 # Check correctness 21 22 #-------------------------------------------------------------- 23 if raw: 24 Send = pypar.raw_send 25 Recv = pypar.raw_receive 26 else: 27 Send = pypar.send 28 Recv = pypar.receive 21 method = 2 # Use 22 # 0: automatically allocated buffers 23 # 1: user-supplied buffers 24 # 2: Use bypass - let pypar use direct mpi_ext call 25 # 3: direct call to mpiext (with buffers), 26 # only fractionally better than bypass 27 28 vanilla = False # Force use of vanilla format (1) 29 consistency_check = False # Check correctness 29 30 30 31 … … 103 104 seed(17, 53) 104 105 A = uniform(0.0,100.0,MAXM) 105 #A = uniform(0,100,MAXM).astype('l')106 106 elsize = A.itemsize() 107 107 #print elsize … … 144 144 # 145 145 t1 = pypar.Wtime() 146 Send(A[:m], 1, msgid, vanilla) 147 if raw: 148 C = Recv(A[:m], numprocs-1, msgid, vanilla) 149 else: 150 C = Recv(numprocs-1, msgid) 146 147 if method==0: 148 pypar.send(A[:m], destination=1, tag=msgid, vanilla=vanilla) 149 C = pypar.receive(numprocs-1, tag=msgid, vanilla=vanilla) 150 elif method == 1: 151 pypar.send(A[:m], use_buffer=True, destination=1, 152 tag=msgid, vanilla=vanilla) 153 C = pypar.receive(numprocs-1, buffer=A[:m], tag=msgid, vanilla=vanilla) 154 elif method==2: 155 pypar.send(A[:m], use_buffer=True, destination=1, 156 tag=msgid, vanilla=vanilla, bypass=True) 157 C = pypar.receive(numprocs-1, buffer=A[:m], tag=msgid, 158 vanilla=vanilla, bypass=True) 159 else: 160 raise 'Unknown method' 161 #send_array(A[:m], 1, msgid) 162 #stat = receive_array(A[:m], numprocs-1, msgid) 163 #C = A[:m] 164 151 165 t2 = pypar.Wtime() - t1 - cpuOH 152 166 t2 = t2/numprocs … … 164 178 # Parallel process - get msg and pass it on 165 179 # 166 if raw: 167 C = Recv(A[0:m], myid-1, msgid, vanilla) 168 else: 169 C = Recv(myid-1, msgid) 170 Send(C, (myid+1)%numprocs, msgid, vanilla) 180 181 if method==0: 182 C = pypar.receive(myid-1, tag=msgid, vanilla=vanilla) 183 pypar.send(A[:m], destination=(myid+1)%numprocs, 184 tag=msgid, vanilla=vanilla) 185 elif method==1: 186 C = pypar.receive(myid-1, buffer=A[:m], tag=msgid, vanilla=vanilla) 187 pypar.send(A[:m], use_buffer=True, destination=(myid+1)%numprocs, 188 tag=msgid, vanilla=vanilla) 189 elif method==2: 190 # Use pypar bypass 191 C = pypar.receive(myid-1, buffer=A[:m], tag=msgid, 192 vanilla=vanilla, bypass=True) 193 pypar.send(A[:m], use_buffer=True, destination=(myid+1)%numprocs, 194 tag=msgid, vanilla=vanilla, bypass=True) 195 else: 196 raise 'Unknown method' 197 # Use direct mpiext call 198 #stat = receive_array(A[:m], myid-1, msgid) 199 #send_array(A[:m], (myid+1)%numprocs, msgid) 171 200 172 201
Note: See TracChangeset
for help on using the changeset viewer.