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
cosmetics
[simgrid.git]
/
src
/
surf
/
network.c
diff --git
a/src/surf/network.c
b/src/surf/network.c
index
99d03be
..
db35208
100644
(file)
--- a/
src/surf/network.c
+++ b/
src/surf/network.c
@@
-77,6
+77,13
@@
static double constant_bandwidth_constraint(double rate, double bound,
/**********************/
/* SMPI callbacks */
/**********************/
/**********************/
/* SMPI callbacks */
/**********************/
+
+static int factor_cmp(const void *pa, const void *pb)
+{
+ return (((s_smpi_factor_t*)pa)->factor > ((s_smpi_factor_t*)pb)->factor);
+}
+
+
static xbt_dynar_t parse_factor(const char *smpi_coef_string)
{
char *value = NULL;
static xbt_dynar_t parse_factor(const char *smpi_coef_string)
{
char *value = NULL;
@@
-98,6
+105,12
@@
static xbt_dynar_t parse_factor(const char *smpi_coef_string)
xbt_dynar_free(&radical_elements2);
}
xbt_dynar_free(&radical_elements);
xbt_dynar_free(&radical_elements2);
}
xbt_dynar_free(&radical_elements);
+ iter=0;
+ xbt_dynar_sort(smpi_factor, &factor_cmp);
+ xbt_dynar_foreach(smpi_factor, iter, fact) {
+ XBT_DEBUG("ordered smpi_factor:\t%ld : %f", fact.factor, fact.value);
+
+ }
return smpi_factor;
}
return smpi_factor;
}
@@
-105,36
+118,42
@@
static double smpi_bandwidth_factor(double size)
{
if (!smpi_bw_factor)
smpi_bw_factor =
{
if (!smpi_bw_factor)
smpi_bw_factor =
- parse_factor(
xbt_cfg_get_string(_surf_cfg_set,
"smpi/bw_factor"));
+ parse_factor(
surf_cfg_get_string(
"smpi/bw_factor"));
unsigned int iter = 0;
s_smpi_factor_t fact;
unsigned int iter = 0;
s_smpi_factor_t fact;
+ double current=1.0;
xbt_dynar_foreach(smpi_bw_factor, iter, fact) {
xbt_dynar_foreach(smpi_bw_factor, iter, fact) {
- if (size >= fact.factor) {
- XBT_DEBUG("%lf >= %ld return %f", size, fact.factor, fact.value);
- return fact.value;
- }
+ if (size <= fact.factor) {
+ XBT_DEBUG("%lf <= %ld return %f", size, fact.factor, current);
+ return current;
+ }else
+ current=fact.value;
}
}
+ XBT_DEBUG("%lf > %ld return %f", size, fact.factor, current);
- return
1.0
;
+ return
current
;
}
static double smpi_latency_factor(double size)
{
if (!smpi_lat_factor)
smpi_lat_factor =
}
static double smpi_latency_factor(double size)
{
if (!smpi_lat_factor)
smpi_lat_factor =
- parse_factor(
xbt_cfg_get_string(_surf_cfg_set,
"smpi/lat_factor"));
+ parse_factor(
surf_cfg_get_string(
"smpi/lat_factor"));
unsigned int iter = 0;
s_smpi_factor_t fact;
unsigned int iter = 0;
s_smpi_factor_t fact;
+ double current=1.0;
xbt_dynar_foreach(smpi_lat_factor, iter, fact) {
xbt_dynar_foreach(smpi_lat_factor, iter, fact) {
- if (size >= fact.factor) {
- XBT_DEBUG("%lf >= %ld return %f", size, fact.factor, fact.value);
- return fact.value;
- }
+ if (size <= fact.factor) {
+ XBT_DEBUG("%lf <= %ld return %f", size, fact.factor, current);
+ return current;
+ }else
+ current=fact.value;
}
}
+ XBT_DEBUG("%lf > %ld return %f", size, fact.factor, current);
- return
1.0
;
+ return
current
;
}
/**--------- <copy/paste C code snippet in surf/network.c> -----------*/
}
/**--------- <copy/paste C code snippet in surf/network.c> -----------*/
@@
-656,8
+675,8
@@
static void smpi_gap_append(double size, const link_CM02_t link,
{
const char *src = link->lmm_resource.generic_resource.name;
xbt_fifo_t fifo;
{
const char *src = link->lmm_resource.generic_resource.name;
xbt_fifo_t fifo;
- surf_action_network_CM02_t last_action;
- double bw;
+
//
surf_action_network_CM02_t last_action;
+
//
double bw;
if (sg_sender_gap > 0.0) {
if (!gap_lookup) {
if (sg_sender_gap > 0.0) {
if (!gap_lookup) {
@@
-667,17
+686,16
@@
static void smpi_gap_append(double size, const link_CM02_t link,
action->sender.gap = 0.0;
if (fifo && xbt_fifo_size(fifo) > 0) {
/* Compute gap from last send */
action->sender.gap = 0.0;
if (fifo && xbt_fifo_size(fifo) > 0) {
/* Compute gap from last send */
- last_action =
+
/*
last_action =
(surf_action_network_CM02_t)
(surf_action_network_CM02_t)
- xbt_fifo_get_item_content(xbt_fifo_get_last_item(fifo));
- bw = net_get_link_bandwidth(link);
- action->sender.gap =
- last_action->sender.gap + max(sg_sender_gap,
- last_action->sender.size / bw);
+ xbt_fifo_get_item_content(xbt_fifo_get_last_item(fifo));*/
+ // bw = net_get_link_bandwidth(link);
+ action->sender.gap = sg_sender_gap;
+ /* max(sg_sender_gap,last_action->sender.size / bw);*/
action->latency += action->sender.gap;
}
/* Append action as last send */
action->latency += action->sender.gap;
}
/* Append action as last send */
- action->sender.link_name = link->lmm_resource.generic_resource.name;
+
/*
action->sender.link_name = link->lmm_resource.generic_resource.name;
fifo =
(xbt_fifo_t) xbt_dict_get_or_null(gap_lookup,
action->sender.link_name);
fifo =
(xbt_fifo_t) xbt_dict_get_or_null(gap_lookup,
action->sender.link_name);
@@
-685,7
+703,7
@@
static void smpi_gap_append(double size, const link_CM02_t link,
fifo = xbt_fifo_new();
xbt_dict_set(gap_lookup, action->sender.link_name, fifo, NULL);
}
fifo = xbt_fifo_new();
xbt_dict_set(gap_lookup, action->sender.link_name, fifo, NULL);
}
- action->sender.fifo_item = xbt_fifo_push(fifo, action);
+ action->sender.fifo_item = xbt_fifo_push(fifo, action);
*/
action->sender.size = size;
}
}
action->sender.size = size;
}
}