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
Remove one of the many pimple: HostModel::p_cpuModel
[simgrid.git]
/
src
/
surf
/
host_clm03.cpp
diff --git
a/src/surf/host_clm03.cpp
b/src/surf/host_clm03.cpp
index
5c1a5d6
..
bfe88b0
100644
(file)
--- a/
src/surf/host_clm03.cpp
+++ b/
src/surf/host_clm03.cpp
@@
-26,9
+26,8
@@
void surf_host_model_init_current_default(void)
xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "yes");
surf_cpu_model_init_Cas01();
surf_network_model_init_LegrandVelho();
xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "yes");
surf_cpu_model_init_Cas01();
surf_network_model_init_LegrandVelho();
- surf_host_model->p_cpuModel = surf_cpu_model_pm;
- Model
Ptr
model = surf_host_model;
+ Model
*
model = surf_host_model;
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(host_parse_init);
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(host_parse_init);
@@
-41,7
+40,7
@@
void surf_host_model_init_compound()
xbt_assert(surf_network_model, "No network model defined yet!");
surf_host_model = new HostCLM03Model();
xbt_assert(surf_network_model, "No network model defined yet!");
surf_host_model = new HostCLM03Model();
- Model
Ptr
model = surf_host_model;
+ Model
*
model = surf_host_model;
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(host_parse_init);
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(host_parse_init);
@@
-55,11
+54,12
@@
HostCLM03Model::HostCLM03Model()
HostCLM03Model::~HostCLM03Model()
{}
HostCLM03Model::~HostCLM03Model()
{}
-HostPtr HostCLM03Model::createHost(const char *name){
- HostPtr host = new HostCLM03(surf_host_model, name, NULL,
+Host *HostCLM03Model::createHost(const char *name){
+ sg_host_t sg_host = sg_host_by_name(name);
+ Host *host = new HostCLM03(surf_host_model, name, NULL,
(xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL),
(xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL),
-
(RoutingEdgePtr)xbt_lib_get_or_null(host_lib, name, ROUTING_HOST_LEVEL
),
- s
tatic_cast<CpuPtr>(xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL)
));
+
sg_host_edge(sg_host
),
+ s
g_host_surfcpu(sg_host
));
XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage));
xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, host);
return host;
XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage));
xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, host);
return host;
@@
-68,11
+68,9
@@
HostPtr HostCLM03Model::createHost(const char *name){
double HostCLM03Model::shareResources(double now){
adjustWeightOfDummyCpuActions();
double HostCLM03Model::shareResources(double now){
adjustWeightOfDummyCpuActions();
- double min_by_cpu =
p_cpuModel
->shareResources(now);
+ double min_by_cpu =
surf_cpu_model_pm
->shareResources(now);
double min_by_net = (strcmp(surf_network_model->getName(), "network NS3")) ? surf_network_model->shareResources(now) : -1;
double min_by_net = (strcmp(surf_network_model->getName(), "network NS3")) ? surf_network_model->shareResources(now) : -1;
- double min_by_sto = -1;
- if (p_cpuModel == surf_cpu_model_pm)
- min_by_sto = surf_storage_model->shareResources(now);
+ double min_by_sto = surf_storage_model->shareResources(now);
XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f",
this, surf_cpu_model_pm->getName(), min_by_cpu,
XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f",
this, surf_cpu_model_pm->getName(), min_by_cpu,
@@
-93,20
+91,20
@@
void HostCLM03Model::updateActionsState(double /*now*/, double /*delta*/){
return;
}
return;
}
-Action
Ptr
HostCLM03Model::executeParallelTask(int host_nb,
+Action
*
HostCLM03Model::executeParallelTask(int host_nb,
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate){
#define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate){
#define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
- Action
Ptr
action =NULL;
+ Action
*
action =NULL;
if ((host_nb == 1)
&& (cost_or_zero(bytes_amount, 0) == 0.0)){
if ((host_nb == 1)
&& (cost_or_zero(bytes_amount, 0) == 0.0)){
- action =
((HostCLM03Ptr)
host_list[0])->execute(flops_amount[0]);
+ action =
static_cast<HostCLM03*>(
host_list[0])->execute(flops_amount[0]);
} else if ((host_nb == 1)
&& (cost_or_zero(flops_amount, 0) == 0.0)) {
} else if ((host_nb == 1)
&& (cost_or_zero(flops_amount, 0) == 0.0)) {
- action = communicate(
(HostCLM03Ptr)host_list[0]
,
-
(HostCLM03Ptr)host_list[0]
,bytes_amount[0], rate);
+ action = communicate(
static_cast<HostCLM03*>(host_list[0])
,
+
static_cast<HostCLM03*>(host_list[0])
,bytes_amount[0], rate);
} else if ((host_nb == 2)
&& (cost_or_zero(flops_amount, 0) == 0.0)
&& (cost_or_zero(flops_amount, 1) == 0.0)) {
} else if ((host_nb == 2)
&& (cost_or_zero(flops_amount, 0) == 0.0)
&& (cost_or_zero(flops_amount, 1) == 0.0)) {
@@
-120,17
+118,17
@@
ActionPtr HostCLM03Model::executeParallelTask(int host_nb,
}
}
if (nb == 1){
}
}
if (nb == 1){
- action = communicate(
(HostCLM03Ptr)host_list[0]
,
-
(HostCLM03Ptr)host_list[1]
,value, rate);
+ action = communicate(
static_cast<HostCLM03*>(host_list[0])
,
+
static_cast<HostCLM03*>(host_list[1])
,value, rate);
}
} else
THROW_UNIMPLEMENTED; /* This model does not implement parallel tasks */
#undef cost_or_zero
}
} else
THROW_UNIMPLEMENTED; /* This model does not implement parallel tasks */
#undef cost_or_zero
- xbt_free(
(HostCLM03Ptr)
host_list);
+ xbt_free(host_list);
return action;
}
return action;
}
-Action
Ptr HostCLM03Model::communicate(HostPtr src, HostPtr
dst, double size, double rate){
+Action
*HostCLM03Model::communicate(Host *src, Host *
dst, double size, double rate){
return surf_network_model->communicate(src->p_netElm, dst->p_netElm, size, rate);
}
return surf_network_model->communicate(src->p_netElm, dst->p_netElm, size, rate);
}
@@
-139,7
+137,7
@@
ActionPtr HostCLM03Model::communicate(HostPtr src, HostPtr dst, double size, dou
/************
* Resource *
************/
/************
* Resource *
************/
-HostCLM03::HostCLM03(HostModel
Ptr model, const char* name, xbt_dict_t properties, xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr
cpu)
+HostCLM03::HostCLM03(HostModel
*model, const char* name, xbt_dict_t properties, xbt_dynar_t storage, RoutingEdge *netElm, Cpu *
cpu)
: Host(model, name, properties, storage, netElm, cpu) {}
bool HostCLM03::isUsed(){
: Host(model, name, properties, storage, netElm, cpu) {}
bool HostCLM03::isUsed(){
@@
-151,11
+149,11
@@
void HostCLM03::updateState(tmgr_trace_event_t /*event_type*/, double /*value*/,
THROW_IMPOSSIBLE; /* This model does not implement parallel tasks */
}
THROW_IMPOSSIBLE; /* This model does not implement parallel tasks */
}
-Action
Ptr
HostCLM03::execute(double size) {
+Action
*
HostCLM03::execute(double size) {
return p_cpu->execute(size);
}
return p_cpu->execute(size);
}
-Action
Ptr
HostCLM03::sleep(double duration) {
+Action
*
HostCLM03::sleep(double duration) {
return p_cpu->sleep(duration);
}
return p_cpu->sleep(duration);
}