4 from generator_utils import *
6 template = """// @{generatedby}@
7 /* ///////////////////////// The MPI Bugs Initiative ////////////////////////
11 Description: @{shortdesc}@
14 Version of MPI: Conforms to MPI 2, does not require MPI 3 implementation
17 P2P!basic: @{p2pfeature}@
18 P2P!nonblocking: @{ip2pfeature}@
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 = malloc(N * sizeof(int)); // Window buffer
47 MPI_Init(&argc, &argv);
48 MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
49 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
50 printf("Hello from rank %d \\n", rank);
53 printf("MBI ERROR: This test needs at least 4 processes to produce a bug!\\n");
55 MPI_Comm newcom = MPI_COMM_WORLD;
56 MPI_Datatype type = MPI_INT;
60 MPI_Win_create(winbuf, N*sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &win);
69 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, 1, 0, win);
71 localbuf1[0] = 12345; /* MBIERROR1 */
72 MPI_Win_unlock(1, win);
81 winbuf[0] = buf3; /* MBIERROR2 */
89 printf("Rank %d finished normally\\n", rank);
96 for s in send + isend:
97 for r in recv + irecv:
99 patterns = {'p': p, 's': s, 'r': r}
100 patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
101 patterns['rmafeature'] = 'Yes'
102 patterns['p2pfeature'] = 'Yes' if s in send or r in recv else 'Lacking'
103 patterns['ip2pfeature'] = 'Yes' if s in isend or r in irecv else 'Lacking'
107 patterns['init1'] = init[p]("1")
108 patterns['init2'] = init[s]("2")
109 patterns['init3'] = init[r]("3")
110 patterns['fini2'] = fini[s]("2")
111 patterns['fini3'] = fini[r]("3")
112 patterns['operation1'] = operation[p]("1") #put or get
113 patterns['operation2'] = operation[s]("2") #send
114 patterns['operation3'] = operation[r]("3") #recv
117 replace['shortdesc'] = 'Global Concurrency error.'
118 replace['longdesc'] = 'Global Concurrency error. Concurrent access of variable winbuf by @{p}@ and @{r}@'
119 replace['outcome'] = 'ERROR: GlobalConcurrency'
120 replace['errormsg'] = 'Global Concurrency error. @{p}@ at @{filename}@:@{line:MBIERROR1}@ accesses the window of process 1. Process 1 receives data from process 2 and uses variable winbuf. winbuf in process 1 is then nondeterministic.'
121 make_file(template, f'GlobalConcurrency_{p}_{s}_{r}_nok.c', replace)