4 import generator_utils as gen
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);
63 if (rank == 0 || rank == 2) {
64 @{operation1}@ /* MBIERROR1 */
78 for p1 in gen.get + gen.put:
80 patterns = {'e': e, 'p1': p1}
81 patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
82 patterns['rmafeature'] = 'Yes'
85 patterns['epoch'] = gen.epoch[e]("1")
86 patterns['finEpoch'] = gen.finEpoch[e]("1")
87 patterns['init1'] = gen.init[p1]("1")
88 patterns['operation1'] = gen.operation[p1]("1")
90 # Generate a data race (Get + Get/load/store/Put)
91 replace = patterns.copy()
92 replace['shortdesc'] = 'Global Concurrency error.'
93 replace['longdesc'] = 'Global Concurrency error. Both processes 0 and 2 access the window in process 1 with @{p1}@'
94 replace['outcome'] = 'ERROR: GlobalConcurrency'
95 replace['errormsg'] = 'Global Concurrency error. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ conflicts in process 1'
96 gen.make_file(template, f'GlobalConcurrency_rr_{e}_{p1}_nok.c', replace)