|
ESyS-Particle
2.3.4
|
MPI send/recv buffer with automagically adjusted size. More...
#include <mpivbuf.h>


Public Member Functions | |
| CVarMPIBuffer (MPI_Comm, int size=16) | |
| virtual | ~CVarMPIBuffer () |
| virtual void | clear () |
| virtual void | sendTo (int, int) |
| virtual void | NBsendTo (int, int) |
| virtual void | initSendTo (int, int) |
| virtual void | wait () |
| virtual void | receiveFrom (int src=MPI_ANY_SOURCE, int tag=MPI_ANY_TAG) |
| virtual void | append (int) |
| virtual void | append (double) |
| virtual void | append (const char *) |
| virtual void | append (const Vec3 &V) |
| virtual int | pop_int () |
| virtual double | pop_double () |
| virtual void | pop_doubles (double *, int) |
| virtual std::string | pop_string () |
| virtual void | broadcast (int) |
| virtual void | receiveBroadcast (int) |
Public Member Functions inherited from AMPIBufferPP | |
| AMPIBufferPP (MPI_Comm comm) | |
| virtual | ~AMPIBufferPP () |
Public Member Functions inherited from AMPIBuffer | |
| AMPIBuffer (MPI_Comm comm) | |
| virtual | ~AMPIBuffer () |
| virtual Vec3 | pop_vector () |
| const MPI_Status & | status () |
Protected Member Functions | |
| void | grow () |
| void | growTo (int) |
Private Attributes | |
| char * | m_buffer |
| int | m_buffersize |
| the size of the buffer More... | |
| int | m_position |
| the current end of the content More... | |
| int | m_int_increment |
| int | m_dbl_increment |
| the "packing size" of int/double More... | |
| bool | m_lock |
| MPI_Request | m_req [2] |
| MPI_Status | m_stat [2] |
| for the ISendTo/Wait stuff More... | |
Additional Inherited Members | |
Protected Attributes inherited from AMPIBuffer | |
| MPI_Comm | m_comm |
| the MPI Communicator used for the send/recv operations More... | |
| MPI_Status | m_status |
MPI send/recv buffer with automagically adjusted size.
CVarMPIBuffer implements a send/receive buffer with variable size. The buffer grows automatically if neccesary with each append operation and when the a message is received. It is never automatically shrunk. Both append and send/recv operations slower than a constant size buffer (CMPIBuffer)
| CVarMPIBuffer::CVarMPIBuffer | ( | MPI_Comm | comm, |
| int | size = 16 |
||
| ) |
Constructor. Allocates the buffer and sets the MPI communicator to be used for send/receive operations. If the initial buffer size is not given a buffer of initial size 16 is allocated.
| comm | the MPI communicator |
| s | the initial size of the buffer, defaults to 16 |
References m_buffer, m_buffersize, AMPIBuffer::m_comm, m_dbl_increment, m_int_increment, m_lock, and m_position.
|
virtual |
References m_buffer.
|
virtual |
Append a string to the buffer. If necessary, the buffer is enlarged.
Implements AMPIBuffer.
References grow(), esys::lsm::bpu::len(), m_buffer, m_buffersize, AMPIBuffer::m_comm, m_int_increment, and m_position.

|
inlinevirtual |
Reimplemented from AMPIBuffer.
References AMPIBuffer::append().

|
virtual |
Append a double to the buffer. If necessary, the buffer is enlarged.
Implements AMPIBuffer.
References grow(), m_buffer, m_buffersize, AMPIBuffer::m_comm, m_dbl_increment, and m_position.

