4 from generator_utils import *
6 template = """// @{generatedby}@
7 /* ///////////////////////// The MPI Bugs Initiative ////////////////////////
11 Description: @{shortdesc}@
14 Version of MPI: Conforms to MPI 1.1, does not require MPI 2 implementation
17 P2P!basic: @{p2pfeature}@
18 P2P!nonblocking: @{ip2pfeature}@
19 P2P!persistent: Lacking
20 COLL!basic: @{collfeature}@
21 COLL!nonblocking: Lacking
22 COLL!persistent: Lacking
32 ////////////////////// End of MBI headers /////////////////// */
39 int main(int argc, char **argv) {
45 int stag = 0, rtag = 0;
48 MPI_Init(&argc, &argv);
49 MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
50 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
51 printf("Hello from rank %d \\n", rank);
54 printf("MBI ERROR: This test needs 4 processes to produce a bug!\\n");
56 int dbs = sizeof(int)*nprocs; /* Size of the dynamic buffers for alltoall and friends */
57 MPI_Comm newcom = MPI_COMM_WORLD;
58 MPI_Datatype type = MPI_INT;
82 @{operation3}@ /* MBIERROR1 */
85 @{operation4}@ /* MBIERROR2 */
99 printf("Rank %d finished normally\\n", rank);
105 for s in send + isend:
109 patterns = {'s': s, 'r': r, 'c': c}
110 patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
111 patterns['p2pfeature'] = 'Yes' if s in send or r in recv else 'Lacking'
112 patterns['ip2pfeature'] = 'Yes' if s in isend or r in irecv else 'Lacking'
113 patterns['collfeature'] = 'Yes' if c in coll else 'Lacking'
117 patterns['init1'] = init[c]("1")
118 patterns['init2'] = init[s]("2")
119 patterns['init3'] = init[r]("3")
120 patterns['init4'] = init[r]("4")
121 patterns['fini1'] = fini[c]("1")
122 patterns['fini2'] = fini[s]("2")
123 patterns['fini3'] = fini[r]("3")
124 patterns['fini4'] = fini[r]("4")
125 patterns['free1'] = free[c]("1")
126 patterns['free2'] = free[s]("2")
127 patterns['free3'] = free[r]("3")
128 patterns['free4'] = free[r]("4")
129 patterns['operation1'] = operation[c]("1")
130 patterns['operation2'] = operation[s]("2")
131 patterns['operation3'] = operation[r]("3")
132 patterns['operation4'] = operation[r]("4")
134 # Generate the incorrect matching because of the conditional
136 replace['shortdesc'] = 'Message race'
137 replace['longdesc'] = 'Message race in @{r}@ with @{c}@.'
138 replace['outcome'] = 'ERROR: MessageRace'
139 replace['errormsg'] = 'Message race. The use of wildcard receive calls (@{r}@ at @{filename}@:@{line:MBIERROR1}@ and @{r}@ at @{filename}@:@{line:MBIERROR2}@) leads to nondeterministic matching.'
140 make_file(template, f'MessageRace_{c}_{s}_{r}_nok.c', replace)