import hashlib
class AbstractTool:
- def ensure_image(self, params=""):
+ def ensure_image(self, params="", dockerparams=""):
"""Verify that this is executed from the right docker image, and complain if not."""
if os.path.exists("/MBI") or os.path.exists("trust_the_installation"):
print("This seems to be a MBI docker image. Good.")
else:
print("Please run this script in a MBI docker image. Run these commands:")
print(" docker build -f Dockerfile -t mpi-bugs-initiative:latest . # Only the first time")
- print(f" docker run -it --rm --name MIB --volume $(pwd):/MBI mpi-bugs-initiative /MBI/MBI.py {params}")
+ print(f" docker run -it --rm --name MIB --volume $(pwd):/MBI {dockerparams}mpi-bugs-initiative /MBI/MBI.py {params}")
sys.exit(1)
def build(self, rootdir, cached=True):
diagnostic = f'hard timeout'
else:
diagnostic = f'timeout after {elapsed} sec'
- elif outcome == 'failure':
+ elif outcome == 'failure' or outcome == 'segfault':
res_category = 'failure'
diagnostic = f'tool error, or test not run'
elif outcome == 'UNIMPLEMENTED':
#include <stdio.h>
#include <stdlib.h>
-#define buff_size 128
+#define buff_size 1
int main(int argc, char **argv) {
int nprocs = -1;
for e in epoch:
for p1 in get:
- for p2 in rput + rstore + rload + rget :
+ for p2 in put + rstore + rload + get :
patterns = {}
patterns = {'e': e, 'p1': p1, 'p2': p2}
patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
replace['longdesc'] = 'Global Concurrency error. @{p2}@ conflicts with @{p1}@'
replace['outcome'] = 'ERROR: GlobalConcurrency'
replace['errormsg'] = 'Global Concurrency error. @{p2}@ at @{filename}@:@{line:MBIERROR2}@ conflicts with @{p1}@ line @{line:MBIERROR1}@'
+
+ # Replace Put and Get first argument
+ if p2 in put:
+ replace['operation2'] = 'MPI_Put(&winbuf[20], N, MPI_INT, target, 0, N, type, win);'
+ if p2 in get:
+ replace['operation2'] = 'MPI_Get(&winbuf[20], N, MPI_INT, target, 0, N, type, win);'
+
make_file(template, f'GlobalConcurrency_rl_{e}_{p1}_{p2}_nok.c', replace)
for e in epoch:
for p1 in put:
- for p2 in rstore + rload + rput:
+ for p2 in rstore + rload + put:
patterns = {}
patterns = {'e': e, 'p1': p1, 'p2': p2}
patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
replace['longdesc'] = 'Global Concurrency error. @{p2}@ conflicts with @{p1}@'
replace['outcome'] = 'ERROR: LocalConcurrency'
replace['errormsg'] = 'Global Concurrency error. @{p2}@ at @{filename}@:@{line:MBIERROR2}@ conflicts with @{p1}@ line @{line:MBIERROR1}@'
+
+ # Replace Put first argument
+ if p2 in put:
+ replace['operation2'] = 'MPI_Put(&winbuf[20], N, MPI_INT, target, 0, N, type, win);'
+
make_file(template, f'GlobalConcurrency_rl_{e}_{p1}_{p2}_nok.c', replace)
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
printf("Hello from rank %d \\n", rank);
+ if (numProcs < 2)
+ printf("MBI ERROR: This test needs at least 2 processes to produce a bug!\\n");
+
MPI_Win win;
get_win(&win);
+ MPI_Win_fence(0, win);
+
+ if (rank == 0) {
+ int localbuf[N] = {12345};
+ MPI_Put(&localbuf, N, MPI_INT, 1, 0, N, MPI_INT, win);
+ }
+
+ MPI_Win_fence(0, win);
+
MPI_Win_free(&win);
@{bufferfree}@
coll4root = ['MPI_Reduce', 'MPI_Bcast', 'MPI_Gather', 'MPI_Scatter']
icoll4root = ['MPI_Ireduce', 'MPI_Ibcast', 'MPI_Igather', 'MPI_Iscatter']
pcoll = []
-tcoll = ['MPI_Comm_split', 'MPI_Op_create', 'MPI_Comm_group', 'MPI_Comm_dup', 'MPI_Type_contiguous', 'MPI_Comm_create', 'MPI_Group_excl']
+tcoll = ['MPI_Comm_split', 'MPI_Op_create', 'MPI_Comm_dup', 'MPI_Type_contiguous', 'MPI_Comm_create', 'MPI_Group_excl'] # MPI_Comm_dup removed
tcoll4color = ['MPI_Comm_split']
tcoll4topo = ['MPI_Cart_get']
epoch = ['MPI_Win_fence', 'MPI_Win_lock', 'MPI_Win_lock_all']
rma = ['MPI_Get', 'MPI_Put']
get = ['MPI_Get']
-rget = ['MPI_RGet']
put = ['MPI_Put']
-rput = ['MPI_RPut']
store = ['store']
load = ['load']
rstore = ['rstore']
epoch['MPI_Win_lock_all'] =lambda n: 'MPI_Win_lock_all(0,win);'
finEpoch['MPI_Win_lock_all'] =lambda n: 'MPI_Win_unlock_all(win);'
-init['MPI_Put'] = lambda n: f'int localbuf{n} = 12345;'
+init['MPI_Put'] = lambda n: f'int localbuf{n}[N] = {{12345}};'
operation['MPI_Put'] = lambda n: f'MPI_Put(&localbuf{n}, N, MPI_INT, target, 0, N, type, win);'
-init['MPI_RPut'] = lambda n: ""
-operation['MPI_RPut'] = lambda n: f'MPI_Put(&winbuf[20], N, MPI_INT, target, 0, N, type, win);'
-
-init['MPI_Get'] = lambda n: f'int localbuf{n} = 54321;'
+init['MPI_Get'] = lambda n: f'int localbuf{n}[N] = {{54321}};'
operation['MPI_Get'] = lambda n: f'MPI_Get(&localbuf{n}, N, MPI_INT, target, 0, N, type, win);'
-init['MPI_RGet'] = lambda n: ""
-operation['MPI_RGet'] = lambda n: f'MPI_Get(&winbuf[20], N, MPI_INT, target, 0, N, type, win);'
-
-init['store'] = lambda n: f'int localbuf{n} = 0;'
-operation['store'] = lambda n: f'localbuf{n} = 8;'
+init['store'] = lambda n: f'int localbuf{n}[N] = {{0}};'
+operation['store'] = lambda n: f'localbuf{n}[0] = 8;'
init['rstore'] = lambda n: ""
operation['rstore'] = lambda n: f'winbuf[20] = 12346;'
-init['load'] = lambda n: f'int localbuf{n} = 0;'
-operation['load'] = lambda n: f'int load = localbuf{n};'
+init['load'] = lambda n: f'int localbuf{n}[N] = {{0}};'
+operation['load'] = lambda n: f'int load = localbuf{n}[0];'
init['rload'] = lambda n: ""
operation['rload'] = lambda n: "int load = winbuf[20];"
-init['loadstore'] = lambda n: f'int localbuf{n} = 0;'
-operation['loadstore'] = lambda n: f'if (localbuf{n} % 2 == 0) localbuf{n}++; '
+init['loadstore'] = lambda n: f'int localbuf{n}[N] = {{0}};'
+operation['loadstore'] = lambda n: f'if (localbuf{n}[0] % 2 == 0) localbuf{n}[0]++; '