static int name_compare_hosts(const void *n1, const void *n2)
{
char name1[80], name2[80];
- strcpy(name1, SD_workstation_get_name(*((SD_workstation_t *) n1)));
- strcpy(name2, SD_workstation_get_name(*((SD_workstation_t *) n2)));
+ strcpy(name1, sg_host_get_name(*((sg_host_t *) n1)));
+ strcpy(name2, sg_host_get_name(*((sg_host_t *) n2)));
return strcmp(name1, name2);
}
/* Schedule them all on the first workstation */
XBT_INFO("------------------- Schedule tasks ---------------------------");
- const SD_workstation_t *ws_list = SD_workstation_get_list();
- int totalHosts = SD_workstation_get_count();
- qsort((void *) ws_list, totalHosts, sizeof(SD_workstation_t),
+ const sg_host_t *ws_list = sg_host_list();
+ int totalHosts = sg_host_count();
+ qsort((void *) ws_list, totalHosts, sizeof(sg_host_t),
name_compare_hosts);
- int count = SD_workstation_get_count();
+ int count = sg_host_count();
xbt_dynar_foreach(dax, cursor, task) {
if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
if (!strcmp(SD_task_get_name(task), "end"))
xbt_dynar_foreach(dax, cursor, task) {
int kind = SD_task_get_kind(task);
- SD_workstation_t *wsl = SD_task_get_workstation_list(task);
+ sg_host_t *wsl = SD_task_get_workstation_list(task);
switch (kind) {
case SD_TASK_COMP_SEQ:
fprintf(out, "[%f] %s compute %f # %s\n",
SD_task_get_start_time(task),
- SD_workstation_get_name(wsl[0]), SD_task_get_amount(task),
+ sg_host_get_name(wsl[0]), SD_task_get_amount(task),
SD_task_get_name(task));
break;
case SD_TASK_COMM_E2E:
fprintf(out, "[%f] %s send %s %f # %s\n",
SD_task_get_start_time(task),
- SD_workstation_get_name(wsl[0]),
- SD_workstation_get_name(wsl[1]), SD_task_get_amount(task),
+ sg_host_get_name(wsl[0]),
+ sg_host_get_name(wsl[1]), SD_task_get_amount(task),
SD_task_get_name(task));
fprintf(out, "[%f] %s recv %s %f # %s\n",
SD_task_get_finish_time(task),
- SD_workstation_get_name(wsl[1]),
- SD_workstation_get_name(wsl[0]), SD_task_get_amount(task),
+ sg_host_get_name(wsl[1]),
+ sg_host_get_name(wsl[0]), SD_task_get_amount(task),
SD_task_get_name(task));
break;
default:
/* Schedule them all on the first workstation */
XBT_INFO("------------------- Schedule tasks ---------------------------");
- const SD_workstation_t *ws_list = SD_workstation_get_list();
+ const sg_host_t *ws_list = sg_host_list();
- int count = SD_workstation_get_count();
+ int count = sg_host_count();
xbt_dynar_foreach(dot, cursor, task) {
if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
if (!strcmp(SD_task_get_name(task), "end"))
xbt_dynar_foreach(dot, cursor, task) {
int kind = SD_task_get_kind(task);
- SD_workstation_t *wsl = SD_task_get_workstation_list(task);
+ sg_host_t *wsl = SD_task_get_workstation_list(task);
switch (kind) {
case SD_TASK_COMP_SEQ:
fprintf(out, "[%f->%f] %s compute %f flops # %s\n",
SD_task_get_start_time(task),
SD_task_get_finish_time(task),
- SD_workstation_get_name(wsl[0]), SD_task_get_amount(task),
+ sg_host_get_name(wsl[0]), SD_task_get_amount(task),
SD_task_get_name(task));
break;
case SD_TASK_COMM_E2E:
fprintf(out, "[%f -> %f] %s -> %s transfer of %.0f bytes # %s\n",
SD_task_get_start_time(task),
SD_task_get_finish_time(task),
- SD_workstation_get_name(wsl[0]),
- SD_workstation_get_name(wsl[1]), SD_task_get_amount(task),
+ sg_host_get_name(wsl[0]),
+ sg_host_get_name(wsl[1]), SD_task_get_amount(task),
SD_task_get_name(task));
break;
default:
/* Schedule them all on all the first workstation */
XBT_INFO("------------------- Schedule tasks ---------------------------");
- const SD_workstation_t *ws_list = SD_workstation_get_list();
- int count = SD_workstation_get_count();
+ const sg_host_t *ws_list = sg_host_list();
+ int count = sg_host_count();
xbt_dynar_foreach(dot, cursor, task) {
if (SD_task_get_kind(task) == SD_TASK_COMP_PAR_AMDAHL) {
SD_task_schedulev(task, count, ws_list);
xbt_dynar_foreach(dot, cursor, task) {
int kind = SD_task_get_kind(task);
- SD_workstation_t *wsl = SD_task_get_workstation_list(task);
+ sg_host_t *wsl = SD_task_get_workstation_list(task);
switch (kind) {
case SD_TASK_COMP_SEQ:
fprintf(out, "[%f->%f] %s compute %f flops # %s\n",
SD_task_get_start_time(task),
SD_task_get_finish_time(task),
- SD_workstation_get_name(wsl[0]), SD_task_get_amount(task),
+ sg_host_get_name(wsl[0]), SD_task_get_amount(task),
SD_task_get_name(task));
break;
case SD_TASK_COMM_E2E:
fprintf(out, "[%f -> %f] %s -> %s transfer of %.0f bytes # %s\n",
SD_task_get_start_time(task),
SD_task_get_finish_time(task),
- SD_workstation_get_name(wsl[0]),
- SD_workstation_get_name(wsl[1]), SD_task_get_amount(task),
+ sg_host_get_name(wsl[0]),
+ sg_host_get_name(wsl[1]), SD_task_get_amount(task),
SD_task_get_name(task));
break;
default:
} s_bcast_task_t,*bcast_task_t;
-const SD_workstation_t* ws_list;
+const sg_host_t* ws_list;
int count = 0;
xbt_dynar_t reclaimed;
SD_create_environment("../../platforms/One_cluster_no_backbone.xml");
}
- ws_list = SD_workstation_get_list();
+ ws_list = sg_host_list();
reclaimed = xbt_dynar_new(sizeof(bcast_task_t),xbt_free_ref);
xbt_dynar_t done = NULL;
xbt_os_cputimer_start(timer);
- send_one(0,SD_workstation_get_count());
+ send_one(0,sg_host_count());
do {
if (done != NULL && !xbt_dynar_is_empty(done)) {
unsigned int cursor;
int main(int argc, char **argv)
{
unsigned int ctr;
- const SD_workstation_t *workstations;
+ const sg_host_t *workstations;
int total_nworkstations;
xbt_dict_t current_storage_list;
char *mount_name;
*/
SD_config("host/model", "default");
SD_create_environment(argv[1]);
- workstations = SD_workstation_get_list();
- total_nworkstations = SD_workstation_get_count();
+ workstations = sg_host_list();
+ total_nworkstations = sg_host_count();
for (ctr=0; ctr<total_nworkstations;ctr++){
- current_storage_list = SD_workstation_get_mounted_storage_list(workstations[ctr]);
+ current_storage_list = sg_host_get_mounted_storage_list(workstations[ctr]);
xbt_dict_foreach(current_storage_list,cursor,mount_name,storage_name)
XBT_INFO("Workstation '%s' mounts '%s'",
- SD_workstation_get_name(workstations[ctr]), mount_name);
+ sg_host_get_name(workstations[ctr]), mount_name);
xbt_dict_free(¤t_storage_list);
}
SD_exit();
{
const char *platform_file;
- const SD_workstation_t *workstations;
+ const sg_host_t *workstations;
int ws_nr;
- SD_workstation_t w1 = NULL;
- SD_workstation_t w2 = NULL;
+ sg_host_t w1 = NULL;
+ sg_host_t w2 = NULL;
const char *name1, *name2;
int i, j, k;
SD_create_environment(platform_file);
/* test the estimation functions */
- workstations = SD_workstation_get_list();
- ws_nr = SD_workstation_get_count();
+ workstations = sg_host_list();
+ ws_nr = sg_host_count();
/* Show routes between all workstation */
int route_size;
w1 = workstations[i];
w2 = workstations[j];
- name1 = SD_workstation_get_name(w1);
- name2 = SD_workstation_get_name(w2);
+ name1 = sg_host_get_name(w1);
+ name2 = sg_host_get_name(w2);
XBT_INFO("Route between %s and %s:", name1, name2);
route = SD_route_get_list(w1, w2);
route_size = SD_route_get_size(w1, w2);
int main(int argc, char **argv)
{
- SD_workstation_t w1;
- SD_workstation_t w2;
+ sg_host_t w1;
+ sg_host_t w2;
const char *name1;
const char *name2;
xbt_dict_t props;
SD_create_environment(argv[1]);
/* init of platform elements */
- w1 = SD_workstation_get_by_name("host1");
- w2 = SD_workstation_get_by_name("host2");
- name1 = SD_workstation_get_name(w1);
- name2 = SD_workstation_get_name(w2);
+ w1 = sg_host_by_name("host1");
+ w2 = sg_host_by_name("host2");
+ name1 = sg_host_get_name(w1);
+ name2 = sg_host_get_name(w2);
- /* The host properties can be retrived from all interfaces */
+ /* The host properties can be retrieved from all interfaces */
XBT_INFO("Property list for workstation %s", name1);
/* Get the property list of the workstation 1 */
- props = SD_workstation_get_properties(w1);
+ props = sg_host_get_properties(w1);
/* Trying to set a new property */
/* Try to get a property that does not exist */
- value = SD_workstation_get_property_value(w1, noexist);
+ value = sg_host_get_property_value(w1, noexist);
XBT_INFO("\tProperty: %s has value: %s", noexist, value?value:"Undefined (NULL)");
XBT_INFO("Property list for workstation %s", name2);
/* Get the property list of the workstation 2 */
- props = SD_workstation_get_properties(w2);
+ props = sg_host_get_properties(w2);
cursor = NULL;
/* Print the properties of the workstation 2 */
/* Modify an existing property test. First check it exists */
XBT_INFO("Modify an existing property");
- value = SD_workstation_get_property_value(w2, exist);
+ value = sg_host_get_property_value(w2, exist);
if (value == NULL)
XBT_INFO("\tProperty: %s is undefined", exist);
else {
}
/* Test if we have changed the value */
- value = SD_workstation_get_property_value(w2, exist);
+ value = sg_host_get_property_value(w2, exist);
XBT_INFO("\tProperty: %s new value: %s", exist, value?value:"Undefined (NULL)");
- /* Test if properties are displayed by SD_workstation_dump */
- SD_workstation_dump(w2);
+ /* Test if properties are displayed by sg_host_dump */
+ sg_host_dump(w2);
SD_exit();
return 0;
SD_task_t last_scheduled_task;
};
-static void SD_workstation_allocate_attribute(SD_workstation_t workstation)
+static void sg_host_allocate_attribute(sg_host_t workstation)
{
void *data;
data = calloc(1, sizeof(struct _WorkstationAttribute));
- SD_workstation_set_data(workstation, data);
+ sg_host_user_set(workstation, data);
}
-static void SD_workstation_free_attribute(SD_workstation_t workstation)
+static void sg_host_free_attribute(sg_host_t workstation)
{
- free(SD_workstation_get_data(workstation));
- SD_workstation_set_data(workstation, NULL);
+ free(sg_host_user(workstation));
+ sg_host_user_set(workstation, NULL);
}
-static double SD_workstation_get_available_at(SD_workstation_t workstation)
+static double sg_host_get_available_at(sg_host_t workstation)
{
WorkstationAttribute attr =
- (WorkstationAttribute) SD_workstation_get_data(workstation);
+ (WorkstationAttribute) sg_host_user(workstation);
return attr->available_at;
}
-static void SD_workstation_set_available_at(SD_workstation_t workstation,
+static void sg_host_set_available_at(sg_host_t workstation,
double time)
{
WorkstationAttribute attr =
- (WorkstationAttribute) SD_workstation_get_data(workstation);
+ (WorkstationAttribute) sg_host_user(workstation);
attr->available_at = time;
- SD_workstation_set_data(workstation, attr);
+ sg_host_user_set(workstation, attr);
}
-static SD_task_t SD_workstation_get_last_scheduled_task( SD_workstation_t workstation){
+static SD_task_t sg_host_get_last_scheduled_task( sg_host_t workstation){
WorkstationAttribute attr =
- (WorkstationAttribute) SD_workstation_get_data(workstation);
+ (WorkstationAttribute) sg_host_user(workstation);
return attr->last_scheduled_task;
}
-static void SD_workstation_set_last_scheduled_task(SD_workstation_t workstation,
+static void sg_host_set_last_scheduled_task(sg_host_t workstation,
SD_task_t task){
WorkstationAttribute attr =
- (WorkstationAttribute) SD_workstation_get_data(workstation);
+ (WorkstationAttribute) sg_host_user(workstation);
attr->last_scheduled_task=task;
- SD_workstation_set_data(workstation, attr);
+ sg_host_user_set(workstation, attr);
}
static xbt_dynar_t get_ready_tasks(xbt_dynar_t dax)
return ready_tasks;
}
-static double finish_on_at(SD_task_t task, SD_workstation_t workstation)
+static double finish_on_at(SD_task_t task, sg_host_t workstation)
{
volatile double result;
unsigned int i;
SD_task_t parent, grand_parent;
xbt_dynar_t parents, grand_parents;
- SD_workstation_t *grand_parent_workstation_list;
+ sg_host_t *grand_parent_workstation_list;
parents = SD_task_get_parents(task);
xbt_dynar_free_container(&parents);
- result = MAX(SD_workstation_get_available_at(workstation),
+ result = MAX(sg_host_get_available_at(workstation),
last_data_available) +
- SD_workstation_get_computation_time(workstation,
+ sg_host_computation_time(workstation,
SD_task_get_amount(task));
} else {
xbt_dynar_free_container(&parents);
- result = SD_workstation_get_available_at(workstation) +
- SD_workstation_get_computation_time(workstation,
+ result = sg_host_get_available_at(workstation) +
+ sg_host_computation_time(workstation,
SD_task_get_amount(task));
}
return result;
}
-static SD_workstation_t SD_task_get_best_workstation(SD_task_t task)
+static sg_host_t SD_task_get_best_workstation(SD_task_t task)
{
int i;
double EFT, min_EFT = -1.0;
- const SD_workstation_t *workstations = SD_workstation_get_list();
- int nworkstations = SD_workstation_get_count();
- SD_workstation_t best_workstation;
+ const sg_host_t *workstations = sg_host_list();
+ int nworkstations = sg_host_count();
+ sg_host_t best_workstation;
best_workstation = workstations[0];
min_EFT = finish_on_at(task, workstations[0]);
EFT = finish_on_at(task, workstations[i]);
XBT_DEBUG("%s finishes on %s at %f",
SD_task_get_name(task),
- SD_workstation_get_name(workstations[i]), EFT);
+ sg_host_get_name(workstations[i]), EFT);
if (EFT < min_EFT) {
min_EFT = EFT;
{
unsigned int i, j, k;
int current_nworkstations;
- const int nworkstations = SD_workstation_get_count();
- const SD_workstation_t *workstations = SD_workstation_get_list();
+ const int nworkstations = sg_host_count();
+ const sg_host_t *workstations = sg_host_list();
SD_task_t task;
- SD_workstation_t *list;
+ sg_host_t *list;
fprintf(out, "<?xml version=\"1.0\"?>\n");
fprintf(out, "<grid_schedule>\n");
list = SD_task_get_workstation_list(task);
for (j = 0; j < current_nworkstations; j++) {
for (k = 0; k < nworkstations; k++) {
- if (!strcmp(SD_workstation_get_name(workstations[k]),
- SD_workstation_get_name(list[j]))) {
+ if (!strcmp(sg_host_get_name(workstations[k]),
+ sg_host_get_name(list[j]))) {
fprintf(out, " <hosts start=\"%u\" nb=\"1\"/>\n",
k);
fprintf(out,
double finish_time, min_finish_time = -1.0;
SD_task_t task, selected_task = NULL, last_scheduled_task;
xbt_dynar_t ready_tasks;
- SD_workstation_t workstation, selected_workstation = NULL;
+ sg_host_t workstation, selected_workstation = NULL;
int total_nworkstations = 0;
- const SD_workstation_t *workstations = NULL;
+ const sg_host_t *workstations = NULL;
xbt_dynar_t dax;
FILE *out = NULL;
SD_create_environment(argv[1]);
/* Allocating the workstation attribute */
- total_nworkstations = SD_workstation_get_count();
- workstations = SD_workstation_get_list();
+ total_nworkstations = sg_host_count();
+ workstations = sg_host_list();
for (cursor = 0; cursor < total_nworkstations; cursor++)
- SD_workstation_allocate_attribute(workstations[cursor]);
+ sg_host_allocate_attribute(workstations[cursor]);
/* load the DAX file */
}
XBT_INFO("Schedule %s on %s", SD_task_get_name(selected_task),
- SD_workstation_get_name(selected_workstation));
+ sg_host_get_name(selected_workstation));
SD_task_schedulel(selected_task, 1, selected_workstation);
*/
last_scheduled_task =
- SD_workstation_get_last_scheduled_task(selected_workstation);
+ sg_host_get_last_scheduled_task(selected_workstation);
if (last_scheduled_task &&
(SD_task_get_state(last_scheduled_task) != SD_DONE) &&
(SD_task_get_state(last_scheduled_task) != SD_FAILED) &&
!SD_task_dependency_exists(
- SD_workstation_get_last_scheduled_task(selected_workstation),
+ sg_host_get_last_scheduled_task(selected_workstation),
selected_task))
SD_task_dependency_add("resource", NULL,
last_scheduled_task, selected_task);
- SD_workstation_set_last_scheduled_task(selected_workstation, selected_task);
+ sg_host_set_last_scheduled_task(selected_workstation, selected_task);
- SD_workstation_set_available_at(selected_workstation, min_finish_time);
+ sg_host_set_available_at(selected_workstation, min_finish_time);
xbt_dynar_free_container(&ready_tasks);
/* reset the min_finish_time for the next set of ready tasks */
xbt_dynar_free_container(&dax);
for (cursor = 0; cursor < total_nworkstations; cursor++)
- SD_workstation_free_attribute(workstations[cursor]);
+ sg_host_free_attribute(workstations[cursor]);
/* exit */
SD_exit();
int main(int argc, char **argv)
{
unsigned int ctr;
- const SD_workstation_t *workstations;
+ const sg_host_t *workstations;
SD_task_t t1, c1, t2, c2, t3, c3, t4, task;
xbt_dynar_t changed_tasks;
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- workstations = SD_workstation_get_list();
+ workstations = sg_host_list();
t1 = SD_task_create_comp_seq("t1", NULL, 25000000);
c1 = SD_task_create_comm_e2e("c1", NULL, 125000000);
SD_route_get_bandwidth(workstations[0], workstations[1]),
SD_route_get_latency(workstations[0], workstations[1]));
XBT_INFO("Jupiter: speed=%.0f",
- SD_workstation_get_speed(workstations[0])*
- SD_workstation_get_available_speed(workstations[0]));
+ sg_host_speed(workstations[0])*
+ sg_host_get_available_speed(workstations[0]));
XBT_INFO("Tremblay: speed=%.0f",
- SD_workstation_get_speed(workstations[1])*
- SD_workstation_get_available_speed(workstations[1]));
+ sg_host_speed(workstations[1])*
+ sg_host_get_available_speed(workstations[1]));
xbt_dynar_foreach(changed_tasks, ctr, task) {
XBT_INFO("Task '%s' start time: %f, finish time: %f",
SD_task_get_name(task),
{
unsigned int ctr;
const char *platform_file;
- const SD_workstation_t *workstations;
+ const sg_host_t *workstations;
SD_task_t task, taskA, taskB, taskC, taskD, taskE;
xbt_dynar_t changed_tasks;
platform_file = argv[1];
SD_create_environment(platform_file);
- workstations = SD_workstation_get_list();
+ workstations = sg_host_list();
/* creation of some typed tasks and their dependencies */
/* chain of five tasks, three compute tasks with two data transfers */
SD_task_t task;
double computation_amount[1];
double communication_amount[2] = { 0 };
- SD_workstation_t workstation_list[1];
+ sg_host_t workstation_list[1];
/* initialization of SD */
SD_init(&argc, argv);
XBT_INFO("Schedule task '%s' on workstation 'Faulty Host'",
SD_task_get_name(task));
- SD_task_schedulel(task, 1, SD_workstation_get_by_name("Faulty Host"));
+ SD_task_schedulel(task, 1, sg_host_by_name("Faulty Host"));
SD_simulate(-1.0);
XBT_INFO("let's unschedule task '%s' and reschedule it on the 'Safe Host'",
SD_task_get_name(task));
SD_task_unschedule(task);
- SD_task_schedulel(task, 1, SD_workstation_get_by_name("Safe Host"));
+ SD_task_schedulel(task, 1, sg_host_by_name("Safe Host"));
XBT_INFO("Run the simulation again");
SD_simulate(-1.0);
XBT_INFO("Schedule task '%s' on workstation 'Faulty Host'",
SD_task_get_name(task));
- workstation_list[0] = SD_workstation_get_by_name("Faulty Host");
+ workstation_list[0] = sg_host_by_name("Faulty Host");
SD_task_schedule(task, 1, workstation_list,
computation_amount, communication_amount,-1);
SD_task_get_name(task));
SD_task_unschedule(task);
- workstation_list[0] = SD_workstation_get_by_name("Safe Host");
+ workstation_list[0] = sg_host_by_name("Safe Host");
SD_task_schedule(task, 1, workstation_list,
computation_amount, communication_amount,-1);
int i;
unsigned int ctr;
const char *platform_file;
- const SD_workstation_t *workstations;
+ const sg_host_t *workstations;
const char *name1;
const char *name2;
double computation_amount1;
xbt_dynar_t changed_tasks;
xbt_ex_t ex;
const int workstation_number = 2;
- SD_workstation_t workstation_list[2];
+ sg_host_t workstation_list[2];
double computation_amount[2];
double communication_amount[4] = { 0 };
double rate = -1.0;
- SD_workstation_t w1, w2;
+ sg_host_t w1, w2;
/* initialization of SD */
SD_init(&argc, argv);
SD_create_environment(platform_file);
/* test the estimation functions */
- workstations = SD_workstation_get_list();
+ workstations = sg_host_list();
w1 = workstations[0];
w2 = workstations[1];
- name1 = SD_workstation_get_name(w1);
- name2 = SD_workstation_get_name(w2);
+ name1 = sg_host_get_name(w1);
+ name2 = sg_host_get_name(w2);
computation_amount1 = 2000000;
computation_amount2 = 1000000;
communication_amount12 = 2000000;
communication_amount21 = 3000000;
XBT_INFO("Computation time for %f flops on %s: %f", computation_amount1,
- name1, SD_workstation_get_computation_time(w1,
+ name1, sg_host_computation_time(w1,
computation_amount1));
XBT_INFO("Computation time for %f flops on %s: %f", computation_amount2,
- name2, SD_workstation_get_computation_time(w2,
+ name2, sg_host_computation_time(w2,
computation_amount2));
XBT_INFO("Route between %s and %s:", name1, name2);
static int nameCompareHosts(const void *n1, const void *n2)
{
- return strcmp(SD_workstation_get_name(*((SD_workstation_t *) n1)),
- SD_workstation_get_name(*((SD_workstation_t *) n2)));
+ return strcmp(sg_host_get_name(*((sg_host_t *) n1)),
+ sg_host_get_name(*((sg_host_t *) n2)));
}
int main(int argc, char **argv)
{
int i, j;
int n_hosts;
- const SD_workstation_t *hosts;
+ const sg_host_t *hosts;
SD_task_t taskInit;
SD_task_t PtoPComm1;
SD_task_t PtoPComm2;
SD_task_t InterRedist;
SD_task_t taskFinal;
SD_task_t ParComp_wcomm2;
- SD_workstation_t PtoPcomm1_hosts[2];
- SD_workstation_t PtoPcomm2_hosts[2];
+ sg_host_t PtoPcomm1_hosts[2];
+ sg_host_t PtoPcomm2_hosts[2];
double PtoPcomm1_table[] = { 0, 12500000, 0, 0 }; /* 100Mb */
double PtoPcomm2_table[] = { 0, 1250000, 0, 0 }; /* 10Mb */
double ParComp_wocomm_cost[] = { 1e+9, 1e+9, 1e+9, 1e+9, 1e+9 }; /* 1 Gflop per Proc */
double *ParComp_wocomm_table;
- SD_workstation_t ParComp_wocomm_hosts[5];
+ sg_host_t ParComp_wocomm_hosts[5];
double *IntraRedist_cost;
double *IntraRedist_table;
- SD_workstation_t IntraRedist_hosts[5];
+ sg_host_t IntraRedist_hosts[5];
double ParComp_wcomm1_cost[] = { 1e+9, 1e+9, 1e+9, 1e+9, 1e+9 }; /* 1 Gflop per Proc */
double *ParComp_wcomm1_table;
- SD_workstation_t ParComp_wcomm1_hosts[5];
+ sg_host_t ParComp_wcomm1_hosts[5];
double *InterRedist_cost;
double *InterRedist_table;
double ParComp_wcomm2_cost[] = { 1e+8, 1e+8, 1e+8, 1e+8, 1e+8 }; /* 1 Gflop per Proc (0.02sec duration) */
- SD_workstation_t ParComp_wcomm2_hosts[5];
+ sg_host_t ParComp_wcomm2_hosts[5];
double final_cost = 5e+9;
double *ParComp_wcomm2_table;
SD_create_environment(argv[1]);
/* getting platform infos */
- n_hosts = SD_workstation_get_count();
- hosts = SD_workstation_get_list();
+ n_hosts = sg_host_count();
+ hosts = sg_host_list();
/* sorting hosts by hostname */
- qsort((void *) hosts, n_hosts, sizeof(SD_workstation_t),
+ qsort((void *) hosts, n_hosts, sizeof(sg_host_t),
nameCompareHosts);
/* creation of the tasks */
int i;
unsigned int ctr;
const char *platform_file;
- const SD_workstation_t *workstations;
+ const sg_host_t *workstations;
SD_task_t task, seq_comp1, e2e_comm, seq_comp2;
SD_task_t par_comp1, redist, par_comp2, par_comp3;
xbt_dynar_t changed_tasks;
double computation_amount[4];
double communication_amount[16] = { 0 };
- SD_workstation_t workstation_list[4];
+ sg_host_t workstation_list[4];
/* initialization of SD */
SD_init(&argc, argv);
platform_file = argv[1];
SD_create_environment(platform_file);
- workstations = SD_workstation_get_list();
+ workstations = sg_host_list();
/* creation of some typed tasks and their dependencies */
seq_comp1 = SD_task_create_comp_seq("Seq. comp. 1", NULL, 1e9);
msg_host_priv_t sg_host_msg(sg_host_t host);
XBT_PUBLIC(void) sg_host_msg_set(sg_host_t host, msg_host_priv_t priv);
-// ========== SD Layer ==============
-typedef struct SD_workstation *SD_workstation_priv_t;
-SD_workstation_priv_t sg_host_sd(sg_host_t host);
-XBT_PUBLIC(void) sg_host_sd_set(sg_host_t host, SD_workstation_priv_t priv);
-XBT_PUBLIC(void) sg_host_sd_destroy(sg_host_t host);
-
// ========== Simix layer =============
typedef struct s_smx_host_priv *smx_host_priv_t;
XBT_PUBLIC(smx_host_priv_t) sg_host_simix(sg_host_t host);
#include "simgrid/link.h"
SG_BEGIN_DECL()
-/** @brief Workstation datatype
- @ingroup SD_datatypes_management
-
- A workstation is a place where a task can be executed.
- A workstation is represented as a <em>physical
- resource with computing capabilities</em> and has a <em>name</em>.
-
- @see SD_workstation_management */
-typedef sg_host_t SD_workstation_t;
/** @brief Link datatype
@ingroup SD_datatypes_management
/************************** Workstation handling ****************************/
-/** @defgroup SD_workstation_management Workstations
+/** @defgroup sg_host_management Workstations
* @brief Functions for managing the workstations
*
* This section describes the functions for managing the workstations.
*
* The workstations are created when you call the function SD_create_environment.
*
- * @see SD_workstation_t
+ * @see sg_host_t
* @{
*/
-XBT_PUBLIC(SD_workstation_t) SD_workstation_get_by_name(const char *name);
-XBT_PUBLIC(const SD_workstation_t *) SD_workstation_get_list(void);
-XBT_PUBLIC(int) SD_workstation_get_count(void);
-XBT_PUBLIC(void) SD_workstation_set_data(SD_workstation_t workstation,
- void *data);
-XBT_PUBLIC(void *) SD_workstation_get_data(SD_workstation_t workstation);
-XBT_PUBLIC(const char *) SD_workstation_get_name(SD_workstation_t
- workstation);
-/*property handling functions*/
-XBT_PUBLIC(xbt_dict_t) SD_workstation_get_properties(SD_workstation_t
- workstation);
-XBT_PUBLIC(const char *) SD_workstation_get_property_value(SD_workstation_t
- workstation,
- const char
- *name);
-XBT_PUBLIC(void) SD_workstation_dump(SD_workstation_t ws);
-XBT_PUBLIC(const SD_link_t *) SD_route_get_list(SD_workstation_t src,
- SD_workstation_t dst);
-XBT_PUBLIC(int) SD_route_get_size(SD_workstation_t src,
- SD_workstation_t dst);
-XBT_PUBLIC(double) SD_workstation_get_speed(SD_workstation_t workstation);
-XBT_PUBLIC(double) SD_workstation_get_available_speed(SD_workstation_t
- workstation);
-XBT_PUBLIC(int) SD_workstation_get_cores(SD_workstation_t workstation);
-
-XBT_PUBLIC(double) SD_workstation_get_computation_time(SD_workstation_t workstation,
- double flops_amount);
-XBT_PUBLIC(double) SD_route_get_latency(SD_workstation_t src,
- SD_workstation_t dst);
-XBT_PUBLIC(double) SD_route_get_bandwidth(SD_workstation_t src,
- SD_workstation_t dst);
-XBT_PUBLIC(double) SD_route_get_communication_time(SD_workstation_t src,
- SD_workstation_t dst,
- double bytes_amount);
+XBT_PUBLIC(const sg_host_t *) sg_host_list(void);
+XBT_PUBLIC(void) sg_host_dump(sg_host_t ws);
+XBT_PUBLIC(double) sg_host_speed(sg_host_t workstation);
+XBT_PUBLIC(int) sg_host_core_count(sg_host_t workstation);
+XBT_PUBLIC(double) sg_host_computation_time(sg_host_t workstation,
+ double flops_amount);
XBT_PUBLIC(xbt_dict_t)
- SD_workstation_get_mounted_storage_list(SD_workstation_t workstation);
+ sg_host_get_mounted_storage_list(sg_host_t workstation);
XBT_PUBLIC(xbt_dynar_t)
- SD_workstation_get_attached_storage_list(SD_workstation_t workstation);
+ sg_host_get_attached_storage_list(sg_host_t workstation);
+
+XBT_PUBLIC(const SD_link_t *) SD_route_get_list(sg_host_t src,
+ sg_host_t dst);
+XBT_PUBLIC(int) SD_route_get_size(sg_host_t src,
+ sg_host_t dst);
+
+XBT_PUBLIC(double) SD_route_get_latency(sg_host_t src,
+ sg_host_t dst);
+XBT_PUBLIC(double) SD_route_get_bandwidth(sg_host_t src,
+ sg_host_t dst);
+XBT_PUBLIC(double) SD_route_get_communication_time(sg_host_t src,
+ sg_host_t dst,
+ double bytes_amount);
+
XBT_PUBLIC(const char*) SD_storage_get_host(SD_storage_t storage);
/** @} */
XBT_PUBLIC(double) SD_task_get_remaining_amount(SD_task_t task);
XBT_PUBLIC(double) SD_task_get_execution_time(SD_task_t task,
int workstation_nb,
- const SD_workstation_t *
+ const sg_host_t *
workstation_list,
const double *flops_amount,
const double *bytes_amount);
XBT_PUBLIC(e_SD_task_kind_t) SD_task_get_kind(SD_task_t task);
XBT_PUBLIC(void) SD_task_schedule(SD_task_t task, int workstation_nb,
- const SD_workstation_t *
+ const sg_host_t *
workstation_list,
const double *flops_amount,
const double *bytes_amount,
XBT_PUBLIC(xbt_dynar_t) SD_task_get_parents(SD_task_t task);
XBT_PUBLIC(xbt_dynar_t) SD_task_get_children(SD_task_t task);
XBT_PUBLIC(int) SD_task_get_workstation_count(SD_task_t task);
-XBT_PUBLIC(SD_workstation_t *) SD_task_get_workstation_list(SD_task_t
+XBT_PUBLIC(sg_host_t *) SD_task_get_workstation_list(SD_task_t
task);
XBT_PUBLIC(void) SD_task_destroy(SD_task_t task);
XBT_PUBLIC(void) SD_task_dump(SD_task_t task);
XBT_PUBLIC(void) SD_task_distribute_comp_amdahl(SD_task_t task, int ws_count);
XBT_PUBLIC(void) SD_task_schedulev(SD_task_t task, int count,
- const SD_workstation_t * list);
+ const sg_host_t * list);
XBT_PUBLIC(void) SD_task_schedulel(SD_task_t task, int count, ...);
xbt_dynar_t computer = NULL;
xbt_dict_cursor_t dict_cursor;
char *computer_name;
- const SD_workstation_t *workstations = SD_workstation_get_list ();
+ const sg_host_t *workstations = sg_host_list ();
xbt_dict_foreach(computers,dict_cursor,computer_name,computer){
int count_computer = atoi(computer_name);
unsigned int count=0;
xbt_assert(sd_global == NULL, "SD_init() already called");
sd_global = xbt_new(s_SD_global_t, 1);
- sd_global->workstation_list = NULL;
+ sd_global->host_list = NULL;
sd_global->link_list = NULL;
sd_global->recyclable_route = NULL;
sd_global->watch_point_reached = 0;
/**
* \brief Creates the environment
*
- * The environment (i.e. the \ref SD_workstation_management "workstations"
+ * The environment (i.e. the \ref sg_host_management "hosts"
* and the \ref SD_link_management "links") is created with the data stored
* in the given XML platform file.
*
* \param platform_file name of an XML file describing the environment to create
- * \see SD_workstation_management, SD_link_management
+ * \see sg_host_management, SD_link_management
*
* The XML file follows this DTD:
*
xbt_mallocator_free(sd_global->task_mallocator);
XBT_DEBUG("Destroying workstation and link arrays...");
- xbt_free(sd_global->workstation_list);
+ xbt_free(sd_global->host_list);
xbt_free(sd_global->link_list);
xbt_free(sd_global->recyclable_route);
task->is_not_ready = 0;
/* scheduling parameters */
- task->workstation_nb = 0;
- task->workstation_list = NULL;
+ task->host_count = 0;
+ task->host_list = NULL;
task->flops_amount = NULL;
task->bytes_amount = NULL;
task->rate = -1;
SD_task_t task = SD_task_create(name, data, amount);
task->bytes_amount = xbt_new0(double, ws_count * ws_count);
task->flops_amount = xbt_new0(double, ws_count);
- task->workstation_nb = ws_count;
- task->workstation_list = xbt_new0(SD_workstation_t, ws_count);
+ task->host_count = ws_count;
+ task->host_list = xbt_new0(sg_host_t, ws_count);
return task;
}
double amount)
{
SD_task_t res = SD_task_create(name, data, amount);
- res->workstation_list=NULL;
+ res->host_list=NULL;
res->kind = SD_TASK_COMM_PAR_MXN_1D_BLOCK;
return res;
if (task->surf_action != NULL)
task->surf_action->unref();
- xbt_free(task->workstation_list);
+ xbt_free(task->host_list);
xbt_free(task->bytes_amount);
xbt_free(task->flops_amount);
*/
int SD_task_get_workstation_count(SD_task_t task)
{
- return task->workstation_nb;
+ return task->host_count;
}
/**
* Only call this on already scheduled tasks!
* \param task a task
*/
-SD_workstation_t *SD_task_get_workstation_list(SD_task_t task)
+sg_host_t *SD_task_get_workstation_list(SD_task_t task)
{
- return task->workstation_list;
+ return task->host_list;
}
/**
*/
double SD_task_get_execution_time(SD_task_t task,
int workstation_nb,
- const SD_workstation_t *
+ const sg_host_t *
workstation_list,
const double *flops_amount,
const double *bytes_amount)
time = 0.0;
if (flops_amount != NULL)
time =
- SD_workstation_get_computation_time(workstation_list[i],
+ sg_host_computation_time(workstation_list[i],
flops_amount[i]);
if (bytes_amount != NULL)
* \see SD_task_unschedule()
*/
void SD_task_schedule(SD_task_t task, int workstation_count,
- const SD_workstation_t * workstation_list,
+ const sg_host_t * workstation_list,
const double *flops_amount,
const double *bytes_amount, double rate)
{
xbt_assert(workstation_count > 0, "workstation_nb must be positive");
- task->workstation_nb = workstation_count;
+ task->host_count = workstation_count;
task->rate = rate;
if (flops_amount) {
task->bytes_amount = NULL;
}
- task->workstation_list = (SD_workstation_t*)
- xbt_realloc(task->workstation_list,
- sizeof(SD_workstation_t) * workstation_count);
- memcpy(task->workstation_list, workstation_list,
- sizeof(SD_workstation_t) * workstation_count);
+ task->host_list = (sg_host_t*)
+ xbt_realloc(task->host_list,
+ sizeof(sg_host_t) * workstation_count);
+ memcpy(task->host_list, workstation_list,
+ sizeof(sg_host_t) * workstation_count);
SD_task_do_schedule(task);
}
&& ((task->kind == SD_TASK_COMP_PAR_AMDAHL) ||
(task->kind == SD_TASK_COMM_PAR_MXN_1D_BLOCK))) { /* Don't free scheduling data for typed tasks */
__SD_task_destroy_scheduling_data(task);
- xbt_free(task->workstation_list);
- task->workstation_list=NULL;
- task->workstation_nb = 0;
+ xbt_free(task->host_list);
+ task->host_list=NULL;
+ task->host_count = 0;
}
if (SD_task_get_state(task) == SD_RUNNING)
xbt_assert(SD_task_get_state(task) == SD_RUNNABLE,
"Task '%s' is not runnable! Task state: %d",
SD_task_get_name(task), (int)SD_task_get_state(task));
- xbt_assert(task->workstation_list != NULL,
+ xbt_assert(task->host_list != NULL,
"Task '%s': workstation_list is NULL!",
SD_task_get_name(task));
XBT_DEBUG("Running task '%s'", SD_task_get_name(task));
/* Copy the elements of the task into the action */
- int host_nb = task->workstation_nb;
+ int host_nb = task->host_count;
hosts = xbt_new(sg_host_t, host_nb);
for (i = 0; i < host_nb; i++)
- hosts[i] = task->workstation_list[i];
+ hosts[i] = task->host_list[i];
double *flops_amount = xbt_new0(double, host_nb);
double *bytes_amount = xbt_new0(double, host_nb * host_nb);
SD_task_get_name(task));
task->flops_amount = xbt_new0(double, ws_count);
task->bytes_amount = xbt_new0(double, ws_count * ws_count);
- xbt_free(task->workstation_list);
- task->workstation_nb = ws_count;
- task->workstation_list = xbt_new0(SD_workstation_t, ws_count);
+ xbt_free(task->host_list);
+ task->host_count = ws_count;
+ task->host_list = xbt_new0(sg_host_t, ws_count);
for(i=0;i<ws_count;i++){
task->flops_amount[i] =
* comm cost alongside to comp one)
*/
void SD_task_schedulev(SD_task_t task, int count,
- const SD_workstation_t * list)
+ const sg_host_t * list)
{
int i, j;
SD_dependency_t dep;
SD_task_distribute_comp_amdahl(task, count);
case SD_TASK_COMM_E2E:
case SD_TASK_COMP_SEQ:
- xbt_assert(task->workstation_nb == count,
+ xbt_assert(task->host_count == count,
"Got %d locations, but were expecting %d locations",
- count,task->workstation_nb);
+ count,task->host_count);
for (i = 0; i < count; i++)
- task->workstation_list[i] = list[i];
+ task->host_list[i] = list[i];
if (SD_task_get_kind(task)== SD_TASK_COMP_SEQ && !task->flops_amount){
/*This task has failed and is rescheduled. Reset the flops_amount*/
task->flops_amount = xbt_new0(double, 1);
if (task->kind == SD_TASK_COMM_E2E) {
XBT_VERB("Schedule comm task %s between %s -> %s. It costs %.f bytes",
SD_task_get_name(task),
- sg_host_get_name(task->workstation_list[0]),
- sg_host_get_name(task->workstation_list[1]),
+ sg_host_get_name(task->host_list[0]),
+ sg_host_get_name(task->host_list[1]),
task->bytes_amount[2]);
}
if (task->kind == SD_TASK_COMP_SEQ) {
XBT_VERB("Schedule computation task %s on %s. It costs %.f flops",
SD_task_get_name(task),
- sg_host_get_name(task->workstation_list[0]),
+ sg_host_get_name(task->host_list[0]),
task->flops_amount[0]);
xbt_dynar_foreach(task->tasks_before, cpt, dep) {
SD_task_t before = dep->src;
if (before->kind == SD_TASK_COMM_E2E) {
- before->workstation_list[1] = task->workstation_list[0];
+ before->host_list[1] = task->host_list[0];
- if (before->workstation_list[0] &&
+ if (before->host_list[0] &&
(SD_task_get_state(before)< SD_SCHEDULED)) {
SD_task_do_schedule(before);
XBT_VERB
("Auto-Schedule comm task %s between %s -> %s. It costs %.f bytes",
SD_task_get_name(before),
- sg_host_get_name(before->workstation_list[0]),
- sg_host_get_name(before->workstation_list[1]),
+ sg_host_get_name(before->host_list[0]),
+ sg_host_get_name(before->host_list[1]),
before->bytes_amount[2]);
}
}
xbt_dynar_foreach(task->tasks_after, cpt, dep) {
SD_task_t after = dep->dst;
if (after->kind == SD_TASK_COMM_E2E) {
- after->workstation_list[0] = task->workstation_list[0];
- if (after->workstation_list[1]
+ after->host_list[0] = task->host_list[0];
+ if (after->host_list[1]
&& (SD_task_get_state(after)< SD_SCHEDULED)) {
SD_task_do_schedule(after);
XBT_VERB
("Auto-Schedule comm task %s between %s -> %s. It costs %.f bytes",
SD_task_get_name(after),
- sg_host_get_name(after->workstation_list[0]),
- sg_host_get_name(after->workstation_list[1]),
+ sg_host_get_name(after->host_list[0]),
+ sg_host_get_name(after->host_list[1]),
after->bytes_amount[2]);
}
if (task->kind == SD_TASK_COMP_PAR_AMDAHL) {
XBT_VERB("Schedule computation task %s on %d workstations. %.f flops"
" will be distributed following Amdahl's Law",
- SD_task_get_name(task), task->workstation_nb,
+ SD_task_get_name(task), task->host_count,
task->flops_amount[0]);
xbt_dynar_foreach(task->tasks_before, cpt, dep) {
SD_task_t before = dep->src;
if (before->kind == SD_TASK_COMM_PAR_MXN_1D_BLOCK){
- if (!before->workstation_list){
+ if (!before->host_list){
XBT_VERB("Sender side of Task %s is not scheduled yet",
SD_task_get_name(before));
- before->workstation_list = xbt_new0(SD_workstation_t, count);
- before->workstation_nb = count;
+ before->host_list = xbt_new0(sg_host_t, count);
+ before->host_count = count;
XBT_VERB("Fill the workstation list with list of Task '%s'",
SD_task_get_name(task));
for (i=0;i<count;i++)
- before->workstation_list[i] = task->workstation_list[i];
+ before->host_list[i] = task->host_list[i];
} else {
XBT_VERB("Build communication matrix for task '%s'",
SD_task_get_name(before));
int src_nb, dst_nb;
double src_start, src_end, dst_start, dst_end;
- src_nb = before->workstation_nb;
+ src_nb = before->host_count;
dst_nb = count;
- before->workstation_list = (SD_workstation_t*) xbt_realloc(
- before->workstation_list,
- (before->workstation_nb+count)*sizeof(s_SD_workstation_t));
+ before->host_list = (sg_host_t*) xbt_realloc(
+ before->host_list,
+ (before->host_count+count)*sizeof(sg_host_t));
for(i=0; i<count; i++)
- before->workstation_list[before->workstation_nb+i] =
- task->workstation_list[i];
+ before->host_list[before->host_count+i] =
+ task->host_list[i];
- before->workstation_nb += count;
+ before->host_count += count;
xbt_free(before->flops_amount);
xbt_free(before->bytes_amount);
before->flops_amount = xbt_new0(double,
- before->workstation_nb);
+ before->host_count);
before->bytes_amount = xbt_new0(double,
- before->workstation_nb*
- before->workstation_nb);
+ before->host_count*
+ before->host_count);
for(i=0;i<src_nb;i++){
src_start = i*before->amount/src_nb;
dst_start = j*before->amount/dst_nb;
dst_end = dst_start + before->amount/dst_nb;
XBT_VERB("(%s->%s): (%.2f, %.2f)-> (%.2f, %.2f)",
- sg_host_get_name(before->workstation_list[i]),
- sg_host_get_name(before->workstation_list[src_nb+j]),
+ sg_host_get_name(before->host_list[i]),
+ sg_host_get_name(before->host_list[src_nb+j]),
src_start, src_end, dst_start, dst_end);
if ((src_end <= dst_start) || (dst_end <= src_start)) {
before->bytes_amount[i*(src_nb+dst_nb)+src_nb+j]=0.0;
xbt_dynar_foreach(task->tasks_after, cpt, dep) {
SD_task_t after = dep->dst;
if (after->kind == SD_TASK_COMM_PAR_MXN_1D_BLOCK){
- if (!after->workstation_list){
+ if (!after->host_list){
XBT_VERB("Receiver side of Task '%s' is not scheduled yet",
SD_task_get_name(after));
- after->workstation_list = xbt_new0(SD_workstation_t, count);
- after->workstation_nb = count;
+ after->host_list = xbt_new0(sg_host_t, count);
+ after->host_count = count;
XBT_VERB("Fill the workstation list with list of Task '%s'",
SD_task_get_name(task));
for (i=0;i<count;i++)
- after->workstation_list[i] = task->workstation_list[i];
+ after->host_list[i] = task->host_list[i];
} else {
int src_nb, dst_nb;
double src_start, src_end, dst_start, dst_end;
src_nb = count;
- dst_nb = after->workstation_nb;
- after->workstation_list = (SD_workstation_t*) xbt_realloc(
- after->workstation_list,
- (after->workstation_nb+count)*sizeof(s_SD_workstation_t));
- for(i=after->workstation_nb - 1; i>=0; i--)
- after->workstation_list[count+i] = after->workstation_list[i];
+ dst_nb = after->host_count;
+ after->host_list = (sg_host_t*) xbt_realloc(
+ after->host_list,
+ (after->host_count+count)*sizeof(sg_host_t));
+ for(i=after->host_count - 1; i>=0; i--)
+ after->host_list[count+i] = after->host_list[i];
for(i=0; i<count; i++)
- after->workstation_list[i] = task->workstation_list[i];
+ after->host_list[i] = task->host_list[i];
- after->workstation_nb += count;
+ after->host_count += count;
xbt_free(after->flops_amount);
xbt_free(after->bytes_amount);
- after->flops_amount = xbt_new0(double, after->workstation_nb);
+ after->flops_amount = xbt_new0(double, after->host_count);
after->bytes_amount = xbt_new0(double,
- after->workstation_nb*
- after->workstation_nb);
+ after->host_count*
+ after->host_count);
for(i=0;i<src_nb;i++){
src_start = i*after->amount/src_nb;
void SD_task_schedulel(SD_task_t task, int count, ...)
{
va_list ap;
- SD_workstation_t *list = xbt_new(SD_workstation_t, count);
+ sg_host_t *list = xbt_new(sg_host_t, count);
int i;
va_start(ap, count);
for (i = 0; i < count; i++) {
- list[i] = va_arg(ap, SD_workstation_t);
+ list[i] = va_arg(ap, sg_host_t);
}
va_end(ap);
SD_task_schedulev(task, count, list);
#include "src/surf/host_interface.hpp"
#include "src/simdag/simdag_private.h"
#include "simgrid/simdag.h"
+#include "simgrid/host.h"
#include <simgrid/s4u/host.hpp>
#include "xbt/dict.h"
#include "xbt/lib.h"
xbt_free(s);
}
-/**
- * \brief Returns a workstation given its name
- *
- * If there is no such workstation, the function returns \c NULL.
- *
- * \param name workstation name
- * \return the workstation, or \c NULL if there is no such workstation
- */
-SD_workstation_t SD_workstation_get_by_name(const char *name)
-{
- return sg_host_by_name(name);
-}
-
/**
* \brief Returns the workstation list
*
- * Use SD_workstation_get_count() to know the array size.
+ * Use sg_host_count() to know the array size.
*
- * \return an array of \ref SD_workstation_t containing all workstations
+ * \return an array of \ref sg_host_t containing all workstations
* \remark The workstation order in the returned array is generally different from the workstation creation/declaration order in the XML platform (we use a hash table internally).
- * \see SD_workstation_get_count()
- */
-const SD_workstation_t *SD_workstation_get_list(void) {
- xbt_assert(SD_workstation_get_count() > 0, "There is no workstation!");
-
- if (sd_global->workstation_list == NULL) /* this is the first time the function is called */
- sd_global->workstation_list = (SD_workstation_t*)xbt_dynar_to_array(sg_hosts_as_dynar());
-
- return sd_global->workstation_list;
-}
-
-/**
- * \brief Returns the number of workstations
- *
- * \return the number of existing workstations
- * \see SD_workstation_get_list()
- */
-int SD_workstation_get_count(void)
-{
- return sg_host_count();
-}
-
-/**
- * \brief Returns the user data of a workstation
- *
- * \param workstation a workstation
- * \return the user data associated with this workstation (can be \c NULL)
- * \see SD_workstation_set_data()
- */
-void *SD_workstation_get_data(SD_workstation_t workstation)
-{
- return sg_host_user(workstation);
-}
-
-/**
- * \brief Sets the user data of a workstation
- *
- * The new data can be \c NULL. The old data should have been freed first
- * if it was not \c NULL.
- *
- * \param workstation a workstation
- * \param data the new data you want to associate with this workstation
- * \see SD_workstation_get_data()
- */
-void SD_workstation_set_data(SD_workstation_t workstation, void *data)
-{
- sg_host_user_set(workstation, data);
-}
-
-/**
- * \brief Returns the name of a workstation
- *
- * \param workstation a workstation
- * \return the name of this workstation (cannot be \c NULL)
+ * \see sg_host_count()
*/
-const char *SD_workstation_get_name(SD_workstation_t workstation)
-{
- return sg_host_get_name(workstation);
-}
-
-/**
- * \brief Returns the value of a given workstation property
- *
- * \param ws a workstation
- * \param name a property name
- * \return value of a property (or NULL if property not set)
- */
-const char *SD_workstation_get_property_value(SD_workstation_t ws,
- const char *name)
-{
- return (const char*) xbt_dict_get_or_null(sg_host_get_properties(ws), name);
-}
+const sg_host_t *sg_host_list(void) {
+ xbt_assert(sg_host_count() > 0, "There is no workstation!");
+ if (sd_global->host_list == NULL) /* this is the first time the function is called */
+ sd_global->host_list = (sg_host_t*)xbt_dynar_to_array(sg_hosts_as_dynar());
-/**
- * \brief Returns a #xbt_dict_t consisting of the list of properties assigned to this workstation
- *
- * \param workstation a workstation
- * \return the dictionary containing the properties associated with the workstation
- */
-xbt_dict_t SD_workstation_get_properties(SD_workstation_t workstation)
-{
- return sg_host_get_properties(workstation);
+ return sd_global->host_list;
}
-
/** @brief Displays debugging informations about a workstation */
-void SD_workstation_dump(SD_workstation_t ws)
+void sg_host_dump(sg_host_t ws)
{
xbt_dict_t props;
xbt_dict_cursor_t cursor=NULL;
XBT_INFO("Displaying workstation %s", sg_host_get_name(ws));
XBT_INFO(" - speed: %.0f", ws->speed());
- XBT_INFO(" - available speed: %.2f", surf_host_get_available_speed(ws));
+ XBT_INFO(" - available speed: %.2f", sg_host_get_available_speed(ws));
props = sg_host_get_properties(ws);
if (!xbt_dict_is_empty(props)){
* \return a new array of \ref SD_link_t representing the route between these two workstations
* \see SD_route_get_size(), SD_link_t
*/
-const SD_link_t *SD_route_get_list(SD_workstation_t src,
- SD_workstation_t dst)
+double sg_host_speed(sg_host_t workstation)
+{
+ return workstation->speed();
+}
+int sg_host_core_count(sg_host_t workstation) {
+ return workstation->core_count();
+}
+
+
+double sg_host_computation_time(sg_host_t workstation,
+ double flops_amount)
+{
+ xbt_assert(flops_amount >= 0,
+ "flops_amount must be greater than or equal to zero");
+ return flops_amount / workstation->speed();
+}
+
+xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t workstation){
+ return workstation->extension<simgrid::surf::Host>()->getMountedStorageList();
+}
+
+xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t workstation){
+ return surf_host_get_attached_storage_list(workstation);
+}
+
+const SD_link_t *SD_route_get_list(sg_host_t src,
+ sg_host_t dst)
{
xbt_dynar_t surf_route;
void *surf_link;
* \return the number of links on the route between these two workstations
* \see SD_route_get_list()
*/
-int SD_route_get_size(SD_workstation_t src, SD_workstation_t dst)
+int SD_route_get_size(sg_host_t src, sg_host_t dst)
{
return xbt_dynar_length(surf_host_model_get_route(
(surf_host_model_t)surf_host_model, src, dst));
*
* \param workstation a workstation
* \return the total speed of this workstation
- * \see SD_workstation_get_available_speed()
+ * \see sg_host_get_available_speed()
*/
-double SD_workstation_get_speed(SD_workstation_t workstation)
-{
- return workstation->speed();
-}
/**
* \brief Returns the amount of cores of a workstation
*
* \param workstation a workstation
* \return the amount of cores of this workstation
*/
-int SD_workstation_get_cores(SD_workstation_t workstation) {
- return workstation->core_count();
-}
-
-/**
- * \brief Returns the proportion of available speed in a workstation
- *
- * \param workstation a workstation
- * \return the proportion of speed currently available in this workstation (normally a number between 0 and 1)
- * \see SD_workstation_get_speed()
- */
-double SD_workstation_get_available_speed(SD_workstation_t workstation)
-{
- return surf_host_get_available_speed(workstation);
-}
-
/**
* \brief Returns an approximative estimated time for the given computation amount on a workstation
*
* \param flops_amount the computation amount you want to evaluate (in flops)
* \return an approximative estimated computation time for the given computation amount on this workstation (in seconds)
*/
-double SD_workstation_get_computation_time(SD_workstation_t workstation,
- double flops_amount)
-{
- xbt_assert(flops_amount >= 0,
- "flops_amount must be greater than or equal to zero");
- return flops_amount / workstation->speed();
-}
-
/**
* \brief Returns the latency of the route between two workstations.
*
* \return the latency of the route between the two workstations (in seconds)
* \see SD_route_get_bandwidth()
*/
-double SD_route_get_latency(SD_workstation_t src, SD_workstation_t dst)
+double SD_route_get_latency(sg_host_t src, sg_host_t dst)
{
xbt_dynar_t route = NULL;
double latency = 0;
* (in bytes/second)
* \see SD_route_get_latency()
*/
-double SD_route_get_bandwidth(SD_workstation_t src, SD_workstation_t dst)
+double SD_route_get_bandwidth(sg_host_t src, sg_host_t dst)
{
const SD_link_t *links;
* \return an approximative estimated communication time for the given bytes amount
* between the workstations (in seconds)
*/
-double SD_route_get_communication_time(SD_workstation_t src,
- SD_workstation_t dst,
+double SD_route_get_communication_time(sg_host_t src,
+ sg_host_t dst,
double bytes_amount)
{
* \param workstation a workstation
* \return a dynar containing all mounted storages on the workstation
*/
-xbt_dict_t SD_workstation_get_mounted_storage_list(SD_workstation_t workstation){
- return workstation->extension<simgrid::surf::Host>()->getMountedStorageList();
-}
-
/**
* \brief Return the list of mounted storages on a workstation.
*
* \param workstation a workstation
* \return a dynar containing all mounted storages on the workstation
*/
-xbt_dynar_t SD_workstation_get_attached_storage_list(SD_workstation_t workstation){
- return surf_host_get_attached_storage_list(workstation);
-}
-
/**
* \brief Returns the host name the storage is attached to
*
/* Global variables */
typedef struct SD_global {
- SD_workstation_t *workstation_list; /* array of workstations, created only if
- necessary in SD_workstation_get_list */
+ sg_host_t *host_list; /* array of workstations, created only if
+ necessary in sg_host_list() */
SD_link_t *link_list; /* array of links */
SD_link_t *recyclable_route; /* array returned by SD_route_get_list
and mallocated only once */
extern XBT_PRIVATE SD_global_t sd_global;
-/* Workstation */
-typedef s_xbt_dictelm_t s_SD_workstation_t;
-
/* Storage */
typedef s_xbt_dictelm_t s_SD_storage_t;
typedef struct SD_storage {
unsigned int is_not_ready;
/* scheduling parameters (only exist in state SD_SCHEDULED) */
- int workstation_nb;
- SD_workstation_t *workstation_list; /* surf workstations */
+ int host_count;
+ sg_host_t *host_list;
double *flops_amount;
double *bytes_amount;
double rate;
XBT_PRIVATE SD_storage_t __SD_storage_create(void *surf_storage, void *data);
XBT_PRIVATE void __SD_storage_destroy(void *storage);
-/********** Tracing **********/
-/* declaration of instrumentation functions from sd_task_instr.c */
-XBT_PRIVATE void TRACE_sd_task_create(SD_task_t task);
-XBT_PRIVATE void TRACE_sd_task_execute_start(SD_task_t task);
-XBT_PRIVATE void TRACE_sd_task_execute_end(SD_task_t task);
-XBT_PRIVATE void TRACE_sd_task_destroy(SD_task_t task);
-
SG_END_DECL()
#endif
void sg_host_msg_set(sg_host_t host, msg_host_priv_t smx_host) {
host->extension_set(MSG_HOST_LEVEL, smx_host);
}
-// ========== SimDag Layer ==============
-SD_workstation_priv_t sg_host_sd(sg_host_t host) {
- return (SD_workstation_priv_t) host->extension(SD_HOST_LEVEL);
-}
-void sg_host_sd_set(sg_host_t host, SD_workstation_priv_t smx_host) {
- host->extension_set(SD_HOST_LEVEL, smx_host);
-}
-void sg_host_sd_destroy(sg_host_t host) {
- host->extension_set(SD_HOST_LEVEL, nullptr);
-}
// ========== Simix layer =============
smx_host_priv_t sg_host_simix(sg_host_t host){
static int name_compare_hosts(const void *n1, const void *n2)
{
char name1[80], name2[80];
- strcpy(name1, SD_workstation_get_name(*((SD_workstation_t *) n1)));
- strcpy(name2, SD_workstation_get_name(*((SD_workstation_t *) n2)));
+ strcpy(name1, sg_host_get_name(*((sg_host_t *) n1)));
+ strcpy(name2, sg_host_get_name(*((sg_host_t *) n2)));
return strcmp(name1, name2);
}
unsigned int cursor;
SD_task_t task;
- const SD_workstation_t *ws_list = SD_workstation_get_list();
- int totalHosts = SD_workstation_get_count();
- qsort((void *) ws_list, totalHosts, sizeof(SD_workstation_t),
+ const sg_host_t *ws_list = sg_host_list();
+ int totalHosts = sg_host_count();
+ qsort((void *) ws_list, totalHosts, sizeof(sg_host_t),
name_compare_hosts);
//fprintf(stdout, "No. workstations: %d, %d\n", totalHosts, (dax != NULL));
if (!strcmp(SD_task_get_name(task), "end")
|| !strcmp(SD_task_get_name(task), "root")) {
fprintf(stdout, "Scheduling %s to node: %s\n", SD_task_get_name(task),
- SD_workstation_get_name(ws_list[0]));
+ sg_host_get_name(ws_list[0]));
SD_task_schedulel(task, 1, ws_list[0]);
} else {
fprintf(stdout, "Scheduling %s to node: %s\n", SD_task_get_name(task),
- SD_workstation_get_name(ws_list[(cursor) % totalHosts]));
+ sg_host_get_name(ws_list[(cursor) % totalHosts]));
SD_task_schedulel(task, 1, ws_list[(cursor) % totalHosts]);
}
}
/* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(taskInit, 1, sg_host_list(), no_cost,
no_cost, -1.0);
- SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(taskA, 2, sg_host_list(), no_cost,
communication_amount1, -1.0);
- SD_task_schedule(taskB, 2, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(taskB, 2, sg_host_list(), no_cost,
communication_amount2, -1.0);
SD_task_dependency_add(NULL, NULL, taskInit, taskA);
double communication_amount2 = 1e9;
double no_cost = 0.0;
- const SD_workstation_t *workstation;
+ const sg_host_t *workstation;
/* initialization of SD */
SD_init(&argc, argv);
/* scheduling parameters */
- workstation = SD_workstation_get_list();
+ workstation = sg_host_list();
/* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, SD_workstation_get_list(), &no_cost,
+ SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost,
&no_cost, -1.0);
SD_task_schedule(taskA, 1, &workstation[0], &no_cost,
&communication_amount1, -1.0);
SD_task_t taskA;
SD_task_t taskB;
- const SD_workstation_t *workstation;
+ const sg_host_t *workstation;
double communication_amount1 = 1e9;
double communication_amount2 = 1e8;
/* scheduling parameters */
- workstation = SD_workstation_get_list();
+ workstation = sg_host_list();
/* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, SD_workstation_get_list(), &no_cost,
+ SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost,
&no_cost, -1.0);
SD_task_schedule(taskA, 1, &workstation[0], &no_cost,
&communication_amount1, -1.0);
taskFin = SD_task_create("Task Fin", NULL, 1.0);
/* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(taskInit, 1, sg_host_list(), no_cost,
no_cost, -1.0);
- SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost, no_cost,
+ SD_task_schedule(taskA, 2, sg_host_list(), no_cost, no_cost,
-1.0);
- SD_task_schedule(taskFin, 1, SD_workstation_get_list(), no_cost, no_cost,
+ SD_task_schedule(taskFin, 1, sg_host_list(), no_cost, no_cost,
-1.0);
SD_task_dependency_add(NULL, NULL, taskInit, taskA);
/* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(taskInit, 1, sg_host_list(), no_cost,
no_cost, -1.0);
- SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost, amount,
+ SD_task_schedule(taskA, 2, sg_host_list(), no_cost, amount,
-1.0);
- SD_task_schedule(taskFin, 1, SD_workstation_get_list(), no_cost, no_cost,
+ SD_task_schedule(taskFin, 1, sg_host_list(), no_cost, no_cost,
-1.0);
SD_task_dependency_add(NULL, NULL, taskInit, taskA);
taskB = SD_task_create("Task B", NULL, 1.0);
/* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(taskInit, 1, sg_host_list(), no_cost,
no_cost, -1.0);
- SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost, amount,
+ SD_task_schedule(taskA, 2, sg_host_list(), no_cost, amount,
-1.0);
- SD_task_schedule(taskB, 1, SD_workstation_get_list(), comput, no_cost,
+ SD_task_schedule(taskB, 1, sg_host_list(), comput, no_cost,
-1.0);
SD_task_dependency_add(NULL, NULL, taskInit, taskA);
taskA = SD_task_create("Task A", NULL, 1.0);
taskB = SD_task_create("Task B", NULL, 1.0);
- SD_task_schedule(taskA, 1, SD_workstation_get_list(), comp_cost,
+ SD_task_schedule(taskA, 1, sg_host_list(), comp_cost,
comm_cost, -1.0);
- SD_task_schedule(taskB, 1, SD_workstation_get_list(), comp_cost,
+ SD_task_schedule(taskB, 1, sg_host_list(), comp_cost,
comm_cost, -1.0);
ret = SD_simulate(-1.0);
SD_task_t taskInit;
SD_task_t taskA, taskB, taskC, taskD;
- const SD_workstation_t *workstation;
+ const sg_host_t *workstation;
double communication_amount1 = 1e9;
double no_cost = 0.0;
/* scheduling parameters */
- workstation = SD_workstation_get_list();
+ workstation = sg_host_list();
SD_task_dependency_add(NULL, NULL, taskInit, taskA);
SD_task_dependency_add(NULL, NULL, taskInit, taskB);
SD_task_dependency_add(NULL, NULL, taskC, taskD);
/* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, SD_workstation_get_list(), &no_cost,
+ SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost,
&no_cost, -1.0);
SD_task_schedule(taskA, 1, &workstation[0], &no_cost,
&communication_amount1, -1.0);
task = SD_task_create("All2all task", NULL, 1.0);
- SD_task_schedule(task, 4, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(task, 4, sg_host_list(), no_cost,
communication_amount, -1.0);
SD_simulate(-1.0);
task = SD_task_create("Comm 1", NULL, 1.0);
- SD_task_schedule(task, 4, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(task, 4, sg_host_list(), no_cost,
communication_amount, -1.0);
SD_simulate(-1.0);
task = SD_task_create("Scatter task", NULL, 1.0);
- SD_task_schedule(task, 4, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(task, 4, sg_host_list(), no_cost,
communication_amount, -1.0);
SD_simulate(-1.0);
task = SD_task_create("Comm 1", NULL, 1.0);
- SD_task_schedule(task, 2, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(task, 2, sg_host_list(), no_cost,
communication_amount, -1.0);
SD_simulate(-1.0);
task1 = SD_task_create("Comm 1", NULL, 1.0);
task2 = SD_task_create("Comm 2", NULL, 1.0);
- SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost1, no_cost1,
+ SD_task_schedule(root, 1, sg_host_list(), no_cost1, no_cost1,
-1.0);
- SD_task_schedule(task1, 2, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(task1, 2, sg_host_list(), no_cost,
communication_amount1, -1.0);
- SD_task_schedule(task2, 2, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(task2, 2, sg_host_list(), no_cost,
communication_amount2, -1.0);
SD_task_dependency_add(NULL, NULL, root, task1);
task1 = SD_task_create("Comm 1", NULL, 1.0);
task2 = SD_task_create("Comm 2", NULL, 1.0);
- SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost1,
+ SD_task_schedule(root, 1, sg_host_list(), no_cost1,
no_cost1, -1.0);
- SD_task_schedule(task1, 2, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(task1, 2, sg_host_list(), no_cost,
communication_amount1, -1.0);
- SD_task_schedule(task2, 2, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(task2, 2, sg_host_list(), no_cost,
communication_amount2, -1.0);
SD_task_dependency_add(NULL, NULL, root, task1);
// xbt_assert( check max tcp win size, "MAX TCP WIN SIZE is 20000");
root = SD_task_create("Root", NULL, 1.0);
- SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost, no_cost,
+ SD_task_schedule(root, 1, sg_host_list(), no_cost, no_cost,
-1.0);
for (i = 0; i < TASK_NUM; i++) {
task[i] = SD_task_create("Comm", NULL, 1.0);
- SD_task_schedule(task[i], 2, SD_workstation_get_list(), no_cost,
+ SD_task_schedule(task[i], 2, sg_host_list(), no_cost,
communication_amount, -1.0);
SD_task_dependency_add(NULL, NULL, root, task[i]);
}
SD_task_t root;
root = SD_task_create("Root", NULL, 1.0);
- SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost, no_cost,
+ SD_task_schedule(root, 1, sg_host_list(), no_cost, no_cost,
-1.0);
return root;
SD_task_t root;
root = SD_task_create("Root", NULL, 1.0);
- SD_task_schedule(root, 2, SD_workstation_get_list(), comp_cost,
+ SD_task_schedule(root, 2, sg_host_list(), comp_cost,
comm_cost, -1.0);
return root;
SD_create_environment(argv[1]);
task = SD_task_create("partask", NULL, 1.0);
- SD_task_schedule(task, 2, SD_workstation_get_list(), comp_cost,
+ SD_task_schedule(task, 2, sg_host_list(), comp_cost,
comm_amount, -1.0);
SD_simulate(-1.0);
SD_create_environment(argv[1]);
task = SD_task_create("seqtask", NULL, 1.0);
- SD_task_schedule(task, 1, SD_workstation_get_list(), comp_cost,
+ SD_task_schedule(task, 1, sg_host_list(), comp_cost,
comm_amount, -1.0);
SD_simulate(-1.0);
int main(int argc, char **argv)
{
- SD_workstation_t w1, w2;
- const SD_workstation_t *workstations;
+ sg_host_t w1, w2;
+ const sg_host_t *workstations;
int i, j;
int list_size;
xbt_os_timer_t timer = xbt_os_timer_new();
/* creation of the environment */
SD_create_environment(argv[1]);
- workstations = SD_workstation_get_list();
- list_size = SD_workstation_get_count();
+ workstations = sg_host_list();
+ list_size = sg_host_count();
/* Random number initialization */
srand( (int) (xbt_os_time()*1000) );
/* Display the result and exit after cleanup */
printf( "%f\n", xbt_os_timer_elapsed(timer) );
- printf("Workstation number: %d, link number: %d\n",
- SD_workstation_get_count(), sg_link_count());
+ printf("Workstation number: %zu, link number: %d\n",
+ sg_host_count(), sg_link_count());
if(argv[2]){
printf("Wait for %ss\n",argv[2]);
sleep(atoi(argv[2]));
{
/* SD initialization */
- SD_workstation_t w1, w2;
- const SD_workstation_t *workstations;
+ sg_host_t w1, w2;
+ const sg_host_t *workstations;
const SD_link_t *route;
const char *name1;
const char *name2;
/* creation of the environment */
SD_create_environment(argv[1]);
- printf("Workstation number: %d, link number: %d\n",
- SD_workstation_get_count(), sg_link_count());
+ printf("Workstation number: %zu, link number: %d\n",
+ sg_host_count(), sg_link_count());
if (argc >= 3) {
if (!strcmp(argv[2], "ONE_LINK")) {
- workstations = SD_workstation_get_list();
+ workstations = sg_host_list();
w1 = workstations[0];
w2 = workstations[1];
- name1 = SD_workstation_get_name(w1);
- name2 = SD_workstation_get_name(w2);
+ name1 = sg_host_get_name(w1);
+ name2 = sg_host_get_name(w2);
printf("Route between %s and %s\n", name1, name2);
route = SD_route_get_list(w1, w2);
SD_route_get_bandwidth(w1, w2));
}
if (!strcmp(argv[2], "FULL_LINK")) {
- workstations = SD_workstation_get_list();
- list_size = SD_workstation_get_count();
+ workstations = sg_host_list();
+ list_size = sg_host_count();
for (i = 0; i < list_size; i++) {
w1 = workstations[i];
- name1 = SD_workstation_get_name(w1);
+ name1 = sg_host_get_name(w1);
for (j = 0; j < list_size; j++) {
w2 = workstations[j];
- name2 = SD_workstation_get_name(w2);
+ name2 = sg_host_get_name(w2);
printf("Route between %s and %s\n", name1, name2);
route = SD_route_get_list(w1, w2);
route_size = SD_route_get_size(w1, w2);
}
if (!strcmp(argv[2], "PROP")) {
printf("SG_TEST_mem: %s\n",
- SD_workstation_get_property_value(SD_workstation_get_by_name("host1"),
+ sg_host_get_property_value(sg_host_by_name("host1"),
"SG_TEST_mem"));
}
}
static int name_compare_hosts(const void *n1, const void *n2)
{
char name1[80], name2[80];
- strcpy(name1, SD_workstation_get_name(*((SD_workstation_t *) n1)));
- strcpy(name2, SD_workstation_get_name(*((SD_workstation_t *) n2)));
+ strcpy(name1, sg_host_get_name(*((sg_host_t *) n1)));
+ strcpy(name2, sg_host_get_name(*((sg_host_t *) n2)));
return strcmp(name1, name2);
}
sg_netcard_t value1;
sg_netcard_t value2;
- const SD_workstation_t *hosts;
+ const sg_host_t *hosts;
const SD_link_t *links;
xbt_os_timer_t parse_time = xbt_os_timer_new();
create_environment(parse_time, platformFile);
if (timings) {
- XBT_INFO("Parsing time: %fs (%d hosts, %d links)",
- xbt_os_timer_elapsed(parse_time),SD_workstation_get_count(),
+ XBT_INFO("Parsing time: %fs (%zu hosts, %d links)",
+ xbt_os_timer_elapsed(parse_time),sg_host_count(),
sg_link_count());
} else {
printf("<?xml version='1.0'?>\n");
printf("<AS id=\"AS0\" routing=\"Full\">\n");
// Hosts
- totalHosts = SD_workstation_get_count();
- hosts = SD_workstation_get_list();
- qsort((void *) hosts, totalHosts, sizeof(SD_workstation_t),
+ totalHosts = sg_host_count();
+ hosts = sg_host_list();
+ qsort((void *) hosts, totalHosts, sizeof(sg_host_t),
name_compare_hosts);
for (i = 0; i < totalHosts; i++) {
printf(" <host id=\"%s\" power=\"%.0f\"",
- SD_workstation_get_name(hosts[i]),
- SD_workstation_get_speed(hosts[i]));
- props = SD_workstation_get_properties(hosts[i]);
- if (SD_workstation_get_cores(hosts[i])>1) {
- printf(" core=\"%d\"", SD_workstation_get_cores(hosts[i]));
+ sg_host_get_name(hosts[i]),
+ sg_host_speed(hosts[i]));
+ props = sg_host_get_properties(hosts[i]);
+ if (sg_host_core_count(hosts[i])>1) {
+ printf(" core=\"%d\"", sg_host_core_count(hosts[i]));
}
if (props && !xbt_dict_is_empty(props)) {
printf(">\n");
size = xbt_dict_length(host_list) + xbt_lib_length(as_router_lib);
- printf("Workstation number: %d, link number: %d, elmts number: %d\n",
- SD_workstation_get_count(), sg_link_count(), size);
+ printf("Workstation number: %zu, link number: %d, elmts number: %d\n",
+ sg_host_count(), sg_link_count(), size);
xbt_dict_foreach(host_list, cursor, key, data) {
printf(" - Seen: \"%s\" is type : %d\n", key,