[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26208 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26208 - gnunet/src/ats |
Date: |
Tue, 26 Feb 2013 16:07:40 +0100 |
Author: wachs
Date: 2013-02-26 16:07:40 +0100 (Tue, 26 Feb 2013)
New Revision: 26208
Modified:
gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
gnunet/src/ats/gnunet-service-ats_addresses_mlp.h
gnunet/src/ats/perf_ats_mlp.c
Log:
performance analysis
Modified: gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_mlp.c 2013-02-26 13:31:58 UTC
(rev 26207)
+++ gnunet/src/ats/gnunet-service-ats_addresses_mlp.c 2013-02-26 15:07:40 UTC
(rev 26208)
@@ -895,15 +895,18 @@
/* last +1 caused by glpk index starting with one: [1..elements]*/
p->ci = 1;
/* row index */
- int *ia = GNUNET_malloc (p->num_elements * sizeof (int));
- p->ia = ia;
+ p->ia = GNUNET_malloc (p->num_elements * sizeof (int));
/* column index */
- int *ja = GNUNET_malloc (p->num_elements * sizeof (int));
- p->ja = ja;
+ p->ja = GNUNET_malloc (p->num_elements * sizeof (int));
/* coefficient */
- double *ar= GNUNET_malloc (p->num_elements * sizeof (double));
- p->ar = ar;
+ p->ar = GNUNET_malloc (p->num_elements * sizeof (double));
+ if ((NULL == p->ia) || (NULL == p->ja) || (NULL == p->ar))
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR, _("Problem size too large, cannot
allocate memory!\n"));
+ return GNUNET_SYSERR;
+ }
+
/* Adding invariant columns */
mlp_create_problem_add_invariant_columns (mlp, p);
@@ -930,22 +933,12 @@
mlp_solve_lp_problem (struct GAS_MLP_Handle *mlp)
{
int res = 0;
- if (GNUNET_YES == mlp->mlp_prob_changed)
- {
- /* Problem was recreated: use LP presolver */
- mlp->control_param_lp.presolve = GLP_ON;
- }
- else
- {
- /* Problem was not recreated: do not use LP presolver */
- mlp->control_param_lp.presolve = GLP_OFF;
- }
res = glp_simplex(mlp->p.prob, &mlp->control_param_lp);
if (0 == res)
LOG (GNUNET_ERROR_TYPE_DEBUG, "Solving LP problem: 0x%02X
%s\n", res, mlp_solve_to_string(res));
else
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Solving LP problem failed:
0x%02X %s\n", res, mlp_solve_to_string(res));
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Solving LP problem failed:
0x%02X %s\n", res, mlp_solve_to_string(res));
/* Analyze problem status */
res = glp_get_status (mlp->p.prob);
@@ -959,7 +952,7 @@
return GNUNET_OK;
/* Problem was ill-defined, no way to handle that */
default:
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Solving LP problem failed, no solution:
0x%02X %s\n",
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Solving LP problem failed, no solution:
0x%02X %s\n",
res, mlp_status_to_string(res));
return GNUNET_SYSERR;
}
@@ -980,7 +973,7 @@
if (0 == res)
LOG (GNUNET_ERROR_TYPE_DEBUG, "Solving MLP problem: 0x%02X
%s\n", res, mlp_solve_to_string(res));
else
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Solving MLP problem failed:
0x%02X %s\n", res, mlp_solve_to_string(res));
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Solving MLP problem failed:
0x%02X %s\n", res, mlp_solve_to_string(res));
/* Analyze problem status */
res = glp_mip_status(mlp->p.prob);
switch (res) {
@@ -992,7 +985,7 @@
return GNUNET_OK;
/* Problem was ill-defined, no way to handle that */
default:
- LOG (GNUNET_ERROR_TYPE_DEBUG,"Solving MLP problem failed, 0x%02X
%s\n\n", res, mlp_status_to_string(res));
+ LOG (GNUNET_ERROR_TYPE_WARNING,"Solving MLP problem failed, 0x%02X
%s\n\n", res, mlp_status_to_string(res));
return GNUNET_SYSERR;
}
}
@@ -1092,9 +1085,11 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "Problem size changed,
rebuilding\n");
mlp_delete_problem (mlp);
start_build = GNUNET_TIME_absolute_get();
- mlp_create_problem (mlp, addresses);
+ if (GNUNET_SYSERR == mlp_create_problem (mlp,
addresses))
+ return GNUNET_SYSERR;
duration_build = GNUNET_TIME_absolute_get_duration
(start_build);
mlp->control_param_lp.presolve = GLP_YES;
+ mlp->control_param_mlp.presolve = GNUNET_NO; /* No
presolver, we have LP solution */
}
else
{
@@ -1120,6 +1115,11 @@
mlp->ps.build_dur = duration_build;
mlp->ps.lp_dur = duration_lp;
mlp->ps.mip_dur = duration_mlp;
+ mlp->ps.lp_presolv = mlp->control_param_lp.presolve;
+ mlp->ps.mip_presolv = mlp->control_param_mlp.presolve;
+ mlp->ps.p_cols = glp_get_num_cols (mlp->p.prob);
+ mlp->ps.p_rows = glp_get_num_rows (mlp->p.prob);
+ mlp->ps.p_elements = mlp->p.num_elements;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Execution time: Build %llu ms, LP %llu
ms, MLP %llu ms\n",
(unsigned long long) duration_build.rel_value,
Modified: gnunet/src/ats/gnunet-service-ats_addresses_mlp.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_mlp.h 2013-02-26 13:31:58 UTC
(rev 26207)
+++ gnunet/src/ats/gnunet-service-ats_addresses_mlp.h 2013-02-26 15:07:40 UTC
(rev 26208)
@@ -39,8 +39,8 @@
#define MLP_AVERAGING_QUEUE_LENGTH 3
-#define MLP_MAX_EXEC_DURATION
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3)
-#define MLP_MAX_ITERATIONS 1024
+#define MLP_MAX_EXEC_DURATION
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10)
+#define MLP_MAX_ITERATIONS 4096
#define DEFAULT_D 1.0
#define DEFAULT_R 1.0
@@ -61,7 +61,17 @@
struct GNUNET_TIME_Relative mip_dur;
int lp_res;
+ int lp_presolv;
int mip_res;
+ int mip_presolv;
+
+ int p_elements;
+ int p_cols;
+ int p_rows;
+
+ int n_peers;
+ int n_addresses;
+
};
struct ATS_Peer
Modified: gnunet/src/ats/perf_ats_mlp.c
===================================================================
--- gnunet/src/ats/perf_ats_mlp.c 2013-02-26 13:31:58 UTC (rev 26207)
+++ gnunet/src/ats/perf_ats_mlp.c 2013-02-26 15:07:40 UTC (rev 26208)
@@ -126,13 +126,7 @@
ret = res;
}
-static void
-end_correctly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-}
-
-
static void
bandwidth_changed_cb (void *cls, struct ATS_Address *address)
{
@@ -237,11 +231,16 @@
{
GAS_mlp_solve_problem (mlp, addresses);
- fprintf (stderr, "Solving problem for %u peers
with each %u addresses (build/LP/MIP in ms): %llu %llu %llu\n",
+ 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",
cp + 1, ca,
+ (GNUNET_OK ==
mlp->ps.lp_res) ? "OK" : "FAIL",
+ (GNUNET_OK ==
mlp->ps.mip_res) ? "OK" : "FAIL",
(unsigned long long)
mlp->ps.build_dur.rel_value,
(unsigned long long)
mlp->ps.lp_dur.rel_value,
- (unsigned long long)
mlp->ps.mip_dur.rel_value);
+ (unsigned long long)
mlp->ps.mip_dur.rel_value,
+ (GLP_YES ==
mlp->ps.lp_presolv) ? "YES" : "NO",
+ (GNUNET_OK ==
mlp->ps.mip_presolv) ? "YES" : "NO",
+ mlp->ps.p_cols,
mlp->ps.p_rows, mlp->ps.p_elements);
}
}
@@ -287,7 +286,6 @@
if (0 != atoi(argv[c+1]))
{
N_peers_start = atoi(argv[c+1]);
- fprintf (stderr, "peers_start:
%u\n",N_peers_start );
}
}
if ((0 == strcmp (argv[c], "-w")) && (c < argc))
@@ -295,7 +293,6 @@
if (0 != atoi(argv[c+1]))
{
N_peers_end = atoi(argv[c+1]);
- fprintf (stderr, "peers_end:
%u\n",N_peers_end );
}
}
if ((0 == strcmp (argv[c], "-a")) && (c < argc))
@@ -303,7 +300,6 @@
if (0 != atoi(argv[c+1]))
{
N_address = atoi(argv[c+1]);
- fprintf (stderr, "address:
%u\n",N_address );
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26208 - gnunet/src/ats,
gnunet <=