#include "xbt/ex.h"
#include "xbt/dict.h"
+#include "gras_config.h"
#include "workstation_private.h"
#include "cpu_private.h"
#include "network_private.h"
surf_workstation_resource_t surf_workstation_resource = NULL;
-
xbt_dict_t workstation_set = NULL;
+static xbt_dict_t parallel_task_network_link_set = NULL;
static workstation_CLM03_t workstation_new(const char *name,
void *cpu, void *card)
*/
xbt_swag_foreach_safe(action, next_action, running_actions) {
- surf_double_update(&(action->generic_action.remains),
+ double_update(&(action->generic_action.remains),
lmm_variable_getvalue(action->variable) * delta);
if (action->generic_action.max_duration != NO_MAX_DURATION)
- surf_double_update(&(action->generic_action.max_duration), delta);
+ double_update(&(action->generic_action.max_duration), delta);
if ((action->generic_action.remains <= 0) &&
(lmm_get_variable_weight(action->variable)>0)) {
action->generic_action.finish = surf_get_clock();
get_available_speed(((workstation_CLM03_t) workstation)->cpu);
}
+static surf_action_t execute_parallel_task_bogus (int workstation_nb,
+ void **workstation_list,
+ double *computation_amount,
+ double *communication_amount,
+ double amount,
+ double rate)
+{
+ DIE_IMPOSSIBLE;
+}
+
static surf_action_t execute_parallel_task (int workstation_nb,
void **workstation_list,
double *computation_amount,
{
surf_action_parallel_task_CSL05_t action = NULL;
int i, j, k;
- xbt_dict_t network_link_set = xbt_dict_new();
- xbt_dict_cursor_t cursor = NULL;
- char *name = NULL;
int nb_link = 0;
int nb_host = 0;
- network_link_CM02_t link;
+
+ if (parallel_task_network_link_set == NULL) {
+ parallel_task_network_link_set = xbt_dict_new_ext(workstation_nb * workstation_nb * 10);
+ }
/* Compute the number of affected resources... */
for(i=0; i< workstation_nb; i++) {
if(communication_amount[i*workstation_nb+j]>0)
for(k=0; k< route_size; k++) {
- xbt_dict_set(network_link_set, route[k]->name, route[k], NULL);
+ xbt_dict_set(parallel_task_network_link_set, route[k]->name, route[k], NULL);
}
}
}
- xbt_dict_foreach(network_link_set, cursor, name, link) {
- nb_link++;
- }
-
- xbt_dict_free(&network_link_set);
+ nb_link = xbt_dict_length(parallel_task_network_link_set);
+ xbt_dict_reset(parallel_task_network_link_set);
for (i = 0; i<workstation_nb; i++)
if(computation_amount[i]>0) nb_host++;
surf_workstation_resource->extension_public->get_available_speed = get_available_speed;
surf_workstation_resource->extension_public->communicate = communicate;
surf_workstation_resource->extension_public->execute_parallel_task =
- execute_parallel_task;
+ execute_parallel_task_bogus;
surf_workstation_resource->extension_public->get_route = get_route;
surf_workstation_resource->extension_public->get_route_size = get_route_size;
surf_workstation_resource->extension_public->get_link_name = get_link_name;
/* } */
void surf_workstation_resource_init_CLM03(const char *filename)
{
-/* int i ; */
-/* surf_resource_t resource = NULL; */
-
surf_workstation_resource_init_internal();
surf_cpu_resource_init_Cas01(filename);
surf_network_resource_init_CM02(filename);
create_workstations();
xbt_dynar_push(resource_list, &surf_workstation_resource);
-/* xbt_dynar_foreach(resource_list, i, resource) { */
-/* if(resource==surf_cpu_resource) { */
-/* xbt_dynar_remove_at(resource_list, i, NULL); */
-/* i--; */
-/* continue; */
-/* } */
-/* if(resource==surf_network_resource) { */
-/* xbt_dynar_remove_at(resource_list, i, NULL); */
-/* i--; */
-/* continue; */
-/* } */
-/* } */
+}
+
+#ifdef USE_GTNETS
+/* KF. Use GTNetS for the network. */
+void surf_workstation_resource_init_GTNETS(const char *filename)
+{
+ surf_workstation_resource_init_internal();
+ surf_cpu_resource_init_Cas01(filename);
+ surf_network_resource_init_GTNETS(filename);
+ create_workstations();
+ xbt_dynar_push(resource_list, &surf_workstation_resource);
+}
+#endif
+
+void surf_workstation_resource_init_compound(const char *filename)
+{
+
+ xbt_assert0(surf_cpu_resource,"No CPU resource defined yet!");
+ xbt_assert0(surf_network_resource,"No network resource defined yet!");
+ surf_workstation_resource_init_internal();
+ create_workstations();
+ xbt_dynar_push(resource_list, &surf_workstation_resource);
}