From ae3f559b2615a7128dfab2ad8c27404e1edcbb31 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 29 Mar 2022 18:44:36 +0200 Subject: [PATCH] [MBI] Reduce scope for variables. --- teshsuite/smpi/MBI/CollArgGenerator.py | 3 ++- teshsuite/smpi/MBI/CollP2PMessageRaceGenerator.py | 1 - teshsuite/smpi/MBI/ResleakGenerator.py | 6 +++--- teshsuite/smpi/MBI/generator_utils.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/teshsuite/smpi/MBI/CollArgGenerator.py b/teshsuite/smpi/MBI/CollArgGenerator.py index 7641aaeeb2..238394a1fe 100755 --- a/teshsuite/smpi/MBI/CollArgGenerator.py +++ b/teshsuite/smpi/MBI/CollArgGenerator.py @@ -41,7 +41,8 @@ int main(int argc, char **argv) { int nprocs = -1; int rank = -1; int root = 0; - int size = 1, j=0, color=0; + int size = 1; + int j = 0; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); diff --git a/teshsuite/smpi/MBI/CollP2PMessageRaceGenerator.py b/teshsuite/smpi/MBI/CollP2PMessageRaceGenerator.py index 8709da593f..aa9e78ed6a 100755 --- a/teshsuite/smpi/MBI/CollP2PMessageRaceGenerator.py +++ b/teshsuite/smpi/MBI/CollP2PMessageRaceGenerator.py @@ -40,7 +40,6 @@ int main(int argc, char **argv) { int nprocs = -1; int rank = -1; int dest, src; - int i=0; int root = 0; int stag = 0, rtag = 0; int buff_size = 1; diff --git a/teshsuite/smpi/MBI/ResleakGenerator.py b/teshsuite/smpi/MBI/ResleakGenerator.py index d1d84eaf6f..1273773251 100755 --- a/teshsuite/smpi/MBI/ResleakGenerator.py +++ b/teshsuite/smpi/MBI/ResleakGenerator.py @@ -50,8 +50,8 @@ static void myOp(int *invec, int *inoutvec, int *len, MPI_Datatype *dtype) { int main(int argc, char **argv) { int nprocs = -1; int rank = -1; - int i=1, j=0, size=1; - int color =0; + int size = 1; + int j = 0; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); @@ -118,7 +118,7 @@ for call in gen.tcoll: replace['outcome'] = f'ERROR: {gen.error[call]}' replace['errormsg'] = 'Resleak. @{call}@ at @{filename}@:@{line:MBIERROR}@ lacks several free.' replace['change_size'] = 'size=PARAM_PER_ITERATION;' - replace['loop'] = 'for (i = 0; i < ITERATIONS; i++) {\n for (j = 0; j < PARAM_PER_ITERATION; j++) {' + replace['loop'] = 'for (int i = 0; i < ITERATIONS; i++) {\n for (j = 0; j < PARAM_PER_ITERATION; j++) {' replace['cond'] = ' if (j < PARAM_PER_ITERATION - PARAM_LOST_PER_ITERATION) {' replace['fini'] = gen.fini[call]("1") + ' /* MBIERROR */' replace['end'] = ' }\n }\n }' diff --git a/teshsuite/smpi/MBI/generator_utils.py b/teshsuite/smpi/MBI/generator_utils.py index 554c7bdbaf..75e867306d 100644 --- a/teshsuite/smpi/MBI/generator_utils.py +++ b/teshsuite/smpi/MBI/generator_utils.py @@ -255,7 +255,7 @@ write['MPI_Ialltoallv'] = lambda n: f"rbuf{n}[0]++;" ### COLL:tools -init['MPI_Comm_split'] = lambda n: f'MPI_Comm com[size]; color = rank % 2; int key = 1;' +init['MPI_Comm_split'] = lambda n: f'MPI_Comm com[size]; int color = rank % 2; int key = 1;' start['MPI_Comm_split'] = lambda n: "" operation['MPI_Comm_split'] = lambda n: 'MPI_Comm_split(MPI_COMM_WORLD,color,key, &com[j]);' error['MPI_Comm_split'] = 'CommunicatorLeak' -- 2.30.2