Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[MBI] Reduce scope for variables.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 29 Mar 2022 16:44:36 +0000 (18:44 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 29 Mar 2022 21:13:09 +0000 (23:13 +0200)
teshsuite/smpi/MBI/CollArgGenerator.py
teshsuite/smpi/MBI/CollP2PMessageRaceGenerator.py
teshsuite/smpi/MBI/ResleakGenerator.py
teshsuite/smpi/MBI/generator_utils.py

index 7641aaeeb2ea154faec2a54b51892ae3053cfa84..238394a1fe39e06895199a04b3e356803e7e444f 100755 (executable)
@@ -41,7 +41,8 @@ int main(int argc, char **argv) {
   int nprocs = -1;
   int rank = -1;
   int root = 0;
   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);
 
   MPI_Init(&argc, &argv);
   MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
index 8709da593fbdce3ac71358a0adf275412641fb93..aa9e78ed6a3d0f697dac89c6f2cf41398a94bb6b 100755 (executable)
@@ -40,7 +40,6 @@ int main(int argc, char **argv) {
   int nprocs = -1;
   int rank = -1;
   int dest, src;
   int nprocs = -1;
   int rank = -1;
   int dest, src;
-  int i=0;
   int root = 0;
   int stag = 0, rtag = 0;
   int buff_size = 1;
   int root = 0;
   int stag = 0, rtag = 0;
   int buff_size = 1;
index d1d84eaf6fe11a23595b922733a1592225cc123d..127377325154138a21793396f4cbbad4f8e42e8e 100755 (executable)
@@ -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 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);
 
   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['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   }'
     replace['cond'] = '      if (j < PARAM_PER_ITERATION - PARAM_LOST_PER_ITERATION) {'
     replace['fini'] = gen.fini[call]("1") + ' /* MBIERROR */'
     replace['end'] = '      }\n     }\n   }'
index 554c7bdbaf70b52ac2462422eb02b83f1cbe2ecb..75e867306d5d16b10760a5f09b280216a4a84d4e 100644 (file)
@@ -255,7 +255,7 @@ write['MPI_Ialltoallv'] = lambda n: f"rbuf{n}[0]++;"
 
 ### COLL:tools
 
 
 ### 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'
 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'