source: XIOS3/trunk/src/mpi.hpp @ 2622

Last change on this file since 2622 was 2584, checked in by ymipsl, 10 months ago

Set overload of mpi functions in xios namespace, so only XIOS MPI calls will be intercepted.
YM

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 2.1 KB
Line 
1#ifndef __XIOS_MPI_HPP__
2#define __XIOS_MPI_HPP__
3
4/* skip C++ Binding for mpich , intel MPI */
5#define MPICH_SKIP_MPICXX
6
7/* skip C++ Binding for SGI MPI library */
8#define MPI_NO_CPPBIND
9
10/* skip C++ Binding for OpenMPI */
11#define OMPI_SKIP_MPICXX
12
13#include <mpi.h>
14#include <climits>
15#include <cstdint>
16
17#if SIZE_MAX == UCHAR_MAX
18   #define MPI_SIZE_T MPI_UNSIGNED_CHAR
19#elif SIZE_MAX == USHRT_MAX
20   #define MPI_SIZE_T MPI_UNSIGNED_SHORT
21#elif SIZE_MAX == UINT_MAX
22   #define MPI_SIZE_T MPI_UNSIGNED
23#elif SIZE_MAX == ULONG_MAX
24   #define MPI_SIZE_T MPI_UNSIGNED_LONG
25#elif SIZE_MAX == ULLONG_MAX
26   #define MPI_SIZE_T MPI_UNSIGNED_LONG_LONG
27#else
28   #error "Unable to find MPI_SIZE_T equivalent type"
29#endif
30
31#include "mpi_tools.hpp"
32
33namespace xios
34{
35  inline int MPI_Comm_dup(::MPI_Comm comm, ::MPI_Comm * newcomm)
36  {
37    int ret=::MPI_Comm_dup(comm, newcomm) ;
38    xios::CCommTrack::registerComm(*newcomm) ;
39    return ret ;
40  }
41
42  inline int MPI_Intercomm_create(::MPI_Comm local_comm, int local_leader,
43                           ::MPI_Comm peer_comm, int remote_leader, int tag, ::MPI_Comm * newintercomm)
44  {
45    int ret=::MPI_Intercomm_create(local_comm, local_leader, peer_comm, remote_leader, tag, newintercomm) ;
46    xios::CCommTrack::registerComm(*newintercomm) ;
47    return ret ;
48  }
49
50  inline int MPI_Intercomm_merge(::MPI_Comm intercomm, int high, ::MPI_Comm * newintracomm)
51  {
52    int ret=::MPI_Intercomm_merge(intercomm, high, newintracomm) ;
53    xios::CCommTrack::registerComm(*newintracomm) ;
54    return ret ;
55  }
56
57  inline int MPI_Comm_split(::MPI_Comm comm, int color, int key, ::MPI_Comm * newcomm)
58  {
59    int ret=::MPI_Comm_split(comm, color, key,newcomm) ;
60    xios::CCommTrack::registerComm(*newcomm) ;
61    return ret ;
62  }
63
64  inline int MPI_Comm_create(::MPI_Comm comm, ::MPI_Group group, ::MPI_Comm *newcomm)
65  {
66    int ret=::MPI_Comm_create(comm, group, newcomm) ;
67    xios::CCommTrack::registerComm(*newcomm) ;
68    return ret ;
69  }
70
71  inline int MPI_Comm_free(::MPI_Comm *comm) 
72  { 
73    xios::CCommTrack::releaseComm(*comm) ;
74    return ::MPI_Comm_free(comm) ;
75  }
76}
77
78#endif
Note: See TracBrowser for help on using the repository browser.