Changeset 123 for pypar/pytiming


Ignore:
Timestamp:
Jul 11, 2005, 3:20:03 PM (20 years ago)
Author:
ole
Message:

Files for 64 bit machine + latest Cvs version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pypar/pytiming

    r85 r123  
    1414import pypar
    1515
     16#from mpiext import send_array, receive_array  #most direct methods
     17#Not available in final install - use bypass form for now
     18
    1619#--------------------------------------------------------------
    1720
    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
     21method = 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                 
     28vanilla = False  # Force use of vanilla format (1)
     29consistency_check = False # Check correctness
    2930
    3031
     
    103104seed(17, 53)
    104105A = uniform(0.0,100.0,MAXM)
    105 #A = uniform(0,100,MAXM).astype('l')
    106106elsize = A.itemsize()
    107107#print elsize
     
    144144      #
    145145      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       
    151165      t2 = pypar.Wtime() - t1 - cpuOH
    152166      t2 = t2/numprocs
     
    164178      # Parallel process - get msg and pass it on
    165179      #
    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)
    171200
    172201
Note: See TracChangeset for help on using the changeset viewer.