3.1.4.8. c3po.mpi.MPIExchanger module
Contain the classes MPIExchanger and MPIShortcutToData.
MPIShortcutToData is for internal use only.
- class c3po.mpi.MPIExchanger.MPIExchanger(method, fieldsToGet, fieldsToSet, valuesToGet=[], valuesToSet=[], exchangeWithFiles=False, mpiComm=None)
Bases:
LocalExchangerMPIExchangeris the MPI version ofc3po.LocalExchanger.LocalExchanger.MPIExchangercan replace, without impact, ac3po.LocalExchanger.LocalExchangerfor a calculation on a single process, if the MPI environment is available.- __init__(method, fieldsToGet, fieldsToSet, valuesToGet=[], valuesToSet=[], exchangeWithFiles=False, mpiComm=None)
Build a
MPIExchangerobject.The constructor has the same form than
LocalExchanger.__init__()with two additional optionnal parameters:exchangeWithFilesandmpiComm.MPIExchangermust be built in the same way for all the processes involved in the exchanges. Likewise, theexchange()method must be called at the same time by all processes.The first parameter,
method, can be either ac3po.mpi.mpiExchangeMethods.MPIExchangeMethod.MPIExchangeMethodor not:In the first case, the exchange method has to deal with data exchanges between MPI processes (in addition to local data processing such as unit change).
MPIRemoteProcessandMPIRemoteProcessesare accepted, but notMPICollectiveProcess.In the second case, these exchanges between MPI processes are done by
MPIExchanger. The class manages MPI exchanges and then uses the local exchange method with the mother class. In this case, it is assumed that an object is either held by a single process (and is replace by aMPIRemoteProcessin others), or collectively (MPICollectiveProcess). When there is anMPICollectiveProcesson the set side, all the processes of the communicator of this object must be involved in the exchanges.MPIRemoteProcessesare accepted only if no exchange are required.
- Parameters:
method – See
LocalExchanger.__init__().fieldsToGet –
LocalExchanger.__init__().fieldsToSet –
LocalExchanger.__init__().valuesToGet –
LocalExchanger.__init__().valuesToSet –
LocalExchanger.__init__().exchangeWithFiles (bool) – (Only available with an exchange method that is not of type
c3po.mpi.mpiExchangeMethods.MPIExchangeMethod.MPIExchangeMethod.) WhenexchangeWithFilesis set to True, exchanged MEDField are written on files and read by the recipient process(es). Only basic data (such as the file path) are exchanged via MPI.mpiComm – (Only available with an exchange method that is of type
c3po.mpi.mpiExchangeMethods.MPIExchangeMethod.MPIExchangeMethod.) If not None, it indicated to the exchange method to use this communicator for data exchange. Otherwise, allMPIRemoteProcessandMPIRemoteProcessesmust use the same communicator, which is then used by the exchange method.
- clean()
See
c3po.Exchanger.clean().
- exchange()
Trigger the exchange of data.
Must be called at the same time by all processes.