MPIAllToAllCommunicator.h

Go to the documentation of this file.
00001 #ifndef MPIALLTOALLCOMMUNICATOR_H_
00002 #define MPIALLTOALLCOMMUNICATOR_H_
00003 
00004 #include <mpi.h>
00005 #include "MPIInputBuffer.h"
00006 #include "MPIOutputBuffer.h"
00007 
00009 
00019 class MPIAllToAllCommunicator
00020 {
00021 public:
00023 
00032     MPIAllToAllCommunicator(MPIInputBufferVector & mpiInputBuffers,
00033                             MPIOutputBufferVector & mpiOutputBuffers,
00034                             MPI::Intracomm & comm,                            
00035                             vector<bool> &incomingConnections,
00036                             vector<bool> &outgoingConnections);
00037 
00038     virtual ~MPIAllToAllCommunicator();
00039 
00041 
00046     bool doAllToAllExchange();
00047 
00048 
00049     // Gives the rank of current mpi process. [used for testing only]
00050     int getRank();
00051 
00052 protected:
00053     // Actual implementation of the all-to-all buffer exchange algorithm on the mpi level.
00057     virtual void doExchangeAlgorithm() = 0;
00058     
00060     virtual void prepare() = 0;
00061     
00062 
00063     bool finished;
00064 
00066     MPIInputBufferVector &inputBuffers;
00067 
00069     MPIOutputBufferVector &outputBuffers;
00070 
00071     vector<bool> &incoming_connections;
00072 
00073     vector<bool> &outgoing_connections;
00074 
00076     int numNodes;
00077 
00079     MPI::Intracomm & mpi_comm;
00080     
00081     vector<bool> hasNextToSend;
00082 
00083     vector<bool> needsToSend;
00084 
00085     vector<bool> needsToReceive;
00086     
00088     int *send_displ;
00089 
00091     int *recv_displ;
00092 
00094     int *send_count;
00095 
00097     int *recv_count;
00098 
00099 };
00100 
00101 #endif /*MPIALLTOALLCOMMUNICATOR_H_*/

Generated on Wed Jul 9 16:34:37 2008 for PCSIM by  doxygen 1.5.5