commit 387be624f2e16dcdd556cfe88355f52978721a07
parent 4c46162717b3f588bfe27fb33e4badef4cf709cb
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Tue, 12 Apr 2022 18:12:44 +0200
Fix paths not written if all paths failed
Diffstat:
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/src/stardis-compute.c b/src/stardis-compute.c
@@ -550,17 +550,20 @@ compute_probe(struct stardis* stardis, struct time* start)
if(stardis->mpi_initialized && stardis->mpi_rank != 0) {
ERR(sdis_solve_probe(stardis->sdis_scn, &args, &estimator));
} else {
+ res_T tmp_res1, tmp_res2;
time_current(&compute_start);
ERR(sdis_solve_probe(stardis->sdis_scn, &args, &estimator));
time_current(&compute_end);
ERR(print_computation_time(estimator, stardis,
start, &compute_start, &compute_end, NULL));
- ERR(print_single_MC_result(estimator, stardis, stdout));
+ tmp_res1 = print_single_MC_result(estimator, stardis, stdout);
/* Dump recorded paths according to user settings */
dump_ctx.stardis = stardis;
dump_ctx.rank = 0;
- ERR(sdis_estimator_for_each_path(estimator, dump_path, &dump_ctx));
+ tmp_res2 = sdis_estimator_for_each_path(estimator, dump_path, &dump_ctx);
+ if(tmp_res1 != RES_OK) res = tmp_res1;
+ else if(tmp_res2 != RES_OK) res = tmp_res2;
}
}
@@ -807,17 +810,20 @@ compute_probe_on_interface(struct stardis* stardis, struct time* start)
if(stardis->mpi_initialized && stardis->mpi_rank != 0) {
ERR(sdis_solve_probe_boundary(stardis->sdis_scn, &args, &estimator));
} else {
+ res_T tmp_res1, tmp_res2;
time_current(&compute_start);
ERR(sdis_solve_probe_boundary(stardis->sdis_scn, &args, &estimator));
time_current(&compute_end);
ERR(print_computation_time(estimator, stardis,
start, &compute_start, &compute_end, NULL));
- ERR(print_single_MC_result(estimator, stardis, stdout));
+ tmp_res1 = print_single_MC_result(estimator, stardis, stdout);
/* Dump recorded paths according to user settings */
dump_ctx.stardis = stardis;
dump_ctx.rank = 0;
- ERR(sdis_estimator_for_each_path(estimator, dump_path, &dump_ctx));
+ tmp_res2 = sdis_estimator_for_each_path(estimator, dump_path, &dump_ctx);
+ if(tmp_res1 != RES_OK) res = tmp_res1;
+ else if(tmp_res2 != RES_OK) res = tmp_res2;
}
}
@@ -1094,16 +1100,19 @@ compute_medium(struct stardis* stardis, struct time* start)
if(stardis->mpi_initialized && stardis->mpi_rank != 0) {
ERR(sdis_solve_medium(stardis->sdis_scn, &args, &estimator));
} else {
+ res_T tmp_res1, tmp_res2;
time_current(&compute_start);
ERR(sdis_solve_medium(stardis->sdis_scn, &args, &estimator));
time_current(&compute_end);
ERR(print_computation_time(estimator, stardis,
start, &compute_start, &compute_end, NULL));
- ERR(print_single_MC_result(estimator, stardis, stdout));
+ tmp_res1 = print_single_MC_result(estimator, stardis, stdout);
/* Dump recorded paths according to user settings */
dump_ctx.stardis = stardis;
dump_ctx.rank = 0;
- ERR(sdis_estimator_for_each_path(estimator, dump_path, &dump_ctx));
+ tmp_res2 = sdis_estimator_for_each_path(estimator, dump_path, &dump_ctx);
+ if(tmp_res1 != RES_OK) res = tmp_res1;
+ else if(tmp_res2 != RES_OK) res = tmp_res2;
}
}
@@ -1246,16 +1255,19 @@ compute_boundary(struct stardis* stardis, struct time* start)
if(stardis->mpi_initialized && stardis->mpi_rank != 0) {
ERR(sdis_solve_boundary(stardis->sdis_scn, &args, &estimator));
} else {
+ res_T tmp_res1, tmp_res2;
time_current(&compute_start);
ERR(sdis_solve_boundary(stardis->sdis_scn, &args, &estimator));
time_current(&compute_end);
ERR(print_computation_time(estimator, stardis,
start, &compute_start, &compute_end, NULL));
- ERR(print_single_MC_result(estimator, stardis, stdout));
+ tmp_res1 = print_single_MC_result(estimator, stardis, stdout);
/* Dump recorded paths according to user settings */
dump_ctx.stardis = stardis;
dump_ctx.rank = 0;
- ERR(sdis_estimator_for_each_path(estimator, dump_path, &dump_ctx));
+ tmp_res2 = sdis_estimator_for_each_path(estimator, dump_path, &dump_ctx);
+ if(tmp_res1 != RES_OK) res = tmp_res1;
+ else if(tmp_res2 != RES_OK) res = tmp_res2;
}
}
@@ -1302,17 +1314,20 @@ compute_flux_boundary(struct stardis* stardis, struct time* start)
if(stardis->mpi_initialized && stardis->mpi_rank != 0) {
ERR(sdis_solve_boundary_flux(stardis->sdis_scn, &args, &estimator));
} else {
+ res_T tmp_res1, tmp_res2;
time_current(&compute_start);
ERR(sdis_solve_boundary_flux(stardis->sdis_scn, &args, &estimator));
time_current(&compute_end);
ERR(print_computation_time(estimator, stardis,
start, &compute_start, &compute_end, NULL));
- ERR(print_single_MC_result(estimator, stardis, stdout));
+ tmp_res1 = print_single_MC_result(estimator, stardis, stdout);
/* Dump recorded paths according to user settings */
dump_ctx.stardis = stardis;
dump_ctx.rank = 0;
- ERR(sdis_estimator_for_each_path(estimator, dump_path, &dump_ctx));
+ tmp_res2 = sdis_estimator_for_each_path(estimator, dump_path, &dump_ctx);
+ if(tmp_res1 != RES_OK) res = tmp_res1;
+ else if(tmp_res2 != RES_OK) res = tmp_res2;
}
/* Output random state? */
diff --git a/src/stardis-prog-properties.h.in b/src/stardis-prog-properties.h.in
@@ -21,6 +21,7 @@
* Please refer to stardis(1) and stardis-input(5) man pages for additional
* information. */
+/* The version of the API described thereafter */
#define STARDIS_PROG_PROPERTIES_VERSION @STARDIS_PROG_PROPERTIES_VERSION@
/*****************************************************************************/