dobj.py 833 Bytes
Newer Older
Martin Reinecke's avatar
Martin Reinecke committed
1
2
try:
    from mpi4py import MPI
Martin Reinecke's avatar
Martin Reinecke committed
3
    if MPI.COMM_WORLD.Get_size() == 1:
Martin Reinecke's avatar
Martin Reinecke committed
4
        from .data_objects.numpy_do import *
Martin Reinecke's avatar
Martin Reinecke committed
5
        # mprint("MPI found, but only with one task, using numpy_do...")
Martin Reinecke's avatar
Martin Reinecke committed
6
7
    else:
        from .data_objects.distributed_do import *
Martin Reinecke's avatar
Martin Reinecke committed
8
        # mprint("MPI with multiple tasks found, using distributed_do...")
Martin Reinecke's avatar
Martin Reinecke committed
9
10
except ImportError:
    from .data_objects.numpy_do import *
Martin Reinecke's avatar
Martin Reinecke committed
11
12
13
14
15
16
17
18
    # mprint("MPI not found, using numpy_do...")

__all__ = ["ntask", "rank", "master", "local_shape", "data_object", "full",
           "empty", "zeros", "ones", "empty_like", "vdot", "abs", "exp",
           "log", "sqrt", "from_object", "from_random",
           "local_data", "ibegin", "np_allreduce_sum", "distaxis",
           "from_local_data", "from_global_data", "to_global_data",
           "redistribute", "default_distaxis", "mprint"]