|
virtual |
Append an integer to the buffer. If necessary, the buffer is enlarged.
Implements AMPIBuffer.
References grow(), m_buffer, m_buffersize, AMPIBuffer::m_comm, m_int_increment, and m_position.
Referenced by CLatticeMaster::addBondedIG(), CLatticeMaster::addCappedBondedIG(), CLatticeMaster::addExIG(), CLatticeMaster::addMesh2D(), CLatticeMaster::addRotBondedIG(), CLatticeMaster::addRotThermBondedIG(), CLatticeMaster::addShortBondedIG(), BroadcastCommand::append(), BroadcastCommand::appendTypeAndName(), CLatticeMaster::applyForceToWall(), CLatticeMaster::createTriMesh(), CLatticeMaster::do2dCalculations(), CLatticeMaster::findParticleNearestTo(), CLatticeMaster::getParticlePosn(), CLatticeMaster::moveParticleTo(), CLatticeMaster::moveSingleNodeBy(), CLatticeMaster::moveSingleParticleTo(), CLatticeMaster::moveSphereBodyBy(), CLatticeMaster::moveTaggedNodesBy(), CLatticeMaster::moveTaggedParticlesBy(), CLatticeMaster::moveWallBy(), ABCDampingIGP::packInto(), CEWallIGP::packInto(), CBWallIGP::packInto(), CDampingIGP::packInto(), CElasticIGP::packInto(), CESphereBodyIGP::packInto(), AIGParam::packInto(), CLocalDampingIGP::packInto(), CRotElasticIGP::packInto(), CRotThermElasticIGP::packInto(), CSoftBWallIGP::packInto(), CVWallIGP::packInto(), esys::lsm::BodyForceIGP::packInto(), esys::lsm::BuoyancyIGP::packInto(), CLatticeMaster::saveTimingDataToFile(), CLatticeMaster::setParticleAngVel(), CLatticeMaster::setParticleDensity(), CLatticeMaster::setParticleNonDynamic(), CLatticeMaster::setParticleNonRot(), CLatticeMaster::setParticleNonTrans(), CLatticeMaster::setParticleVel(), CLatticeMaster::setTaggedParticleVel(), CLatticeMaster::setVelocityOfWall(), CLatticeMaster::setWallNormal(), and CLatticeMaster::tagParticleNearestTo().


|
virtual |
Broadcast a message to all members of the communicator.
| root | the root of the broadcast |
References m_buffer, AMPIBuffer::m_comm, and m_position.
Referenced by CLatticeMaster::addBondedIG(), CLatticeMaster::addCappedBondedIG(), CLatticeMaster::addExIG(), CLatticeMaster::addMesh2D(), CLatticeMaster::addRotBondedIG(), CLatticeMaster::addRotThermBondedIG(), CLatticeMaster::addShortBondedIG(), CLatticeMaster::applyForceToWall(), BroadcastCommand::broadcastBuffer(), CLatticeMaster::createTriMesh(), CLatticeMaster::do2dCalculations(), CLatticeMaster::findParticleNearestTo(), CLatticeMaster::getParticlePosn(), CheckPointController::issueCheckPointCmd(), CheckPointController::issueCheckPointCmdWTM(), CheckPointController::issueCheckPointLoadingCmd(), CheckPointController::issueSnapShotCmd(), CLatticeMaster::makeLattice(), CLatticeMaster::moveParticleTo(), CLatticeMaster::moveSingleNodeBy(), CLatticeMaster::moveSingleParticleTo(), CLatticeMaster::moveSphereBodyBy(), CLatticeMaster::moveTaggedNodesBy(), CLatticeMaster::moveTaggedParticlesBy(), CLatticeMaster::moveWallBy(), CLatticeMaster::saveTimingDataToFile(), CLatticeMaster::setParticleAngVel(), CLatticeMaster::setParticleDensity(), CLatticeMaster::setParticleNonDynamic(), CLatticeMaster::setParticleNonRot(), CLatticeMaster::setParticleNonTrans(), CLatticeMaster::setParticleVel(), CLatticeMaster::setTaggedParticleVel(), CLatticeMaster::setVelocityOfWall(), CLatticeMaster::setWallNormal(), and CLatticeMaster::tagParticleNearestTo().

