Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add mpich3 topo tests
[simgrid.git] / teshsuite / smpi / mpich3-test / include / mpitest.h
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *
4  *  (C) 2001 by Argonne National Laboratory.
5  *      See COPYRIGHT in top-level directory.
6  */
7 #ifndef MPITEST_H_INCLUDED
8 #define MPITEST_H_INCLUDED
9
10 #include "mpitestconf.h"
11
12 /*
13  * Init and finalize test 
14  */
15 void MTest_Init( int *, char *** );
16 void MTest_Init_thread( int *, char ***, int, int * );
17 void MTest_Finalize( int );
18 void MTestPrintError( int );
19 void MTestPrintErrorMsg( const char [], int );
20 void MTestPrintfMsg( int, const char [], ... );
21 void MTestError( const char [] );
22 int MTestReturnValue( int );
23
24 /*
25  * Utilities
26  */
27 void MTestSleep( int );
28
29 /*
30  * This structure contains the information used to test datatypes
31  * buf is set to null when an MTestDatatype is created; the
32  * InitBuf routine will allocate (if necessary) and initialize
33  * the data.  InitBuf may be called multiple times (this is particularly
34  * important for recv bufs), in which case the buffer will only 
35  * be allocated if it has not already been created.
36  */
37 typedef struct _MTestDatatype {
38     MPI_Datatype datatype;
39     void *buf;              /* buffer to use in communication */
40     int  count;             /* count to use for this datatype */
41     int  isBasic;           /* true if the type is predefined */
42     int  printErrors;       /* true if errors should be printed
43                                (used by the CheckBuf routines) */
44     /* The following is optional data that is used by some of
45        the derived datatypes */
46     int  stride, nelm, blksize, *index;
47     /* stride, nelm, and blksize are in bytes */
48     int *displs, basesize;
49     /* displacements are in multiples of base type; basesize is the
50        size of that type*/
51     void *(*InitBuf)( struct _MTestDatatype * );
52     void *(*FreeBuf)( struct _MTestDatatype * );
53     int   (*CheckBuf)( struct _MTestDatatype * );
54 } MTestDatatype;
55
56 int MTestCheckRecv( MPI_Status *, MTestDatatype * );
57 int MTestGetDatatypes( MTestDatatype *, MTestDatatype *, int );
58 void MTestResetDatatypes( void );
59 void MTestFreeDatatype( MTestDatatype * );
60 const char *MTestGetDatatypeName( MTestDatatype * );
61 int MTestGetDatatypeIndex( void );
62
63 int MTestGetIntracomm( MPI_Comm *, int );
64 int MTestGetIntracommGeneral( MPI_Comm *, int, int );
65 int MTestGetIntercomm( MPI_Comm *, int *, int );
66 int MTestGetComm( MPI_Comm *, int );
67 const char *MTestGetIntracommName( void );
68 const char *MTestGetIntercommName( void );
69 void MTestFreeComm( MPI_Comm * );
70
71 #ifdef HAVE_MPI_WIN_CREATE
72 int MTestGetWin( MPI_Win *, int );
73 const char *MTestGetWinName( void );
74 void MTestFreeWin( MPI_Win * );
75 #endif
76
77 /* These macros permit overrides via:
78  *     make CPPFLAGS='-DMTEST_MPI_VERSION=X -DMTEST_MPI_SUBVERSION=Y'
79  * where X and Y are the major and minor versions of the MPI standard that is
80  * being tested.  The override should work similarly if added to the CPPFLAGS at
81  * configure time. */
82 #ifndef MTEST_MPI_VERSION
83 #define MTEST_MPI_VERSION MPI_VERSION
84 #endif
85 #ifndef MTEST_MPI_SUBVERSION
86 #define MTEST_MPI_SUBVERSION MPI_SUBVERSION
87 #endif
88
89 /* Makes it easier to conditionally compile test code for a particular minimum
90  * version of the MPI Standard.  Right now there is only a MIN flavor but it
91  * would be easy to add MAX or EXACT flavors if they become necessary at some
92  * point.  Example usage:
93  ------8<-------
94 #if MTEST_HAVE_MIN_MPI_VERSION(2,2)
95 ... test for some feature that is only available in MPI-2.2 or later ...
96 #endif
97  ------8<-------
98  */
99 #define MTEST_HAVE_MIN_MPI_VERSION(major_,minor_) \
100     ((MTEST_MPI_VERSION == (major_) && MTEST_MPI_SUBVERSION >= (minor_)) ||   \
101     (MTEST_MPI_VERSION > (major_)))
102
103 #endif