示例#1
0
def TestPutGetAcc(g_a, n, chunk, buf, lo, hi, local):
    if 0 == me:
        print ''
        if local:
            print 'Local 2-D Array Section'
        else:
            print 'Remote 2-D Array Section'
        print '%15s %19s %19s %19s' % ('section', 'get', 'put', 'accumulate')
        print '%7s %7s %9s %9s %9s %9s %9s %9s' % (
                'bytes','dim','usec','MB/s','usec','MB/s','usec','MB/s')
    ga.sync()
    bytes = 0
    jump = 0
    num_chunks = len(chunk)
    for loop in range(num_chunks):
        tg = 0.0
        tp = 0.0
        ta = 0.0
        bytes = 8*chunk[loop]*chunk[loop] # how much data is accessed
        jump = n/(60*(loop+1)) # jump between consecutive patches
        if loop+1 == num_chunks:
            jump = 0
        # everybody touches own data
        ga.fill(g_a, me*(loop+1), [0,0], [n,n])
        if 0 == me:
            tg = time_get(g_a, lo, hi, buf, chunk[loop], jump, local)
        else:
            time.sleep(1)
        # everybody touches own data
        ga.fill(g_a, me*(loop+1), [0,0], [n,n])
        if 0 == me:
            tp = time_put(g_a, lo, hi, buf, chunk[loop], jump, local)
        else:
            time.sleep(1)
        # everybody touches own data
        ga.fill(g_a, me*(loop+1), [0,0], [n,n])
        if 0 == me:
            ta = time_acc(g_a, lo, hi, buf, chunk[loop], jump, local)
        else:
            time.sleep(1)
        if 0 == me:
            print '%7d %7d %8.3e %8.3e %8.3e %8.3e %8.3e %8.3e' % (
                    bytes, chunk[loop],
                    tg/1e-6, 1e-6*bytes/tg,
                    tp/1e-6, 1e-6*bytes/tp,
                    ta/1e-6, 1e-6*bytes/ta)
示例#2
0
def TestPutGetAcc(g_a, n, chunk, buf, lo, hi, local):
    if 0 == me:
        print ''
        if local:
            print 'Local 2-D Array Section'
        else:
            print 'Remote 2-D Array Section'
        print '%15s %19s %19s %19s' % ('section', 'get', 'put', 'accumulate')
        print '%7s %7s %9s %9s %9s %9s %9s %9s' % (
            'bytes', 'dim', 'usec', 'MB/s', 'usec', 'MB/s', 'usec', 'MB/s')
    ga.sync()
    bytes = 0
    jump = 0
    num_chunks = len(chunk)
    for loop in range(num_chunks):
        tg = 0.0
        tp = 0.0
        ta = 0.0
        bytes = 8 * chunk[loop] * chunk[loop]  # how much data is accessed
        jump = n / (60 * (loop + 1))  # jump between consecutive patches
        if loop + 1 == num_chunks:
            jump = 0
        # everybody touches own data
        ga.fill(g_a, me * (loop + 1), [0, 0], [n, n])
        if 0 == me:
            tg = time_get(g_a, lo, hi, buf, chunk[loop], jump, local)
        else:
            time.sleep(1)
        # everybody touches own data
        ga.fill(g_a, me * (loop + 1), [0, 0], [n, n])
        if 0 == me:
            tp = time_put(g_a, lo, hi, buf, chunk[loop], jump, local)
        else:
            time.sleep(1)
        # everybody touches own data
        ga.fill(g_a, me * (loop + 1), [0, 0], [n, n])
        if 0 == me:
            ta = time_acc(g_a, lo, hi, buf, chunk[loop], jump, local)
        else:
            time.sleep(1)
        if 0 == me:
            print '%7d %7d %8.3e %8.3e %8.3e %8.3e %8.3e %8.3e' % (
                bytes, chunk[loop], tg / 1e-6, 1e-6 * bytes / tg, tp / 1e-6,
                1e-6 * bytes / tp, ta / 1e-6, 1e-6 * bytes / ta)
示例#3
0
import mpi4py.MPI  # initialize Message Passing Interface
from ga4py import ga  # initialize Global Arrays

me = ga.nodeid()


def print_distribution(g_a):
    for i in range(ga.nnodes()):
        lo, hi = ga.distribution(g_a, i)
        print "%s lo=%s hi=%s" % (i, lo, hi)


# create some arrays
g_a = ga.create(ga.C_DBL, (10, 20, 30), chunk=(-1, 20, -1))
g_b = ga.create(ga.C_DBL, (10, 20, 30), chunk=(10, -1, -1))

if not me:
    print_distribution(g_a)
    print_distribution(g_b)

ga.fill(g_a, 6)
ga.copy(g_a, g_b)

if not me:
    buffer = ga.access(g_b)
    print buffer.shape
    print buffer
示例#4
0
import mpi4py.MPI # initialize Message Passing Interface
from ga4py import ga # initialize Global Arrays

me = ga.nodeid()

def print_distribution(g_a):
    for i in range(ga.nnodes()):
        lo,hi = ga.distribution(g_a, i)
        print "%s lo=%s hi=%s" % (i,lo,hi)

# create some arrays
g_a = ga.create(ga.C_DBL, (10,20,30), chunk=(-1,20,-1))
g_b = ga.create(ga.C_DBL, (10,20,30), chunk=(10,-1,-1))

if not me:
    print_distribution(g_a)
    print_distribution(g_b)

ga.fill(g_a, 6)
ga.copy(g_a,g_b)

if not me:
    buffer = ga.access(g_b)
    print buffer.shape
    print buffer