|
inlinevirtual |
Implements AMPIBuffer.
References m_position.
Referenced by CheckPointController::issueCheckPointCmd(), CheckPointController::issueCheckPointCmdWTM(), CheckPointController::issueCheckPointLoadingCmd(), CheckPointController::issueSnapShotCmd(), CLatticeMaster::makeLattice(), and CLatticeMaster::saveTimingDataToFile().

|
protected |
Grows the buffer to twice its current size, thus guaranteeing that append works in amortized constant time.
References growTo(), and m_buffersize.
Referenced by append().


|
protected |
Grows the buffer to a given size. If the buffer is already larger that the given size, nothing is done. Used by receiveFrom.
| size | size to which the buffer is grown |
References m_buffer, m_buffersize, and m_position.
Referenced by grow(), receiveBroadcast(), and receiveFrom().

|
virtual |
Initate send,lock buffer and immediately return (equivalent to MPI_Isend)
| dest | the rank of the destination process in the current communicator |
| tag | the message tag |
References console, Console::Critical(), m_buffer, AMPIBuffer::m_comm, m_lock, m_position, and m_req.

|
virtual |
Nonblocking version of CVarMPIBuffer::sendTo. Uses MPI_Isend and is (should be) thus deadlock-safe.
| dest | the rank of the destination process in the current communicator |
| tag | the message tag |
References m_buffer, AMPIBuffer::m_comm, and m_position.
|
virtual |
Pops a double from the buffer.
Implements AMPIBuffer.
References m_buffer, m_buffersize, AMPIBuffer::m_comm, and m_position.
Referenced by TSubLattice< T >::addBondedIG(), TSubLattice< T >::addBondedMesh2DIG(), TSubLattice< T >::addBondedTriMeshIG(), TSubLattice< T >::addCappedBondedIG(), TSubLattice< T >::addMesh2DIG(), TRotSubLattice< T >::addRotBondedIG(), TRotSubLattice< T >::addRotThermBondedIG(), TSubLattice< T >::addShortBondedIG(), TSubLattice< T >::addSphereBody(), TSubLattice< T >::addTriMeshIG(), TSubLattice< T >::doAddPIG(), esys::lsm::BodyForceIGP::extract(), esys::lsm::BuoyancyIGP::extract(), TSubLattice< T >::setParticleDensity(), and CSubLatticeControler::setTimeStepSize().

|
virtual |
pop an array of doubles from a buffer
Implements AMPIBuffer.
References m_buffer, m_buffersize, AMPIBuffer::m_comm, and m_position.
|
virtual |
Pops an integer from the buffer, i.e. it pops the last sizeof(MPI_INT) bytes of the buffer, interpreting them ans an int.
Implements AMPIBuffer.
References m_buffer, m_buffersize, AMPIBuffer::m_comm, and m_position.
Referenced by TSubLattice< T >::addBondedIG(), TSubLattice< T >::addBondedMesh2DIG(), TSubLattice< T >::addBondedTriMeshIG(), TSubLattice< T >::addCappedBondedIG(), TRotSubLattice< T >::addRotBondedIG(), TRotSubLattice< T >::addRotThermBondedIG(), TSubLattice< T >::addShortBondedIG(), TSubLattice< T >::addTaggedElasticWIG(), CSubLatticeControler::do2dCalculations(), TSubLattice< T >::doAddPIG(), CSubLatticeControler::getParticlePosn(), CSubLatticeControler::initializeConsole(), TSubLattice< T >::moveParticleTo(), TSubLattice< T >::moveSingleNode(), CSubLatticeControler::moveSingleParticle(), TSubLattice< T >::moveTaggedNodes(), TSubLattice< T >::moveTaggedParticlesBy(), CSubLatticeControler::setConsoleBuffered(), TRotSubLattice< T >::setParticleAngularVelocity(), TSubLattice< T >::setParticleDensity(), TSubLattice< T >::setParticleNonDynamic(), TSubLattice< T >::setParticleNonRot(), TSubLattice< T >::setParticleNonTrans(), TSubLattice< T >::setParticleVelocity(), TSubLattice< T >::setTaggedParticleVel(), CSubLatticeControler::setVerbosity(), and TSubLattice< T >::tagParticleNearestTo().

