diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-02-26 15:26:55 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-02-26 15:26:55 +0000 |
commit | 7833be041992f83a89e6ab7fa4e1c466c7d787c9 (patch) | |
tree | 52a3f14cb64e5b208011cbb4385f51fd3d452839 /src | |
parent | 9c27f52e1ccb192b84a5305eb10d9f159a6f26c6 (diff) | |
download | gnunet-7833be041992f83a89e6ab7fa4e1c466c7d787c9.tar.gz gnunet-7833be041992f83a89e6ab7fa4e1c466c7d787c9.zip |
changes
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/gnunet-service-ats_addresses_mlp.c | 21 | ||||
-rw-r--r-- | src/ats/perf_ats_mlp.c | 22 |
2 files changed, 34 insertions, 9 deletions
diff --git a/src/ats/gnunet-service-ats_addresses_mlp.c b/src/ats/gnunet-service-ats_addresses_mlp.c index 955a9cedd..ab4602b6e 100644 --- a/src/ats/gnunet-service-ats_addresses_mlp.c +++ b/src/ats/gnunet-service-ats_addresses_mlp.c | |||
@@ -1065,7 +1065,8 @@ int | |||
1065 | GAS_mlp_solve_problem (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addresses) | 1065 | GAS_mlp_solve_problem (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addresses) |
1066 | { | 1066 | { |
1067 | struct GAS_MLP_Handle *mlp = solver; | 1067 | struct GAS_MLP_Handle *mlp = solver; |
1068 | int res = 0; | 1068 | int res_lp = 0; |
1069 | int res_mip = 0; | ||
1069 | struct GNUNET_TIME_Absolute start_build; | 1070 | struct GNUNET_TIME_Absolute start_build; |
1070 | struct GNUNET_TIME_Relative duration_build; | 1071 | struct GNUNET_TIME_Relative duration_build; |
1071 | struct GNUNET_TIME_Absolute start_lp; | 1072 | struct GNUNET_TIME_Absolute start_lp; |
@@ -1096,22 +1097,23 @@ GAS_mlp_solve_problem (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addr | |||
1096 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Problem was updated, resolving\n"); | 1097 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Problem was updated, resolving\n"); |
1097 | } | 1098 | } |
1098 | 1099 | ||
1099 | |||
1100 | /* Run LP solver */ | 1100 | /* Run LP solver */ |
1101 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Running LP solver %s\n", (GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without presolver"); | 1101 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Running LP solver %s\n", (GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without presolver"); |
1102 | start_lp = GNUNET_TIME_absolute_get(); | 1102 | start_lp = GNUNET_TIME_absolute_get(); |
1103 | res = mlp_solve_lp_problem (mlp); | 1103 | res_lp = mlp_solve_lp_problem (mlp); |
1104 | duration_lp = GNUNET_TIME_absolute_get_duration (start_lp); | 1104 | duration_lp = GNUNET_TIME_absolute_get_duration (start_lp); |
1105 | mlp->ps.lp_res = res; | 1105 | |
1106 | 1106 | ||
1107 | /* Run LP solver */ | 1107 | /* Run LP solver */ |
1108 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n"); | 1108 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n"); |
1109 | start_mlp = GNUNET_TIME_absolute_get(); | 1109 | start_mlp = GNUNET_TIME_absolute_get(); |
1110 | res = mlp_solve_mlp_problem (mlp); | 1110 | res_mip = mlp_solve_mlp_problem (mlp); |
1111 | 1111 | ||
1112 | duration_mlp = GNUNET_TIME_absolute_get_duration (start_mlp); | 1112 | duration_mlp = GNUNET_TIME_absolute_get_duration (start_mlp); |
1113 | mlp->ps.mip_res = res; | ||
1114 | 1113 | ||
1114 | /* Save stats */ | ||
1115 | mlp->ps.lp_res = res_lp; | ||
1116 | mlp->ps.mip_res = res_mip; | ||
1115 | mlp->ps.build_dur = duration_build; | 1117 | mlp->ps.build_dur = duration_build; |
1116 | mlp->ps.lp_dur = duration_lp; | 1118 | mlp->ps.lp_dur = duration_lp; |
1117 | mlp->ps.mip_dur = duration_mlp; | 1119 | mlp->ps.mip_dur = duration_mlp; |
@@ -1127,7 +1129,7 @@ GAS_mlp_solve_problem (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addr | |||
1127 | (unsigned long long) duration_mlp.rel_value); | 1129 | (unsigned long long) duration_mlp.rel_value); |
1128 | 1130 | ||
1129 | /* Propagate result*/ | 1131 | /* Propagate result*/ |
1130 | if (GNUNET_OK == res) | 1132 | if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip)) |
1131 | GNUNET_CONTAINER_multihashmap_iterate (addresses, &mlp_propagate_results, mlp); | 1133 | GNUNET_CONTAINER_multihashmap_iterate (addresses, &mlp_propagate_results, mlp); |
1132 | 1134 | ||
1133 | /* Write problem and solution to disk */ | 1135 | /* Write problem and solution to disk */ |
@@ -1147,7 +1149,10 @@ GAS_mlp_solve_problem (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addr | |||
1147 | mlp->mlp_prob_updated = GNUNET_NO; | 1149 | mlp->mlp_prob_updated = GNUNET_NO; |
1148 | mlp->mlp_prob_changed = GNUNET_NO; | 1150 | mlp->mlp_prob_changed = GNUNET_NO; |
1149 | 1151 | ||
1150 | return res; | 1152 | if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip)) |
1153 | return GNUNET_OK; | ||
1154 | else | ||
1155 | return GNUNET_SYSERR; | ||
1151 | } | 1156 | } |
1152 | 1157 | ||
1153 | /** | 1158 | /** |
diff --git a/src/ats/perf_ats_mlp.c b/src/ats/perf_ats_mlp.c index c615a57b9..a41acf75b 100644 --- a/src/ats/perf_ats_mlp.c +++ b/src/ats/perf_ats_mlp.c | |||
@@ -76,6 +76,7 @@ struct PerfPeer | |||
76 | }; | 76 | }; |
77 | 77 | ||
78 | static int ret; | 78 | static int ret; |
79 | static int numeric; | ||
79 | 80 | ||
80 | static int N_peers_start; | 81 | static int N_peers_start; |
81 | static int N_peers_end; | 82 | static int N_peers_end; |
@@ -216,6 +217,9 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
216 | for (cp = 0; cp < count_p; cp++) | 217 | for (cp = 0; cp < count_p; cp++) |
217 | perf_create_peer (cp); | 218 | perf_create_peer (cp); |
218 | 219 | ||
220 | if (GNUNET_YES == numeric) | ||
221 | fprintf (stderr, "#peers;#addresses per peer;LP/MIP state;presolv;exec build in ms;exec LP in ms; exec MIP in ms;#cols;#rows;#nonzero elements\n"); | ||
222 | |||
219 | for (cp = 0; cp < count_p; cp++) | 223 | for (cp = 0; cp < count_p; cp++) |
220 | { | 224 | { |
221 | for (ca = 0; ca < count_a; ca++) | 225 | for (ca = 0; ca < count_a; ca++) |
@@ -231,15 +235,27 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
231 | { | 235 | { |
232 | 236 | ||
233 | GAS_mlp_solve_problem (mlp, addresses); | 237 | GAS_mlp_solve_problem (mlp, addresses); |
234 | fprintf (stderr, "%u peers each %u addresses; state [%s/%s], (build/LP/MIP in ms): %04llu %04llu %04llu; presolv LP/MIP [%s/%s]; size (cols x rows, nonzero elements): [%u x %u] = %u\n", | 238 | if (GNUNET_NO == numeric) |
239 | fprintf (stderr, "%u peers each %u addresses; LP/MIP state [%s/%s] presolv [%s/%s], (build/LP/MIP in ms): %04llu %04llu %04llu; size (cols x rows, nonzero elements): [%u x %u] = %u\n", | ||
235 | cp + 1, ca, | 240 | cp + 1, ca, |
236 | (GNUNET_OK == mlp->ps.lp_res) ? "OK" : "FAIL", | 241 | (GNUNET_OK == mlp->ps.lp_res) ? "OK" : "FAIL", |
237 | (GNUNET_OK == mlp->ps.mip_res) ? "OK" : "FAIL", | 242 | (GNUNET_OK == mlp->ps.mip_res) ? "OK" : "FAIL", |
243 | (GLP_YES == mlp->ps.lp_presolv) ? "YES" : "NO", | ||
244 | (GNUNET_OK == mlp->ps.mip_presolv) ? "YES" : "NO", | ||
238 | (unsigned long long) mlp->ps.build_dur.rel_value, | 245 | (unsigned long long) mlp->ps.build_dur.rel_value, |
239 | (unsigned long long) mlp->ps.lp_dur.rel_value, | 246 | (unsigned long long) mlp->ps.lp_dur.rel_value, |
240 | (unsigned long long) mlp->ps.mip_dur.rel_value, | 247 | (unsigned long long) mlp->ps.mip_dur.rel_value, |
248 | mlp->ps.p_cols, mlp->ps.p_rows, mlp->ps.p_elements); | ||
249 | else | ||
250 | fprintf (stderr, "%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu;%u;%u;%u\n", | ||
251 | cp + 1, ca, | ||
252 | (GNUNET_OK == mlp->ps.lp_res) ? "OK" : "FAIL", | ||
253 | (GNUNET_OK == mlp->ps.mip_res) ? "OK" : "FAIL", | ||
241 | (GLP_YES == mlp->ps.lp_presolv) ? "YES" : "NO", | 254 | (GLP_YES == mlp->ps.lp_presolv) ? "YES" : "NO", |
242 | (GNUNET_OK == mlp->ps.mip_presolv) ? "YES" : "NO", | 255 | (GNUNET_OK == mlp->ps.mip_presolv) ? "YES" : "NO", |
256 | (unsigned long long) mlp->ps.build_dur.rel_value, | ||
257 | (unsigned long long) mlp->ps.lp_dur.rel_value, | ||
258 | (unsigned long long) mlp->ps.mip_dur.rel_value, | ||
243 | mlp->ps.p_cols, mlp->ps.p_rows, mlp->ps.p_elements); | 259 | mlp->ps.p_cols, mlp->ps.p_rows, mlp->ps.p_elements); |
244 | } | 260 | } |
245 | 261 | ||
@@ -302,6 +318,10 @@ main (int argc, char *argv[]) | |||
302 | N_address = atoi(argv[c+1]); | 318 | N_address = atoi(argv[c+1]); |
303 | } | 319 | } |
304 | } | 320 | } |
321 | if ((0 == strcmp (argv[c], "-n"))) | ||
322 | { | ||
323 | numeric = GNUNET_YES; | ||
324 | } | ||
305 | } | 325 | } |
306 | 326 | ||
307 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 327 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |