MPIRedirect class

Class containing a kind of RMI implementation over MPI.

class pypdevs.MPIRedirect.LocalRedirect(server)[source]

Local redirector class

__getattr__(name)[source]

Determine whether or not we should redirect the call to the local or the remote server

Parameters

name – the name of the function to call

Returns

function – function to be actually called to perform the action

__getinitargs__()[source]

For pickling

Returns

list containing the rank

__getstate__()[source]

For pickling

Returns

dictionary containing the rank and the oneway list

__init__(server)[source]

Constructor.

Parameters

server – the local server

__setstate__(state)[source]

For pickling

Parameters

state – the dictionary provided by the __getstate__ method

__weakref__

list of weak references to the object (if defined)

localCall(method, *args, **kwargs)[source]

Actually perform the local call

Parameters

method – the name of the method

Returns

the return value of the function, None if it is a oneway call

class pypdevs.MPIRedirect.MPIFaker[source]

A dummy implementation of MPI4Py if none is found

static Get_rank()[source]

Return the rank of the current process in the MPI world. Always 0, since it is only used in cases where local simulation is done.

Returns

int – rank of the current process

static Get_size()[source]

Return the size of the MPI world. Always 1, since it is only used in cases where local simulation is done.

Returns

int – number of MPI processes running

__weakref__

list of weak references to the object (if defined)

class pypdevs.MPIRedirect.MPIRedirect(rank)[source]

Redirect all calls to an instantiation of this class to the server for which it was created, uses MPI (or the dummy implementation).

For speed, it contains an optimisation when the call is actually done locally (it will simply start a thread then). This complete implemenation is based on so called ‘magic functions’ from Python.

__getattr__(name)[source]

Determine whether or not we should redirect the call to the local or the remote server

Parameters

name – the name of the function to call

Returns

function – function to be actually called to perform the action

__getinitargs__()[source]

For pickling

Returns

list containing the rank

__getstate__()[source]

For pickling

Returns

dictionary containing the rank and the oneway list

__init__(rank)[source]

Constructor.

Parameters
  • rank – the rank of the server to redirect the call to

  • oneways – iterable containing all functions that should be done without waiting for completion

__setstate__(state)[source]

For pickling

Parameters

state – the dictionary provided by the __getstate__ method

__weakref__

list of weak references to the object (if defined)

remoteCall(method, *args, **kwargs)[source]

Make the remote call

Parameters

method – method name to call (as a string)

Returns

return value of the called method; always None in case it is a one-way call

pypdevs.MPIRedirect.cleaning()[source]

Clean up the list of all waiting asynchronous connections

Should be ran on a seperate thread and will simply wait on the connection status to be ‘complete’. This is necessary for the MPI specification.