|
virtual |
Pops a string from the buffer. The first for bytes are interpreted as int, giving the length of the string (without terminating '\0'), the rest as the characters.
Implements AMPIBuffer.
References esys::lsm::bpu::len(), m_buffer, m_buffersize, AMPIBuffer::m_comm, and m_position.
Referenced by TSubLattice< T >::addBondedIG(), TSubLattice< T >::addBondedMesh2DIG(), TSubLattice< T >::addBondedTriMeshIG(), TSubLattice< T >::addCappedBondedIG(), TSubLattice< T >::addDamping(), TSubLattice< T >::addMesh2D(), TSubLattice< T >::addMesh2DIG(), TSubLattice< T >::addPairIG(), TRotSubLattice< T >::addRotBondedIG(), TRotSubLattice< T >::addRotThermBondedIG(), TSubLattice< T >::addShortBondedIG(), TSubLattice< T >::addSingleIG(), TSubLattice< T >::addSphereBody(), TSubLattice< T >::addTaggedPairIG(), TSubLattice< T >::addTriMesh(), TSubLattice< T >::addTriMeshIG(), TSubLattice< T >::addWall(), TSubLattice< T >::applyForceToWall(), esys::lsm::BodyForceIGP::extract(), esys::lsm::BuoyancyIGP::extract(), TSubLattice< T >::getMesh2DStress(), TSubLattice< T >::getMeshFaceRef(), TSubLattice< T >::getMeshNodeRef(), TSubLattice< T >::getSphereBodyForce(), TSubLattice< T >::getSphereBodyPos(), TSubLattice< T >::getTriMeshForce(), TSubLattice< T >::getWallForce(), TSubLattice< T >::getWallPos(), CSubLatticeControler::initializeConsole(), TSubLattice< T >::moveSingleNode(), TSubLattice< T >::moveSphereBodyBy(), TSubLattice< T >::moveTaggedNodes(), TSubLattice< T >::moveWallBy(), CSubLatticeControler::performTiming(), TSubLattice< T >::removeIG(), CSubLatticeControler::setConsoleFilename(), TSubLattice< T >::setExIG(), TSubLattice< T >::setVelocityOfWall(), TSubLattice< T >::setWallNormal(), and CSubLatticeControler::translateMeshBy().


