Пример #1
0
        import sys
        sys.exit()

    def Finalize():
        pass

    def Barrier():
        pass

    def Wtime():
        import time
        return time.time()

else:

    from mpiext import size, rank, Barrier, Wtime, Get_processor_name,\
                    init, Initialized, Finalize, Abort,\
                    send_string, receive_string,\
                    send_array, receive_array, bcast_string, bcast_array,\
                    scatter_string, scatter_array,\
                    gather_string, gather_array,\
                    reduce_array,\
                    MPI_ANY_TAG as any_tag, MPI_ANY_SOURCE as any_source,\
                    MAX, MIN, SUM, PROD, LAND, BAND,\
                    LOR, BOR, LXOR, BXOR

    init(sys.argv)  #Initialise MPI with cmd line (needed by MPICH/Linux)

    if rank() == 0:
        print "MPI initialised OK with %d processors" % size()
Пример #2
0
else:

    from mpiext import size, rank, barrier, time,\
         get_processor_name,\
         init, initialized, finalize, abort,\
         send_string, receive_string,\
         send_array, receive_array, broadcast_string, broadcast_array,\
         scatter_string, scatter_array,\
         gather_string, gather_array,\
         reduce_array,\
	 bsend_string, bsend_array, \
	 mpi_alloc_and_attach, mpi_detach_and_dealloc, \
	 mpi_alloc, mpi_dealloc, mpi_attach, mpi_detach, \
	 string_push_for_alloc_and_attach, array_push_for_alloc_and_attach, \
         MPI_ANY_TAG as any_tag, MPI_TAG_UB as max_tag,\
         MPI_ANY_SOURCE as any_source,\
         MAX, MIN, SUM, PROD, LAND, BAND,\
         LOR, BOR, LXOR, BXOR

    init(sys.argv) #Initialise MPI with cmd line (needed by MPICH/Linux)

    if rank() == 0:     
        print "Pypar (version %s) initialised MPI OK with %d processors" %(__version__, size())






Пример #3
0
  string_push_for_alloc_and_attach, array_push_for_alloc_and_attach, \
         MPI_ANY_TAG as any_tag, MPI_TAG_UB as max_tag,\
         MPI_ANY_SOURCE as any_source,\
         MAX, MIN, SUM, PROD, LAND, BAND,\
         LOR, BOR, LXOR, BXOR

    # Work around bug in OpenMPI (December 2009):
    # https://bugs.launchpad.net/ubuntu/+source/petsc4py/+bug/232036
    from ctypes import *

    # fix for macos (added by Abhishek Dutta, 16 May 2017)
    # source : https://github.com/TaikiKato/pypar/issues/2
    #mpi = CDLL('libmpi.so.0', RTLD_GLOBAL)
    if sys.platform == 'darwin':  # works on OSX
        mpi = CDLL('libmpi.dylib', RTLD_GLOBAL)
    else:
        try:
            mpi = CDLL('libmpi.so.0', RTLD_GLOBAL)
        except OSError:
            mpi = CDLL('libmpi.so', RTLD_GLOBAL)

    # End work around

    # Initialise MPI with cmd line (needed by MPICH/Linux)
    init(sys.argv)

    # Report
    if rank() == 0:
        print 'Pypar (version %s) initialised MPI OK with %d processors'\
            % (__version__, size())
Пример #4
0
         gather_string, gather_array,\
         reduce_array,\
	 bsend_string, bsend_array, \
	 mpi_alloc_and_attach, mpi_detach_and_dealloc, \
	 mpi_alloc, mpi_dealloc, mpi_attach, mpi_detach, \
	 string_push_for_alloc_and_attach, array_push_for_alloc_and_attach, \
         MPI_ANY_TAG as any_tag, MPI_TAG_UB as max_tag,\
         MPI_ANY_SOURCE as any_source,\
         MAX, MIN, SUM, PROD, LAND, BAND,\
         LOR, BOR, LXOR, BXOR

    # Work around bug in OpenMPI (December 2009):
    # https://bugs.launchpad.net/ubuntu/+source/petsc4py/+bug/232036
    from ctypes import *
    CDLL('libmpi.so', RTLD_GLOBAL)
    # End work around

    # Initialise MPI with cmd line (needed by MPICH/Linux)
    init(sys.argv)

    # Report
    if rank() == 0:
        print 'Pypar (version %s) initialised MPI OK with %d processors'\
            % (__version__, size())