예제 #1
0
                x.append(j[0])
                y.append(j[1])
        nvertices = len(x)
        pts = np.empty((nvertices, 3))
        pts[:,0] = x
        pts[:,1] = y
        pts[:,2] = geoms
    else:
        nvertices = None

    nvertices = comm.bcast(nvertices)
    shape = (nvertices, 3)
    comm.Barrier()

    if rank == 0:
        local_hi = globalsort(comm, rank, shape, pts=pts, axis='y')
    else:
        local_hi = globalsort(comm, rank, shape, pts=None, axis='y')

    '''
    for i in range(comm.size):
        if rank == i:
            print i, local_hi[local_hi[:,0].argsort()]
            sys.exit()
    '''
    comm.Barrier()

    #Compute coincident x geometries
    local_hi = local_hi[np.lexsort((local_hi[:,0], local_hi[:,1]))]
    #if rank == 0:
        #a = local_hi
예제 #2
0
        pts[:,0] = x
        pts[:,1] = y
        pts[:,2] = geoms
        t3 = time.time()
        print "File I/O required {} seconds".format(t3 - t2)
    else:
        nvertices = None
   
    npivots = int(sys.argv[2])

    nvertices = comm.bcast(nvertices)
    shape = (nvertices, 3)
    comm.Barrier()
    
    if rank == 0:
        local_hi = globalsort(comm, rank, shape, pts=pts,
                              axis='y', samplesize = npivots)
    else:
        local_hi = globalsort(comm, rank, shape, pts=None,
                              axis='y', samplesize = npivots)

    ''' 
    for i in range(comm.size):
        if rank == i:
            print i, local_hi[local_hi[:,0].argsort()].shape
            sys.exit()
    '''
    comm.Barrier()

    if rank == 0:
        t4 = time.time()
        print "Global sort took {} seconds".format(t4 - t3)
예제 #3
0
    return cij


if __name__ == '__main__':
    comm = MPI.COMM_WORLD
    rank = comm.Get_rank()
    shape = (int(sys.argv[1]),3)
    rstate = np.random.RandomState(123456)
    horizontal_pivots = np.linspace(0, 1.0, comm.size + 1)

    #Phase I: Compute Hi bounds and sort the points - this get the points local to the cores as well
    if rank == 0:
        #Generate an array of points
        pts = rstate.rand(shape[0], shape[1])
        pts[:,2] = np.arange(shape[0])
        local_hi = globalsort(comm, rank, shape, pts=pts, axis='y', pivots=horizontal_pivots[1:])
    else:
        local_hi = globalsort(comm, rank, shape, pts=None, axis='y', pivots=horizontal_pivots[1:])

    '''
    for i in range(comm.size):
        if rank == i:
            print i, local_hi
            #sys.exit()
    '''
    comm.Barrier()

    #Compute the Hi nearest neighbor sets here
    hi = {}
    for i in local_hi[:,2]:
        hi[i] = (np.inf, -1)
예제 #4
0
        pts[:, 2] = geoms
        t3 = time.time()
        print "File I/O required {} seconds".format(t3 - t2)
    else:
        nvertices = None

    npivots = int(sys.argv[2])

    nvertices = comm.bcast(nvertices)
    shape = (nvertices, 3)
    comm.Barrier()

    if rank == 0:
        local_hi = globalsort(comm,
                              rank,
                              shape,
                              pts=pts,
                              axis='y',
                              samplesize=npivots)
    else:
        local_hi = globalsort(comm,
                              rank,
                              shape,
                              pts=None,
                              axis='y',
                              samplesize=npivots)
    ''' 
    for i in range(comm.size):
        if rank == i:
            print i, local_hi[local_hi[:,0].argsort()].shape
            sys.exit()
    '''