|
virtual |
receive broadcast
| root | the root of the broadcast |
References growTo(), m_buffer, m_buffersize, and AMPIBuffer::m_comm.
Referenced by TSubLattice< T >::addBondedIG(), TSubLattice< T >::addBondedMesh2DIG(), TSubLattice< T >::addBondedTriMeshIG(), TSubLattice< T >::addBondedWIG(), TSubLattice< T >::addCappedBondedIG(), TSubLattice< T >::addDamping(), TSubLattice< T >::addDirBondedWIG(), TSubLattice< T >::addElasticWIG(), TSubLattice< T >::addESphereBodyIG(), TSubLattice< T >::addMesh2D(), TSubLattice< T >::addMesh2DIG(), TSubLattice< T >::addPairIG(), TRotSubLattice< T >::addRotBondedIG(), TRotSubLattice< T >::addRotThermBondedIG(), TSubLattice< T >::addShortBondedIG(), TSubLattice< T >::addSingleIG(), TSubLattice< T >::addSphereBody(), TSubLattice< T >::addTaggedElasticWIG(), TSubLattice< T >::addTaggedPairIG(), TSubLattice< T >::addTriMesh(), TSubLattice< T >::addTriMeshIG(), TSubLattice< T >::addViscWIG(), TSubLattice< T >::addWall(), TSubLattice< T >::applyForceToWall(), CSubLatticeControler::do2dCalculations(), CSubLatticeControler::findParticleNearestToPoint(), TSubLattice< T >::getMesh2DStress(), TSubLattice< T >::getMeshFaceRef(), TSubLattice< T >::getMeshNodeRef(), CSubLatticeControler::getParticlePosn(), TSubLattice< T >::getSphereBodyForce(), TSubLattice< T >::getSphereBodyPos(), TSubLattice< T >::getTriMeshForce(), TSubLattice< T >::getWallForce(), TSubLattice< T >::getWallPos(), ASubLattice::initComplex(), CSubLatticeControler::initializeConsole(), CheckPointer::loadCheckPoint(), CSubLatticeControler::makeLattice(), TSubLattice< T >::moveParticleTo(), TSubLattice< T >::moveSingleNode(), CSubLatticeControler::moveSingleParticle(), TSubLattice< T >::moveSphereBodyBy(), TSubLattice< T >::moveTaggedNodes(), TSubLattice< T >::moveTaggedParticlesBy(), TSubLattice< T >::moveWallBy(), CSubLatticeControler::performTiming(), TSubLattice< T >::removeIG(), CheckPointer::saveDump(), CheckPointer::saveRestartable(), CheckPointer::saveThroughMaster(), CSubLatticeControler::setConsoleBuffered(), CSubLatticeControler::setConsoleFilename(), TSubLattice< T >::setExIG(), TRotSubLattice< T >::setParticleAngularVelocity(), TSubLattice< T >::setParticleDensity(), TSubLattice< T >::setParticleNonDynamic(), TSubLattice< T >::setParticleNonRot(), TSubLattice< T >::setParticleNonTrans(), TSubLattice< T >::setParticleVelocity(), TSubLattice< T >::setTaggedParticleVel(), CSubLatticeControler::setTimeStepSize(), TSubLattice< T >::setVelocityOfWall(), CSubLatticeControler::setVerbosity(), TSubLattice< T >::setWallNormal(), TSubLattice< T >::tagParticleNearestTo(), and CSubLatticeControler::translateMeshBy().

|
virtual |
Receives a message from a given source and stores it in the buffer.The size of the buffer is automatically adjusted so it will be big enough to fit the message. For this reason 2 messages are received, the first one for the size of the data, the second one for the data. If no source and no tag are given, any message from any source is accepted.
| src | rank of the sender in the current communicator, defaults to MPI_ANY_SOURCE |
| tag | the message tag, defaults to MPI_ANY_TAG |
Implements AMPIBufferPP.
References growTo(), m_buffer, m_buffersize, AMPIBuffer::m_comm, and AMPIBuffer::m_status.

|
virtual |
Sends the contents of the buffer to a given destination. There are actually two messages sent, the first one announces the size of the buffer so the buffer on the receiving end can be grown if necessary, the second one does the transfer of the data. It uses buffered sends (MPI_Bsend) and it thus deadlock-save
| dest | the rank of the destination process in the current communicator |
| tag | the message tag |
Implements AMPIBufferPP.
References m_buffer, AMPIBuffer::m_comm, and m_position.
|
virtual |
|
private |
Referenced by append(), broadcast(), CVarMPIBuffer(), growTo(), initSendTo(), NBsendTo(), pop_double(), pop_doubles(), pop_int(), pop_string(), receiveBroadcast(), receiveFrom(), sendTo(), and ~CVarMPIBuffer().
|
private |
the size of the buffer
Referenced by append(), CVarMPIBuffer(), grow(), growTo(), pop_double(), pop_doubles(), pop_int(), pop_string(), receiveBroadcast(), and receiveFrom().
|
private |
the "packing size" of int/double
Referenced by append(), and CVarMPIBuffer().
|
private |
Referenced by append(), and CVarMPIBuffer().
|
private |
Referenced by CVarMPIBuffer(), initSendTo(), and wait().
|
private |
the current end of the content
Referenced by append(), broadcast(), clear(), CVarMPIBuffer(), growTo(), initSendTo(), NBsendTo(), pop_double(), pop_doubles(), pop_int(), pop_string(), and sendTo().
|
private |
Referenced by initSendTo(), and wait().
|
private |
for the ISendTo/Wait stuff
Referenced by wait().