static GHashTable *
build_task_groups (UfoBaseScheduler *scheduler, UfoTaskGraph *graph, UfoResources *resources, GList *nodes)
{
    GHashTable *tasks_to_groups;
    GList *it;

    tasks_to_groups = g_hash_table_new (g_direct_hash, g_direct_equal);

    /* Create a group with a single member for each node */
    g_list_for (nodes, it) {
        TaskGroup *group;
        UfoNode *task;
        UfoNode *node;

        task = UFO_NODE (it->data);
        group = g_new0 (TaskGroup, 1);
        group->context = ufo_resources_get_context (resources);
        group->parents = NULL;
        group->tasks = g_list_append (NULL, it->data);
        group->queue = ufo_two_way_queue_new (NULL);
        group->is_leaf = ufo_graph_get_num_successors (UFO_GRAPH (graph), task) == 0;

        if (ufo_task_get_mode (UFO_TASK (task)) & UFO_TASK_MODE_SHARE_DATA) {
            group->mode = TASK_GROUP_SHARED;
        }
        else {
            group->mode = TASK_GROUP_ROUND_ROBIN;
        }

        node = ufo_node_new (group);
        g_hash_table_insert (tasks_to_groups, it->data, node);
    }
Exemple #2
0
gboolean
ufo_task_uses_cpu (UfoTask *task)
{
    return ufo_task_get_mode (task) & UFO_TASK_MODE_CPU;
}