1 /*
2 (C) 2004 by Argonne National Laboratory.
3 See COPYRIGHT in top-level directory.
4 */
5 #include "collchk.h"
6
7 #if defined( HAVE_MPI_IO )
8 CollChk_fh_t *CollChk_fh_list = NULL;
9
10 int CollChk_fh_cnt = 0;
11 #endif
12
13 #if defined( HAVE_MPI_RMA )
14 CollChk_win_t *CollChk_win_list = NULL;
15
16 int CollChk_win_cnt = 0;
17 #endif
18
19 /* begin string */
20 char CollChk_begin_str[128] = {0};
21
22 /* constants */
23 int COLLCHK_CALLED_BEGIN = 0;
24 int COLLCHK_ERRORS = 0;
25 int COLLCHK_ERR_NOT_INIT = 0;
26 int COLLCHK_ERR_ROOT = 0 ;
27 int COLLCHK_ERR_CALL = 0;
28 int COLLCHK_ERR_OP = 0;
29 int COLLCHK_ERR_INPLACE = 0;
30 int COLLCHK_ERR_DTYPE = 0;
31 int COLLCHK_ERR_HIGH_LOW = 0;
32 int COLLCHK_ERR_LL = 0;
33 int COLLCHK_ERR_TAG = 0;
34 int COLLCHK_ERR_DIMS = 0;
35 int COLLCHK_ERR_GRAPH = 0;
36 int COLLCHK_ERR_AMODE = 0;
37 int COLLCHK_ERR_WHENCE = 0;
38 int COLLCHK_ERR_DATAREP = 0;
39 int COLLCHK_ERR_PREVIOUS_BEGIN = 0;
40 int COLLCHK_ERR_FILE_NOT_OPEN = 0;
41
42
MPI_Init(int * c,char *** v)43 int MPI_Init(int * c, char *** v)
44 {
45 int ret;
46 int rank;
47
48 /* make the call */
49 ret = PMPI_Init(c, v);
50 PMPI_Comm_rank( MPI_COMM_WORLD, &rank );
51 if ( rank == 0 )
52 fprintf( stdout, "Starting MPI Collective and Datatype Checking!\n" );
53
54 /* the main error class for all the errors */
55 MPI_Add_error_class(&COLLCHK_ERRORS);
56
57 /* the error codes for the profile */
58 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_NOT_INIT);
59 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_CALL);
60 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_ROOT);
61 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_OP);
62 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_INPLACE);
63 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_DTYPE);
64 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_HIGH_LOW);
65 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_LL);
66 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_TAG);
67 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_DIMS);
68 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_GRAPH);
69 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_AMODE);
70 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_WHENCE);
71 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_DATAREP);
72 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_PREVIOUS_BEGIN);
73 MPI_Add_error_code(COLLCHK_ERRORS, &COLLCHK_ERR_FILE_NOT_OPEN);
74
75 #if defined( HAVE_MPI_IO )
76 /* setup the fh_list counter */
77 CollChk_fh_cnt = 0;
78 #endif
79 #if defined( HAVE_MPI_RMA )
80 /* setup the win_list counter */
81 CollChk_win_cnt = 0;
82 #endif
83 /* setup the begin flag */
84 COLLCHK_CALLED_BEGIN = 0;
85
86 return ret;
87 }
88