1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2001 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
7 #ifndef MPITEST_H_INCLUDED
8 #define MPITEST_H_INCLUDED
11 #include "mpitestconf.h"
14 * Init and finalize test
16 void MTest_Init(int *, char ***);
17 void MTest_Init_thread(int *, char ***, int, int *);
18 void MTest_Finalize(int);
19 void MTestPrintError(int);
20 void MTestPrintErrorMsg(const char[], int);
21 void MTestPrintfMsg(int, const char[], ...);
22 void MTestError(const char[]);
23 int MTestReturnValue(int);
29 void MTestGetDbgInfo(int *dbgflag, int *verbose);
32 * This structure contains the information used to test datatypes
33 * buf is set to null when an MTestDatatype is created; the
34 * InitBuf routine will allocate (if necessary) and initialize
35 * the data. InitBuf may be called multiple times (this is particularly
36 * important for recv bufs), in which case the buffer will only
37 * be allocated if it has not already been created.
39 typedef struct _MTestDatatype {
40 MPI_Datatype datatype;
41 void *buf; /* buffer to use in communication */
42 MPI_Aint count; /* count to use for this datatype */
43 int isBasic; /* true if the type is predefined */
44 int printErrors; /* true if errors should be printed
45 * (used by the CheckBuf routines) */
46 /* The following is optional data that is used by some of
47 * the derived datatypes */
49 /* stride, and blksize are in bytes */
50 MPI_Aint stride, blksize, *displ_in_bytes;
51 int *displs, basesize;
52 MPI_Datatype *old_datatypes;
53 /* used in subarray */
54 int arr_sizes[2], arr_subsizes[2], arr_starts[2], order;
56 void *(*InitBuf) (struct _MTestDatatype *);
57 void *(*FreeBuf) (struct _MTestDatatype *);
58 int (*CheckBuf) (struct _MTestDatatype *);
61 /* The max value of count must be very large to ensure that we
62 * reach the long message algorithms. (The maximal count or block length
63 * can be generated by 256K count is 4K or 32Kbytes respectively) */
64 #define MTEST_DATATYPE_FOR_EACH_COUNT(count) \
65 for (count = 1; count <= 262144; count *= 8)
67 /* Setup the full version of datatype tests.
68 * It generate tests for all basic datatypes and all derived datatypes except darray. */
69 void MTestInitFullDatatypes(void);
71 /* Setup the minimum version of datatype tests.
72 * It generate tests for all basic datatypes, vector and indexed. */
73 void MTestInitMinDatatypes(void);
75 /* Setup the basic version of datatype tests.
76 * It generate tests for all basic datatypes. */
77 void MTestInitBasicDatatypes(void);
79 int MTestCheckRecv(MPI_Status *, MTestDatatype *);
80 int MTestGetDatatypes(MTestDatatype *, MTestDatatype *, MPI_Aint);
81 void MTestResetDatatypes(void);
82 void MTestFreeDatatype(MTestDatatype *);
83 const char *MTestGetDatatypeName(MTestDatatype *);
84 int MTestGetDatatypeIndex(void);
86 int MTestGetIntracomm(MPI_Comm *, int);
87 int MTestGetIntracommGeneral(MPI_Comm *, int, int);
88 int MTestGetIntercomm(MPI_Comm *, int *, int);
89 int MTestGetComm(MPI_Comm *, int);
90 int MTestTestIntercomm(MPI_Comm intercomm);
91 int MTestTestIntracomm(MPI_Comm intracomm);
92 int MTestTestComm(MPI_Comm comm);
93 const char *MTestGetIntracommName(void);
94 const char *MTestGetIntercommName(void);
95 void MTestFreeComm(MPI_Comm *);
97 int MTestSpawnPossible(int *);
99 #ifdef HAVE_MPI_WIN_CREATE
100 int MTestGetWin(MPI_Win *, int);
101 const char *MTestGetWinName(void);
102 void MTestFreeWin(MPI_Win *);
105 /* These macros permit overrides via:
106 * make CPPFLAGS='-DMTEST_MPI_VERSION=X -DMTEST_MPI_SUBVERSION=Y'
107 * where X and Y are the major and minor versions of the MPI standard that is
108 * being tested. The override should work similarly if added to the CPPFLAGS at
110 #ifndef MTEST_MPI_VERSION
111 #define MTEST_MPI_VERSION MPI_VERSION
113 #ifndef MTEST_MPI_SUBVERSION
114 #define MTEST_MPI_SUBVERSION MPI_SUBVERSION
117 /* Makes it easier to conditionally compile test code for a particular minimum
118 * version of the MPI Standard. Right now there is only a MIN flavor but it
119 * would be easy to add MAX or EXACT flavors if they become necessary at some
120 * point. Example usage:
122 #if MTEST_HAVE_MIN_MPI_VERSION(2,2)
123 ... test for some feature that is only available in MPI-2.2 or later ...
127 #define MTEST_HAVE_MIN_MPI_VERSION(major_,minor_) \
128 ((MTEST_MPI_VERSION == (major_) && MTEST_MPI_SUBVERSION >= (minor_)) || \
129 (MTEST_MPI_VERSION > (major_)))
131 /* useful for avoid valgrind warnings about padding bytes */
132 #define MTEST_VG_MEM_INIT(addr_, size_) \
134 memset(addr_, 0, size_); \