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
- __setstate__(state)[source]¶
For pickling
- Parameters
state – the dictionary provided by the __getstate__ method
- __weakref__¶
list of weak references to the object (if defined)
- 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
- __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)