From: Arnaud Giersch Date: Fri, 14 Feb 2014 09:06:10 +0000 (+0100) Subject: Print messages on stderr so that they're correctly interleaved with xbt log outputs. X-Git-Tag: v3_11_beta~33 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/cff33a62d235bb80c07ee285d01621acfce565e4 Print messages on stderr so that they're correctly interleaved with xbt log outputs. --- diff --git a/examples/smpi/energy/energy.tesh b/examples/smpi/energy/energy.tesh index 25dc96e0fd..c77fdd998a 100644 --- a/examples/smpi/energy/energy.tesh +++ b/examples/smpi/energy/energy.tesh @@ -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 diff --git a/examples/smpi/energy/se.c b/examples/smpi/energy/se.c index feaf9e393f..ba969e56ee 100644 --- a/examples/smpi/energy/se.c +++ b/examples/smpi/energy/se.c @@ -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();