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: @{persfeature}@
21 COLL!nonblocking: Lacking
22 COLL!persistent: Lacking
32 ////////////////////// End of MBI headers /////////////////// */
39 int main(int argc, char **argv) {
43 int stag = 0, rtag = 0;
46 MPI_Init(&argc, &argv);
47 MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
48 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
49 printf("Hello from rank %d \\n", rank);
52 printf("MBI ERROR: This test needs at least 2 processes to produce a bug!\\n");
54 MPI_Comm newcom = MPI_COMM_WORLD;
55 MPI_Datatype type = MPI_INT;
63 @{write1}@ /* MBIERROR1 */
70 @{write2}@ /* MBIERROR2 */
76 printf("Rank %d finished normally\\n", rank);
82 for s in send + isend + psend:
83 for r in irecv + precv + recv:
85 patterns = {'s': s, 'r': r}
86 patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
87 patterns['p2pfeature'] = 'Yes' if s in send else 'Lacking'
88 patterns['ip2pfeature'] = 'Yes' if r in irecv else 'Lacking'
89 patterns['persfeature'] = 'Yes' if r in precv else 'Lacking'
92 patterns['init1'] = init[s]("1")
93 patterns['init2'] = init[r]("2")
94 patterns['fini1'] = fini[s]("1")
95 patterns['fini2'] = fini[r]("2")
96 patterns['start1'] = start[s]("1")
97 patterns['start2'] = start[r]("2")
98 patterns['operation1'] = operation[s]("1")
99 patterns['operation2'] = operation[r]("2")
100 patterns['write1'] = write[s]("1")
101 patterns['write2'] = write[r]("2")
102 patterns['free1'] = free[s]("1")
103 patterns['free2'] = free[r]("2")
105 # Generate a message race
106 if s in send and r in irecv + precv:
108 replace['shortdesc'] = ' Local Concurrency with a P2P'
109 replace['longdesc'] = f'The message buffer in {r} is modified before the call has been completed.'
110 replace['outcome'] = 'ERROR: LocalConcurrency'
111 replace['errormsg'] = 'Local Concurrency with a P2P. The receive buffer in @{r}@ is modified at @{filename}@:@{line:MBIERROR2}@ whereas there is no guarantee the message has been received.'
112 make_file(template, f'LocalConcurrency_{r}_{s}_nok.c', replace)
113 if s in isend + psend and r in recv:
115 replace['shortdesc'] = ' Local Concurrency with a P2P'
116 replace['longdesc'] = f'The message buffer in {s} is modified before the call has been completed.'
117 replace['outcome'] = 'ERROR: LocalConcurrency'
118 replace['errormsg'] = 'Local Concurrency with a P2P. The send buffer in @{s}@ is modified at @{filename}@:@{line:MBIERROR1}@ whereas there is no guarantee the message has been sent.'
119 make_file(template, f'LocalConcurrency_{r}_{s}_nok.c', replace)
120 if s in isend + psend and r in irecv + precv:
122 replace['shortdesc'] = ' Local Concurrency with a P2P'
123 replace['longdesc'] = f'The message buffer in {s} and {r} are modified before the calls have completed.'
124 replace['outcome'] = 'ERROR: LocalConcurrency'
125 replace['errormsg'] = 'Local Concurrency with a P2P. The message buffers in @{s}@ and @{r}@ are modified at @{filename}@:@{line:MBIERROR1}@ and @{filename}@:@{line:MBIERROR2}@ whereas there is no guarantee the calls have been completed.'
126 make_file(template, f'LocalConcurrency_{r}_{s}_nok.c', replace)