Exemplo n.º 1
0
def parallel_task():
    me = ga.pgroup_nodeid()
    nproc = ga.pgroup_nnodes()
    if not me:
        print "This is process 0 on group %s" % ga.pgroup_get_default()
    g_a = ga.create(ga.C_DBL, (3,4,5))
    ga.randomize(g_a)
    if me == 0:
        print np.sum(ga.access(g_a))
Exemplo n.º 2
0
def parallel_task():
    me = ga.pgroup_nodeid()
    nproc = ga.pgroup_nnodes()
    ### print a message from the master of the group
    g_a = ga.create(ga.C_DBL, (3, 4, 5))
    ga.randomize(g_a)
Exemplo n.º 3
0
import mpi4py.MPI
import ga
import numpy as np

class ufunc(object):
    def __init__(self, ufunc):
        self.ufunc = ufunc
    def __call__(self, g_a):
        a = ga.access(g_a)
        if a is not None:
            self.ufunc(a,a)

sin = ufunc(np.sin)
cos = ufunc(np.cos)

g_a = ga.create(ga.C_DBL, (3,4,5))
ga.randomize(g_a)
sin(g_a)
ga.print_stdout(g_a)
cos(g_a)
ga.print_stdout(g_a)
Exemplo n.º 4
0
import mpi4py.MPI
import ga
import numpy as np

### I suggest creating a python "ufunc" class which implements __call__
###     but it's really up to you

g_a = ga.create(ga.C_DBL, (3,4,5))
ga.randomize(g_a)
### call a ufunc e.g. your_func(g_a)
ga.print_stdout(g_a)
### call a ufunc e.g. your_func(g_a)
ga.print_stdout(g_a)
Exemplo n.º 5
0
def parallel_task():
    me = ga.pgroup_nodeid()
    nproc = ga.pgroup_nnodes()
    ### print a message from the master of the group
    g_a = ga.create(ga.C_DBL, (3,4,5))
    ga.randomize(g_a)