コード例 #1
0
ファイル: test.py プロジェクト: fred1653/lotsofcoresbook1code
def main():
    if 0 == me:
        if MIRROR:
            print ' Performing tests on Mirrored Arrays'
        print ' GA initialized'

    # note that MA is not used, so no need to initialize it
    # "import ga" registers malloc/free as memory allocators internally

    #if nproc-1 == me:
    if 0 == me:
        print 'using %d process(es) %d custer nodes' % (
                nproc, ga.cluster_nnodes())
        print 'process %d is on node %d with %d processes' % (
                me, ga.cluster_nodeid(), ga.cluster_nprocs(-1))

    # create array to force staggering of memory and uneven distribution
    # of pointers
    dim1 = MEM_INC
    mapc = [0]*nproc
    for i in range(nproc):
        mapc[i] = MEM_INC*i
        dim1 += MEM_INC*i
    g_s = ga.create_handle()
    ga.set_data(g_s, [dim1], ga.C_INT)
    ga.set_array_name(g_s, 's')
    ga.set_irreg_distr(g_s, mapc, [nproc])

    if MIRROR:
        if 0 == me:
            print '\nTESTING MIRRORED ARRAYS\n'

    # check support for single precision arrays
    if 0 == me:
        print '\nCHECKING SINGLE PRECISION\n'
    check_float()

    # check support for double precision arrays
    if 0 == me:
        print '\nCHECKING DOUBLE PRECISION\n'
    check_double()

    # check support for single precision complex arrays
    if 0 == me:
        print '\nCHECKING SINGLE COMPLEX\n'
    check_complex_float()

    # check support for double precision complex arrays
    if 0 == me:
        print '\nCHECKING DOUBLE COMPLEX\n'
    check_complex_double()

    # check support for integer arrays
    if 0 == me:
        print '\nCHECKING INT\n'
    check_int()

    # check support for long integer arrays
    if 0 == me:
        print '\nCHECKING LONG INT\n'
    check_long()

    if 0 == me:
        print '\nCHECKING Wrappers to Message Passing Collective ops\n'
    check_wrappers()

    # check if memory limits are enforced
    #check_mem(ma_heap*ga.nnodes())

    if 0 == me: ga.print_stats()
    if 0 == me: print ' '
    if 0 == me: print 'All tests successful'
コード例 #2
0
ファイル: gain.py プロジェクト: fred1653/lotsofcoresbook1code
        import cProfile
        print "Profiling enabled"
        cProfile.run("run_tests()", "gaintest.%s.prof" % str(me()))
    elif use_groups:
        midproc = nproc()//2
        proclist_first = range(0,midproc)
        proclist_last  = range(midproc,nproc())
        group_id_first = ga.pgroup_create(proclist_first)
        group_id_last  = ga.pgroup_create(proclist_last)
        if me() in proclist_first:
            ga.pgroup_set_default(group_id_first)
            run_tests()
        ga.pgroup_set_default(ga.pgroup_get_world())
        sync()
        if me() in proclist_last:
            ga.pgroup_set_default(group_id_last)
            run_tests()
        ga.pgroup_set_default(ga.pgroup_get_world())
        sync()
        print "All done with groups"
    else:
        run_tests()
    print ""
    print "%s           Passed: %s%s" % (GREEN,passes,RESET)
    print "%sExpected Failures: %s%s" % (GREEN,x_failures,RESET)
    print "%s   NumPy Failures: %s%s" % (YELLOW,np_failures,RESET)
    print "%s    GAiN Failures: %s%s" % (RED,gain_failures,RESET)
    print "%s    Epic Failures: %s%s" % (RED,epic_failures,RESET)
    if not me():
        ga.print_stats()
コード例 #3
0
ファイル: gain.py プロジェクト: GlobalArrays/ga4py
        import cProfile
        print "Profiling enabled"
        cProfile.run("run_tests()", "gaintest.%s.prof" % str(me()))
    elif use_groups:
        midproc = nproc() // 2
        proclist_first = range(0, midproc)
        proclist_last = range(midproc, nproc())
        group_id_first = ga.pgroup_create(proclist_first)
        group_id_last = ga.pgroup_create(proclist_last)
        if me() in proclist_first:
            ga.pgroup_set_default(group_id_first)
            run_tests()
        ga.pgroup_set_default(ga.pgroup_get_world())
        sync()
        if me() in proclist_last:
            ga.pgroup_set_default(group_id_last)
            run_tests()
        ga.pgroup_set_default(ga.pgroup_get_world())
        sync()
        print "All done with groups"
    else:
        run_tests()
    print ""
    print "%s           Passed: %s%s" % (GREEN, passes, RESET)
    print "%sExpected Failures: %s%s" % (GREEN, x_failures, RESET)
    print "%s   NumPy Failures: %s%s" % (YELLOW, np_failures, RESET)
    print "%s    GAiN Failures: %s%s" % (RED, gain_failures, RESET)
    print "%s    Epic Failures: %s%s" % (RED, epic_failures, RESET)
    if not me():
        ga.print_stats()