PVS-studio: V523. The 'then' statement is equivalent to the 'else' statement.
replace['longdesc'] = f'All ranks call {c1} twice'
replace['outcome'] = 'OK'
replace['errormsg'] = ''
replace['longdesc'] = f'All ranks call {c1} twice'
replace['outcome'] = 'OK'
replace['errormsg'] = ''
+ replace['change_cond'] = 'rank < nprocs'
+ replace['operation1b'] = ''
+ replace['operation2b'] = ''
+ replace['fini1b'] = ''
+ replace['fini2b'] = ''
gen.make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace)
# Generate the correct code using the collective once
replace = patterns.copy()
gen.make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace)
# Generate the correct code using the collective once
replace = patterns.copy()
replace['outcome'] = 'OK'
replace['errormsg'] = ''
replace['init2'] = ''
replace['outcome'] = 'OK'
replace['errormsg'] = ''
replace['init2'] = ''
+ replace['change_cond'] = 'rank < nprocs'
replace['operation2a'] = ''
replace['operation2a'] = ''
+ replace['operation1b'] = ''
replace['operation2b'] = ''
replace['fini2a'] = ''
replace['operation2b'] = ''
replace['fini2a'] = ''
replace['fini2b'] = ''
replace['free2'] = ''
gen.make_file(template, f'CallOrdering_{c1}_ok.c', replace)
replace['fini2b'] = ''
replace['free2'] = ''
gen.make_file(template, f'CallOrdering_{c1}_ok.c', replace)
replace['longdesc'] = f'All ranks call {c1} and then {c2}'
replace['outcome'] = 'OK'
replace['errormsg'] = ''
replace['longdesc'] = f'All ranks call {c1} and then {c2}'
replace['outcome'] = 'OK'
replace['errormsg'] = ''
+ replace['change_cond'] = 'rank < nprocs'
+ replace['operation1b'] = ''
+ replace['operation2b'] = ''
+ replace['fini1b'] = ''
+ replace['fini2b'] = ''
gen.make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace)
# Generate the incorrect ordering with two different collectives
replace = patterns.copy()
gen.make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace)
# Generate the incorrect ordering with two different collectives
replace = patterns.copy()
replace['longdesc'] = f'All ranks call {c1}'
replace['outcome'] = 'OK'
replace['errormsg'] = ''
replace['longdesc'] = f'All ranks call {c1}'
replace['outcome'] = 'OK'
replace['errormsg'] = ''
- replace['change_cond'] = 'nprocs<256'
+ replace['change_cond'] = 'rank < nprocs'
replace['operation1b'] = '' # Remove functions
replace['operation2b'] = ''
replace['operation2a'] = ''
replace['operation1b'] = '' # Remove functions
replace['operation2b'] = ''
replace['operation2a'] = ''