|
OOFEM 3.0
|
#include <dyncombuff.h>
Public Member Functions | |
| DynamicCommunicationBuffer (MPI_Comm comm, std::size_t size, bool dynamic=0) | |
| Constructor. Creates buffer of given size, using given communicator for packing. | |
| DynamicCommunicationBuffer (MPI_Comm comm, bool dynamic=0) | |
| Constructor. Creates empty buffer, using given communicator for packing. | |
| virtual | ~DynamicCommunicationBuffer () |
| Destructor. | |
| int | resize (std::size_t newSize) override |
| void | init () override |
| void | initForPacking () override |
| Initialize for packing. | |
| void | initForUnpacking () override |
| Initialize for Unpacking (data already received). | |
| int | write (const int *src, std::size_t n) override |
| Writes count integer values from array pointed by data. | |
| int | write (const long *src, std::size_t n) override |
| Writes count long values from array pointed by data. | |
| int | write (const unsigned long *src, std::size_t n) override |
| Writes count unsigned long values from array pointed by data. | |
| int | write (const double *src, std::size_t n) override |
| Writes count double values from array pointed by data. | |
| int | write (const char *src, std::size_t n) override |
| Writes count char values from array pointed by data. | |
| int | read (int *dest, std::size_t n) override |
| Reads count integer values into array pointed by data. | |
| int | read (long *dest, std::size_t n) override |
| Reads count long values into array pointed by data. | |
| int | read (unsigned long *dest, std::size_t n) override |
| Reads count unsigned long values into array pointed by data. | |
| int | read (double *dest, std::size_t n) override |
| Reads count double values into array pointed by data. | |
| int | read (char *dest, std::size_t n) override |
| Reads count char values into array pointed by data. | |
| int | iSend (int dest, int tag) override |
| int | iRecv (int source, int tag, std::size_t count=0) override |
| int | bcast (int root) override |
| int | testCompletion () override |
| int | waitCompletion () override |
| Public Member Functions inherited from oofem::CommunicationBuffer | |
| CommunicationBuffer (MPI_Comm comm, std::size_t size, bool dynamic=0) | |
| CommunicationBuffer (MPI_Comm comm, bool dynamic=0) | |
| Constructor. Creates empty buffer, using given communicator for packing. | |
| virtual | ~CommunicationBuffer () |
| Destructor. | |
| int | read (bool &data) override |
| Reads a bool value from data. | |
| int | write (bool data) override |
| Writes a bool value. | |
| int | givePackSizeOfInt (std::size_t count) override |
| int | givePackSizeOfDouble (std::size_t count) override |
| int | givePackSizeOfChar (std::size_t count) override |
| int | givePackSizeOfBool (std::size_t count) override |
| int | givePackSizeOfLong (std::size_t count) override |
| int | givePackSizeOfSizet (std::size_t count) override |
| int | read (int &data) |
| int | read (unsigned long &data) |
| int | read (long &data) |
| int | read (double &data) |
| int | read (char &data) |
| int | read (std ::string &data) |
| Reads a string (stored as an int for the length followed by char*). | |
| int | write (int data) |
| int | write (unsigned long data) |
| int | write (long data) |
| int | write (double data) |
| int | write (char data) |
| int | write (const std ::string &data) |
| Reads a string (stored as an int for the length followed by char*). | |
| int | write (const char *data) |
| Writes a string (wrapper needed, otherwise write(bool) is called ). | |
| Public Member Functions inherited from oofem::DataStream | |
| virtual | ~DataStream () |
| Destructor. | |
| int | read (int &data) |
| int | read (unsigned long &data) |
| int | read (long &data) |
| int | read (double &data) |
| int | read (char &data) |
| int | read (std ::string &data) |
| Reads a string (stored as an int for the length followed by char*). | |
| int | write (int data) |
| int | write (unsigned long data) |
| int | write (long data) |
| int | write (double data) |
| int | write (char data) |
| int | write (const std ::string &data) |
| Reads a string (stored as an int for the length followed by char*). | |
| int | write (const char *data) |
| Writes a string (wrapper needed, otherwise write(bool) is called ). | |
Static Public Member Functions | |
| static void | printInfo () |
Protected Types | |
| enum | DCB_Mode { DCB_null , DCB_send , DCB_receive } |
| Receiver mode. More... | |
Protected Member Functions | |
| CommunicationPacket * | allocateNewPacket (int) |
| void | freePacket (CommunicationPacket *) |
| int | receiveCompleted () |
| int | sendCompleted () |
| void | popNewRecvPacket () |
| void | pushNewRecvPacket (CommunicationPacket *) |
| void | clear () |
| int | giveFitSize (MPI_Datatype type, int availableSpace, int arrySize) |
| template<class T> | |
| int | __write (T *src, int n, MPI_Datatype type) |
| template<class T> | |
| int | __read (T *dest, int n, MPI_Datatype type) |
Protected Attributes | |
| std ::list< CommunicationPacket * > | packet_list |
| std::list< CommunicationPacket * >::iterator | recvIt |
| Iterator to iterate over received packets. | |
| CommunicationPacket * | active_packet |
| Active packet. | |
| int | active_tag |
| Active rank and tag (send by initSend,initReceive, and initExchange). | |
| int | active_rank |
| int | number_of_packets |
| enum oofem::DynamicCommunicationBuffer::DCB_Mode | mode |
| bool | completed |
| Communication completion flag. | |
| Protected Attributes inherited from oofem::CommunicationBuffer | |
| MPI_Comm | communicator |
Static Protected Attributes | |
| static CommunicationPacketPool | packetPool |
| Static packet pool. | |
Definition at line 158 of file dyncombuff.h.
|
protected |
| oofem::DynamicCommunicationBuffer::DynamicCommunicationBuffer | ( | MPI_Comm | comm, |
| std::size_t | size, | ||
| bool | dynamic = 0 ) |
Constructor. Creates buffer of given size, using given communicator for packing.
Definition at line 151 of file dyncombuff.C.
References oofem::CommunicationBuffer::CommunicationBuffer(), completed, DCB_null, mode, number_of_packets, and packet_list.
| oofem::DynamicCommunicationBuffer::DynamicCommunicationBuffer | ( | MPI_Comm | comm, |
| bool | dynamic = 0 ) |
Constructor. Creates empty buffer, using given communicator for packing.
Definition at line 165 of file dyncombuff.C.
References oofem::CommunicationBuffer::CommunicationBuffer(), completed, DCB_null, mode, number_of_packets, and packet_list.
|
virtual |
|
inlineprotected |
Templated low-level array unpacking method. Templated version used since implementation is similar for different types but type info is needed since implementation is relying on pointer arithmetic.
Definition at line 290 of file dyncombuff.h.
References active_packet, oofem::CommunicationBuffer::communicator, giveFitSize(), and popNewRecvPacket().
|
inlineprotected |
Templated low-level array packing method. Templated version used since implementation is similar for different types but type info is needed since implementation is relying on pointer arithmetic.
Definition at line 258 of file dyncombuff.h.
References active_packet, allocateNewPacket(), oofem::CommunicationBuffer::communicator, giveFitSize(), number_of_packets, and packet_list.
Referenced by write(), write(), write(), write(), and write().
|
protected |
Definition at line 399 of file dyncombuff.C.
References oofem::CommunicationBuffer::communicator, oofem::CommunicationPacket::init(), packetPool, and oofem::CommunicationPacket::setNumber().
Referenced by __write(), initForPacking(), iRecv(), and receiveCompleted().
|
overridevirtual |
Initializes broadcast over collaborating processes. The whole buffer size is broadcasted. All buffers participating in broadcast should have the same size.
| root | Rank of broadcast root. |
Implements oofem::CommunicationBuffer.
Definition at line 446 of file dyncombuff.C.
References OOFEM_ERROR.
|
protected |
Definition at line 414 of file dyncombuff.C.
References active_packet, freePacket(), number_of_packets, and packet_list.
Referenced by init(), initForPacking(), and ~DynamicCommunicationBuffer().
|
protected |
|
protected |
Definition at line 381 of file dyncombuff.C.
References oofem::CommunicationBuffer::communicator.
|
overridevirtual |
Initializes buffer to empty state. All packed data are lost.
Implements oofem::CommunicationBuffer.
Definition at line 185 of file dyncombuff.C.
References clear(), and completed.
Referenced by iRecv().
|
overridevirtual |
Initialize for packing.
Implements oofem::CommunicationBuffer.
Definition at line 192 of file dyncombuff.C.
References active_packet, allocateNewPacket(), clear(), number_of_packets, and packet_list.
|
overridevirtual |
Initialize for Unpacking (data already received).
Implements oofem::CommunicationBuffer.
Definition at line 203 of file dyncombuff.C.
References packet_list, popNewRecvPacket(), and recvIt.
Referenced by receiveCompleted().
|
overridevirtual |
Starts standard mode, nonblocking receive. The buffer must be large enough to receive all data.
| source | Rank of source. |
| tag | Message tag. |
| count | Number of elements to receive (bytes). Causes receive buffer to resize to count elements. If zero (default value) buffer is not resized. |
Implements oofem::CommunicationBuffer.
Definition at line 281 of file dyncombuff.C.
References active_packet, active_rank, active_tag, allocateNewPacket(), oofem::CommunicationBuffer::communicator, completed, DCB_receive, init(), mode, and number_of_packets.
|
overridevirtual |
Starts standard mode, nonblocking send.
| dest | Rank of destination. |
| tag | Message tag. |
set last (active) send packet as eof
Implements oofem::CommunicationBuffer.
Definition at line 254 of file dyncombuff.C.
References active_packet, active_rank, active_tag, oofem::CommunicationBuffer::communicator, completed, DCB_send, mode, and packet_list.
|
protected |
Definition at line 427 of file dyncombuff.C.
References active_packet, OOFEM_ERROR, and recvIt.
Referenced by __read(), and initForUnpacking().
|
inlinestatic |
Definition at line 238 of file dyncombuff.h.
References packetPool.
|
protected |
Definition at line 439 of file dyncombuff.C.
References packet_list.
Referenced by receiveCompleted().
|
inlineoverridevirtual |
Reads count char values into array pointed by data.
Reimplemented from oofem::CommunicationBuffer.
Definition at line 211 of file dyncombuff.h.
References __read().
|
inlineoverridevirtual |
Reads count double values into array pointed by data.
Reimplemented from oofem::CommunicationBuffer.
Definition at line 209 of file dyncombuff.h.
References __read().
|
inlineoverridevirtual |
Reads count integer values into array pointed by data.
Reimplemented from oofem::CommunicationBuffer.
Definition at line 203 of file dyncombuff.h.
References __read().
|
inlineoverridevirtual |
Reads count long values into array pointed by data.
Reimplemented from oofem::CommunicationBuffer.
Definition at line 205 of file dyncombuff.h.
References __read().
|
inlineoverridevirtual |
Reads count unsigned long values into array pointed by data.
Reimplemented from oofem::CommunicationBuffer.
Definition at line 207 of file dyncombuff.h.
References __read().
|
protected |
Definition at line 295 of file dyncombuff.C.
References active_packet, active_rank, active_tag, allocateNewPacket(), oofem::CommunicationBuffer::communicator, completed, initForUnpacking(), number_of_packets, and pushNewRecvPacket().
Referenced by testCompletion(), and waitCompletion().
|
inlineoverridevirtual |
Resizes buffer to given size. If buffer size is to be enlarged, then previously packed data are kept in new buffer. Otherwise buffer is cleared using init service. Current implementation only performs buffer growing, request for size decrease is ignored to avoid reallocation if further request for growing is encountered.
| newSize | New buffer size in bytes. |
Implements oofem::CommunicationBuffer.
Definition at line 184 of file dyncombuff.h.
|
protected |
Definition at line 333 of file dyncombuff.C.
References completed, and packet_list.
Referenced by testCompletion(), and waitCompletion().
|
overridevirtual |
Tests if the operation identified by this->request is complete. In such case, true is returned and if communication was initiated by nonblocking send/receive, then request handle is set to MPI_REQUEST_NULL. Otherwise call returns flag=false.
Implements oofem::CommunicationBuffer.
Definition at line 350 of file dyncombuff.C.
References DCB_receive, DCB_send, mode, receiveCompleted(), and sendCompleted().
|
overridevirtual |
Waits until a completion of a nonblocking communication. The completion of a send operation indicates that the sender is now free to update the locations in the send buffer, the completion of a receive operation indicates that the receive buffer contains the received message, the receiver is now free to access it, and that the status object is set. If the communication object associated with this request was created (nonblocking send or receive call), then the object is deallocated by the call to MPI_WAIT and the request handle is set to MPI_REQUEST_NULL.
Implements oofem::CommunicationBuffer.
Definition at line 362 of file dyncombuff.C.
References DCB_receive, DCB_send, mode, receiveCompleted(), and sendCompleted().
|
inlineoverridevirtual |
Writes count char values from array pointed by data.
Reimplemented from oofem::CommunicationBuffer.
Definition at line 200 of file dyncombuff.h.
References __write().
|
inlineoverridevirtual |
Writes count double values from array pointed by data.
Reimplemented from oofem::CommunicationBuffer.
Definition at line 198 of file dyncombuff.h.
References __write().
|
inlineoverridevirtual |
Writes count integer values from array pointed by data.
Reimplemented from oofem::CommunicationBuffer.
Definition at line 192 of file dyncombuff.h.
References __write().
|
inlineoverridevirtual |
Writes count long values from array pointed by data.
Reimplemented from oofem::CommunicationBuffer.
Definition at line 194 of file dyncombuff.h.
References __write().
|
inlineoverridevirtual |
Writes count unsigned long values from array pointed by data.
Reimplemented from oofem::CommunicationBuffer.
Definition at line 196 of file dyncombuff.h.
References __write().
|
protected |
Active packet.
Definition at line 165 of file dyncombuff.h.
Referenced by __read(), __write(), clear(), initForPacking(), iRecv(), iSend(), popNewRecvPacket(), and receiveCompleted().
|
protected |
Definition at line 167 of file dyncombuff.h.
Referenced by iRecv(), iSend(), and receiveCompleted().
|
protected |
Active rank and tag (send by initSend,initReceive, and initExchange).
Definition at line 167 of file dyncombuff.h.
Referenced by iRecv(), iSend(), and receiveCompleted().
|
protected |
Communication completion flag.
Definition at line 175 of file dyncombuff.h.
Referenced by DynamicCommunicationBuffer(), DynamicCommunicationBuffer(), init(), iRecv(), iSend(), receiveCompleted(), and sendCompleted().
|
protected |
Referenced by DynamicCommunicationBuffer(), DynamicCommunicationBuffer(), iRecv(), iSend(), testCompletion(), and waitCompletion().
|
protected |
Definition at line 168 of file dyncombuff.h.
Referenced by __write(), clear(), DynamicCommunicationBuffer(), DynamicCommunicationBuffer(), initForPacking(), iRecv(), and receiveCompleted().
|
protected |
Definition at line 161 of file dyncombuff.h.
Referenced by __write(), clear(), DynamicCommunicationBuffer(), DynamicCommunicationBuffer(), initForPacking(), initForUnpacking(), iSend(), pushNewRecvPacket(), and sendCompleted().
|
staticprotected |
Static packet pool.
Definition at line 173 of file dyncombuff.h.
Referenced by allocateNewPacket(), freePacket(), and printInfo().
|
protected |
Iterator to iterate over received packets.
Definition at line 163 of file dyncombuff.h.
Referenced by initForUnpacking(), and popNewRecvPacket().