4 from generator_utils import *
6 template = """// @{generatedby}@
7 /* ///////////////////////// The MPI Bugs Initiative ////////////////////////
11 Description: @{shortdesc}@
14 Version of MPI: Conforms to MPI 2, requires MPI 3 implementation (for lock_all/unlock_all epochs)
18 P2P!nonblocking: Lacking
19 P2P!persistent: Lacking
21 COLL!nonblocking: Lacking
22 COLL!persistent: Lacking
32 ////////////////////// End of MBI headers /////////////////// */
40 int main(int argc, char **argv) {
44 int winbuf[100] = {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_Datatype type = MPI_INT;
57 MPI_Win_create(&winbuf, 100 * sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &win);
64 @{operation1}@ /* MBIERROR1 */
68 @{operation2}@ /* MBIERROR2 */
83 for p2 in rput + rstore + rload + rget :
85 patterns = {'e': e, 'p1': p1, 'p2': p2}
86 patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
87 patterns['rmafeature'] = 'Yes'
91 patterns['epoch'] = epoch[e]("1")
92 patterns['finEpoch'] = finEpoch[e]("1")
93 patterns['init1'] = init[p1]("1")
94 patterns['operation1'] = operation[p1]("1")
95 patterns['operation2'] = operation[p2]("1")
97 # Generate a data race (Get + Get/load/store/Put)
99 replace['shortdesc'] = 'Global Concurrency error.'
100 replace['longdesc'] = 'Global Concurrency error. @{p2}@ conflicts with @{p1}@'
101 replace['outcome'] = 'ERROR: GlobalConcurrency'
102 replace['errormsg'] = 'Global Concurrency error. @{p2}@ at @{filename}@:@{line:MBIERROR2}@ conflicts with @{p1}@ line @{line:MBIERROR1}@'
103 make_file(template, f'GlobalConcurrency_rl_{e}_{p1}_{p2}_nok.c', replace)
108 for p2 in rstore + rload + rput:
110 patterns = {'e': e, 'p1': p1, 'p2': p2}
111 patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
112 patterns['rmafeature'] = 'Yes'
116 patterns['epoch'] = epoch[e]("1")
117 patterns['finEpoch'] = finEpoch[e]("1")
118 patterns['init1'] = init[p1]("1")
119 patterns['operation1'] = operation[p1]("1")
120 patterns['operation2'] = operation[p2]("1")
122 # Generate a data race (Put + store)
124 replace['shortdesc'] = 'Global Concurrency error.'
125 replace['longdesc'] = 'Global Concurrency error. @{p2}@ conflicts with @{p1}@'
126 replace['outcome'] = 'ERROR: LocalConcurrency'
127 replace['errormsg'] = 'Global Concurrency error. @{p2}@ at @{filename}@:@{line:MBIERROR2}@ conflicts with @{p1}@ line @{line:MBIERROR1}@'
128 make_file(template, f'GlobalConcurrency_rl_{e}_{p1}_{p2}_nok.c', replace)