Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Print messages on stderr so that they're correctly interleaved with xbt log outputs.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 14 Feb 2014 09:06:10 +0000 (10:06 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 14 Feb 2014 09:06:36 +0000 (10:06 +0100)
examples/smpi/energy/energy.tesh
examples/smpi/energy/se.c

index 25dc96e..c77fdd9 100644 (file)
@@ -6,8 +6,6 @@ $ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile  -platf
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/cpu_threshold' to '-1'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'plugin' to 'Energy'
 > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
-> [80.000000] [surf_energy/INFO] Total energy (Joules) of host MyHost1: 12900.000000
-> [80.000000] [surf_energy/INFO] Total energy (Joules) of host MyHost2: 2000.000000
 > [0.000000] [rank 1] Pstates: 1; Powers: 100000000
 > [0.000000] [rank 0] Pstates: 3; Powers: 100000000, 50000000, 20000000
 > [0.000000] [rank 1] Current pstate: 0; Current power: 100000000
@@ -18,3 +16,5 @@ $ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile  -platf
 > [30.000000] [rank 0] Energy consumed: 5400 Joules.
 > [30.000000] [rank 0] Current pstate: 2; Current power: 20000000
 > [80.000000] [rank 0] Energy consumed: 12900 Joules.
+> [80.000000] [surf_energy/INFO] Total energy (Joules) of host MyHost1: 12900.000000
+> [80.000000] [surf_energy/INFO] Total energy (Joules) of host MyHost2: 2000.000000
index feaf9e3..ba969e5 100644 (file)
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
   size_t sz, x;
 
   if (MPI_Init(&argc, &argv) != MPI_SUCCESS) {
-    printf("MPI initialization failed!\n");
+    fprintf(stderr, "MPI initialization failed!\n");
     exit(EXIT_FAILURE);
   }
 
@@ -44,19 +44,19 @@ int main(int argc, char *argv[])
     } else
       sz = 0;
   }
-  printf("%s%s\n", buf, (sz ? "" : " [...]"));
+  fprintf(stderr, "%s%s\n", buf, (sz ? "" : " [...]"));
 
   for (i = 0; i < pstates; i++) {
     smpi_set_host_power_peak_at(i);
-    printf("[%.6f] [rank %d] Current pstate: %d; Current power: %.0f\n",
-           MPI_Wtime(), rank, i, smpi_get_host_current_power_peak());
+    fprintf(stderr, "[%.6f] [rank %d] Current pstate: %d; Current power: %.0f\n",
+            MPI_Wtime(), rank, i, smpi_get_host_current_power_peak());
 
     SMPI_SAMPLE_FLOPS(1e9) {
       /* imagine here some code running for 1e9 flops... */
     }
 
-    printf("[%.6f] [rank %d] Energy consumed: %g Joules.\n",
-           MPI_Wtime(), rank, smpi_get_host_consumed_energy());
+    fprintf(stderr, "[%.6f] [rank %d] Energy consumed: %g Joules.\n",
+            MPI_Wtime(), rank, smpi_get_host_consumed_energy());
   }
 
   return MPI_Finalize();