source: XMLIO_V2/dev/common/src/xmlio/manager/mpi_manager.hpp @ 219

Last change on this file since 219 was 219, checked in by hozdoba, 13 years ago

Préparation nouvelle arborescence

File size: 2.8 KB
Line 
1#ifndef __XMLIO_CMPIManager__
2#define __XMLIO_CMPIManager__
3
4/// MPI headers ///
5#include <mpi.h>
6
7/// xmlioserver headers ///
8#include "xmlioserver_spl.hpp"
9#include "exception.hpp"
10#include "buffer.hpp"
11#include "circular_buffer.hpp"
12#include "linear_buffer.hpp"
13
14namespace xmlioserver
15{
16   namespace comm
17   {
18      /// ////////////////////// Déclarations ////////////////////// ///
19      typedef MPI_Fint     MPIComm;
20      typedef MPI_Fint    MPIGroup;
21      typedef MPI_Fint  MPIRequest;
22      typedef MPI_Fint  *MPIStatus;
23      typedef MPI_Fint MPIDataType;
24
25      class CMPIManager
26      {
27         public :
28
29            /// Initialisation & Finalisation ///
30            static void Initialise(int * argc, char *** argv);
31            static void Finalize(void);
32
33            /// Communicateurs ///
34            static int GetCommRank(MPIComm comm = CMPIManager::GetCommWorld());
35            static int GetCommSize(MPIComm comm = CMPIManager::GetCommWorld());
36            static MPIComm CreateComm(MPIGroup group, MPIComm pcomm = CMPIManager::GetCommWorld());
37            static MPIComm GetCommWorld(void);
38
39            /// Autre ///
40            static void Barrier(MPIComm comm = CMPIManager::GetCommWorld());
41
42            /// Groupes ///
43            static MPIGroup GetGroupWorld(void);
44            static MPIGroup CreateSubGroup(MPIGroup pgroup, const std::vector<int> & ranks);
45            static MPIGroup CreateSubGroup(MPIGroup pgroup, int min_rank, int max_rank, int intval = 1);
46
47            /// Tests ///
48            static bool IsMaster(MPIComm comm = CMPIManager::GetCommWorld());
49            static bool IsRank(MPIComm comm, int rank);
50
51            /// Communication simple///
52            static void Send (MPIComm comm, int dest_rank, char * data, StdSize size, MPIRequest & request);
53            static void Wait (MPIRequest & request);
54            static bool Test (MPIRequest & request);
55
56            static bool HasReceivedData(MPIComm comm, int src_rank);
57            static StdSize GetReceivedDataSize(MPIComm comm, int src_rank);
58            static void Receive(MPIComm comm, int src_rank, char * data);
59
60            /// Communication 'complexe' ///
61            static void SendLinearBuffer(MPIComm comm, int dest_rank, CLinearBuffer & buff, MPIRequest & request);
62            static void ReceiveLinearBuffer(MPIComm comm, int src_rank, CLinearBuffer & buff);
63            static boost::shared_ptr<CLinearBuffer> ReceiveLinearBuffer(MPIComm comm, int src_rank);
64            static void ReceiveCircularBuffer(MPIComm comm, int src_rank, CCircularBuffer & buff);
65
66            /// Mémoire (non fonctionnel ....)///
67            static void AllocMem(void * data, StdSize size);
68            static void FreeMem(void * data);
69
70      }; // class CMPIManager
71
72   } // namespace comm
73} // namespace xmlioserver
74
75#endif // __XMLIO_CMPIManager__
76
Note: See TracBrowser for help on using the repository browser.