#ifndef MPITEST_H_INCLUDED
#define MPITEST_H_INCLUDED
+#include <string.h>
#include "mpitestconf.h"
/*
- * Init and finalize test
+ * Init and finalize test
*/
-void MTest_Init( int *, char *** );
-void MTest_Init_thread( int *, char ***, int, int * );
-void MTest_Finalize( int );
-void MTestPrintError( int );
-void MTestPrintErrorMsg( const char [], int );
-void MTestPrintfMsg( int, const char [], ... );
-void MTestError( const char [] );
-int MTestReturnValue( int );
+void MTest_Init(int *, char ***);
+void MTest_Init_thread(int *, char ***, int, int *);
+void MTest_Finalize(int);
+void MTestPrintError(int);
+void MTestPrintErrorMsg(const char[], int);
+void MTestPrintfMsg(int, const char[], ...);
+void MTestError(const char[]);
+int MTestReturnValue(int);
/*
* Utilities
*/
-void MTestSleep( int );
+void MTestSleep(int);
+void MTestGetDbgInfo(int *dbgflag, int *verbose);
/*
* This structure contains the information used to test datatypes
* buf is set to null when an MTestDatatype is created; the
* InitBuf routine will allocate (if necessary) and initialize
* the data. InitBuf may be called multiple times (this is particularly
- * important for recv bufs), in which case the buffer will only
+ * important for recv bufs), in which case the buffer will only
* be allocated if it has not already been created.
*/
typedef struct _MTestDatatype {
MPI_Datatype datatype;
- void *buf; /* buffer to use in communication */
- int count; /* count to use for this datatype */
- int isBasic; /* true if the type is predefined */
- int printErrors; /* true if errors should be printed
- (used by the CheckBuf routines) */
+ void *buf; /* buffer to use in communication */
+ MPI_Aint count; /* count to use for this datatype */
+ int isBasic; /* true if the type is predefined */
+ int printErrors; /* true if errors should be printed
+ * (used by the CheckBuf routines) */
/* The following is optional data that is used by some of
- the derived datatypes */
- int stride, nelm, blksize, *index;
- /* stride, nelm, and blksize are in bytes */
+ * the derived datatypes */
+ int nblock, *index;
+ /* stride, and blksize are in bytes */
+ MPI_Aint stride, blksize, *displ_in_bytes;
int *displs, basesize;
- /* displacements are in multiples of base type; basesize is the
- size of that type*/
- void *(*InitBuf)( struct _MTestDatatype * );
- void *(*FreeBuf)( struct _MTestDatatype * );
- int (*CheckBuf)( struct _MTestDatatype * );
+ MPI_Datatype *old_datatypes;
+ /* used in subarray */
+ int arr_sizes[2], arr_subsizes[2], arr_starts[2], order;
+
+ void *(*InitBuf) (struct _MTestDatatype *);
+ void *(*FreeBuf) (struct _MTestDatatype *);
+ int (*CheckBuf) (struct _MTestDatatype *);
} MTestDatatype;
-int MTestCheckRecv( MPI_Status *, MTestDatatype * );
-int MTestGetDatatypes( MTestDatatype *, MTestDatatype *, int );
-void MTestResetDatatypes( void );
-void MTestFreeDatatype( MTestDatatype * );
-const char *MTestGetDatatypeName( MTestDatatype * );
-int MTestGetDatatypeIndex( void );
-
-int MTestGetIntracomm( MPI_Comm *, int );
-int MTestGetIntracommGeneral( MPI_Comm *, int, int );
-int MTestGetIntercomm( MPI_Comm *, int *, int );
-int MTestGetComm( MPI_Comm *, int );
-const char *MTestGetIntracommName( void );
-const char *MTestGetIntercommName( void );
-void MTestFreeComm( MPI_Comm * );
+/* The max value of count must be very large to ensure that we
+ * reach the long message algorithms. (The maximal count or block length
+ * can be generated by 256K count is 4K or 32Kbytes respectively) */
+#define MTEST_DATATYPE_FOR_EACH_COUNT(count) \
+ for (count = 1; count <= 262144; count *= 128)
+
+/* Setup the full version of datatype tests.
+ * It generate tests for all basic datatypes and all derived datatypes except darray. */
+void MTestInitFullDatatypes(void);
+
+/* Setup the minimum version of datatype tests.
+ * It generate tests for all basic datatypes, vector and indexed. */
+void MTestInitMinDatatypes(void);
+
+/* Setup the basic version of datatype tests.
+ * It generate tests for all basic datatypes. */
+void MTestInitBasicDatatypes(void);
+
+int MTestCheckRecv(MPI_Status *, MTestDatatype *);
+int MTestGetDatatypes(MTestDatatype *, MTestDatatype *, MPI_Aint);
+void MTestResetDatatypes(void);
+void MTestFreeDatatype(MTestDatatype *);
+const char *MTestGetDatatypeName(MTestDatatype *);
+int MTestGetDatatypeIndex(void);
+
+int MTestGetIntracomm(MPI_Comm *, int);
+int MTestGetIntracommGeneral(MPI_Comm *, int, int);
+int MTestGetIntercomm(MPI_Comm *, int *, int);
+int MTestGetComm(MPI_Comm *, int);
+int MTestTestIntercomm(MPI_Comm intercomm);
+int MTestTestIntracomm(MPI_Comm intracomm);
+int MTestTestComm(MPI_Comm comm);
+const char *MTestGetIntracommName(void);
+const char *MTestGetIntercommName(void);
+void MTestFreeComm(MPI_Comm *);
+
+int MTestSpawnPossible(int *);
#ifdef HAVE_MPI_WIN_CREATE
-int MTestGetWin( MPI_Win *, int );
-const char *MTestGetWinName( void );
-void MTestFreeWin( MPI_Win * );
+int MTestGetWin(MPI_Win *, int);
+const char *MTestGetWinName(void);
+void MTestFreeWin(MPI_Win *);
#endif
/* These macros permit overrides via:
((MTEST_MPI_VERSION == (major_) && MTEST_MPI_SUBVERSION >= (minor_)) || \
(MTEST_MPI_VERSION > (major_)))
+/* useful for avoid valgrind warnings about padding bytes */
+#define MTEST_VG_MEM_INIT(addr_, size_) \
+do { \
+ memset(addr_, 0, size_); \
+} while (0)
+
#endif