4 from generator_utils import *
6 template = """// @{generatedby}@
7 /* ///////////////////////// The MPI Bugs Initiative ////////////////////////
11 Description: @{shortdesc}@
17 P2P!nonblocking: Lacking
18 P2P!persistent: Lacking
20 COLL!nonblocking: Lacking
21 COLL!persistent: Lacking
31 ////////////////////// End of MBI headers /////////////////// */
42 void get_win(MPI_Win *win) {
45 MPI_Win_create(@{buffer}@, N * sizeof(int), 1, MPI_INFO_NULL, MPI_COMM_WORLD, win);
50 int main(int argc, char *argv[]) {
53 MPI_Init(&argc, &argv);
54 MPI_Comm_size(MPI_COMM_WORLD, &numProcs);
55 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
56 printf("Hello from rank %d \\n", rank);
59 printf("MBI ERROR: This test needs at least 2 processes to produce a bug!\\n");
65 MPI_Win_fence(0, win);
68 int localbuf[N] = {12345};
69 MPI_Put(&localbuf, N, MPI_INT, 1, 0, N, MPI_INT, win);
72 MPI_Win_fence(0, win);
79 printf("Rank %d finished normally\\n", rank);
86 for b in ['missing', 'null', 'malloc', 'bufferSize']:
89 patterns['origin'] = "MPI-CorrBench"
90 patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
91 patterns['rmafeature'] = 'Yes'
94 replace['shortdesc'] = 'Invalid buffer in window creation.'
95 replace['longdesc'] = 'Invalid buffer in window creation.'
96 replace['outcome'] = 'ERROR: InvalidBuffer'
97 replace['errormsg'] = '@{b}@ at @{filename}@:@{line:MBIERROR}@ has an invalid buffer'
98 replace['bufferfree'] = ''
101 replace['buffer'] = 'buffer'
104 replace['bufferalloc'] = '/* MBIERROR1 */'
105 replace['longdesc'] = 'Uninitialized buffer in window creation.'
107 replace['bufferalloc'] = 'buffer = NULL; /* MBIERROR1 */'
108 replace['longdesc'] = 'Use NULL buffer in window creation.'
109 elif b == 'bufferSize':
110 replace['bufferalloc'] = 'buffer = malloc((N/2) * sizeof(int)); /* MBIERROR1 */'
111 replace['bufferfree'] = 'free(buffer);'
112 replace['longdesc'] = 'Unmatched size of buffer in window creation.'
114 replace['bufferalloc'] = 'buffer = malloc(N * sizeof(int));'
115 replace['bufferfree'] = 'free(buffer);'
116 replace['longdesc'] = 'Correct initialized buffer in window creation.'
117 replace['outcome'] = 'OK'
118 replace['errormsg'] = ''
121 make_file(template, f'InvalidParam_WinBuffer_{b}_{ok}.c', replace)