A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rename some symbols around Link::isShared to make their purpose clear
[simgrid.git]
/
examples
/
smpi
/
energy
/
se.c
diff --git
a/examples/smpi/energy/se.c
b/examples/smpi/energy/se.c
index
ba969e5
..
be95ba9
100644
(file)
--- a/
examples/smpi/energy/se.c
+++ b/
examples/smpi/energy/se.c
@@
-1,4
+1,4
@@
-/* Copyright (c) 2013-201
4
. The SimGrid Team.
+/* Copyright (c) 2013-201
5
. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
@@
-16,13
+16,20
@@
int main(int argc, char *argv[])
char buf[1024];
char *s;
size_t sz, x;
char buf[1024];
char *s;
size_t sz, x;
+ int err;
- if (MPI_Init(&argc, &argv) != MPI_SUCCESS) {
- fprintf(stderr, "MPI initialization failed!\n");
+ err = MPI_Init(&argc, &argv);
+ if (err != MPI_SUCCESS) {
+ fprintf(stderr, "MPI_init failed: %d\n", err);
exit(EXIT_FAILURE);
}
exit(EXIT_FAILURE);
}
- MPI_Comm_rank(MPI_COMM_WORLD, &rank); /* Get id of this process */
+ err = MPI_Comm_rank(MPI_COMM_WORLD, &rank); /* Get id of this process */
+ if (err != MPI_SUCCESS) {
+ fprintf(stderr, "MPI_Comm_rank failed: %d", err);
+ MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
+ exit(EXIT_FAILURE);
+ }
pstates = smpi_get_host_nb_pstates();
pstates = smpi_get_host_nb_pstates();
@@
-47,7
+54,7
@@
int main(int argc, char *argv[])
fprintf(stderr, "%s%s\n", buf, (sz ? "" : " [...]"));
for (i = 0; i < pstates; i++) {
fprintf(stderr, "%s%s\n", buf, (sz ? "" : " [...]"));
for (i = 0; i < pstates; i++) {
- smpi_set_host_p
ower_peak_at
(i);
+ smpi_set_host_p
state
(i);
fprintf(stderr, "[%.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());
@@
-59,5
+66,12
@@
int main(int argc, char *argv[])
MPI_Wtime(), rank, smpi_get_host_consumed_energy());
}
MPI_Wtime(), rank, smpi_get_host_consumed_energy());
}
- return MPI_Finalize();
+ err = MPI_Finalize();
+ if (err != MPI_SUCCESS) {
+ fprintf(stderr, "MPI_Finalize failed: %d\n", err);
+ MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
+ exit(EXIT_FAILURE);
+ }
+
+ return EXIT_SUCCESS;
}
}