Exemplo n.º 1
0
void reader_init(struct thorium_actor *actor)
{
    struct reader *reader1;

    reader1 = (struct reader *)thorium_actor_concrete_actor(actor);
    reader1->counted = 0;
    reader1->pulled = 0;

    core_vector_init(&reader1->spawners, sizeof(int));
    thorium_actor_add_script(actor, SCRIPT_INPUT_STREAM,
                    &biosal_input_stream_script);
}
Exemplo n.º 2
0
Arquivo: ring.c Projeto: huyba/biosal
void ring_init(struct thorium_actor *actor)
{
    struct ring *concrete_actor;

    concrete_actor = (struct ring *)thorium_actor_concrete_actor(actor);

    concrete_actor->spawned_senders = 0;
    concrete_actor->senders = 100000;

#if 1
    concrete_actor->senders = 10000;
#endif
    concrete_actor->first = -1;
    concrete_actor->last = -1;
    concrete_actor->step = RING_STEP_RECEIVE_SPAWNERS;
    concrete_actor->ready_rings = 0;
    concrete_actor->ready_senders = 0;

    core_vector_init(&concrete_actor->spawners, sizeof(int));

    thorium_actor_add_script(actor, SCRIPT_SENDER, &sender_script);

    core_vector_init(&concrete_actor->spawners, 0);
}
Exemplo n.º 3
0
void biosal_input_controller_init(struct thorium_actor *actor)
{
    struct biosal_input_controller *concrete_actor;

    concrete_actor = (struct biosal_input_controller *)thorium_actor_concrete_actor(actor);

    core_map_init(&concrete_actor->mega_blocks, sizeof(int), sizeof(struct core_vector));
    core_map_init(&concrete_actor->assigned_blocks, sizeof(int), sizeof(int));
    core_vector_init(&concrete_actor->mega_block_vector, sizeof(struct biosal_mega_block));

    core_vector_init(&concrete_actor->counting_streams, sizeof(int));
    core_vector_init(&concrete_actor->reading_streams, sizeof(int));
    core_vector_init(&concrete_actor->partition_commands, sizeof(int));
    core_vector_init(&concrete_actor->stream_consumers, sizeof(int));
    core_vector_init(&concrete_actor->consumer_active_requests, sizeof(int));
    core_vector_init(&concrete_actor->files, sizeof(char *));
    core_vector_init(&concrete_actor->spawners, sizeof(int));
    core_vector_init(&concrete_actor->counts, sizeof(int64_t));
    core_vector_init(&concrete_actor->consumers, sizeof(int));
    core_vector_init(&concrete_actor->stores_per_spawner, sizeof(int));

    core_timer_init(&concrete_actor->input_timer);
    core_timer_init(&concrete_actor->counting_timer);
    core_timer_init(&concrete_actor->distribution_timer);

    biosal_dna_codec_init(&concrete_actor->codec);

    if (biosal_dna_codec_must_use_two_bit_encoding(&concrete_actor->codec,
                            thorium_actor_get_node_count(actor))) {
        biosal_dna_codec_enable_two_bit_encoding(&concrete_actor->codec);
    }

    core_queue_init(&concrete_actor->unprepared_spawners, sizeof(int));

    concrete_actor->opened_streams = 0;
    concrete_actor->state = BIOSAL_INPUT_CONTROLLER_STATE_NONE;

#ifdef BIOSAL_INPUT_CONTROLLER_DEBUG_10355
    printf("DEBUG actor %d register ACTION_INPUT_CONTROLLER_CREATE_STORES\n",
                    thorium_actor_name(actor));
#endif

    thorium_actor_add_action(actor, ACTION_INPUT_CONTROLLER_CREATE_STORES,
                    biosal_input_controller_create_stores);
    thorium_actor_add_action(actor, ACTION_GET_NODE_NAME_REPLY,
                    biosal_input_controller_get_node_name_reply);
    thorium_actor_add_action(actor, ACTION_GET_NODE_WORKER_COUNT_REPLY,
                    biosal_input_controller_get_node_worker_count_reply);

    thorium_actor_add_action(actor, ACTION_INPUT_CONTROLLER_PREPARE_SPAWNERS,
                    biosal_input_controller_prepare_spawners);
    thorium_actor_add_action(actor, ACTION_INPUT_CONTROLLER_SPAWN_READING_STREAMS,
                    biosal_input_controller_spawn_streams);

    thorium_actor_add_action(actor, ACTION_INPUT_STREAM_SET_START_OFFSET_REPLY,
                    biosal_input_controller_set_offset_reply);
    thorium_actor_add_script(actor, SCRIPT_INPUT_STREAM, &biosal_input_stream_script);
    thorium_actor_add_script(actor, SCRIPT_SEQUENCE_STORE, &biosal_sequence_store_script);
    thorium_actor_add_script(actor, SCRIPT_SEQUENCE_PARTITIONER,
                    &biosal_sequence_partitioner_script);

    /* configuration for the input controller
     * other values for block size: 512, 1024, 2048, 4096, 8192 * /
     */
    concrete_actor->block_size = 4096;
    concrete_actor->stores_per_worker_per_spawner = 0;

#ifdef BIOSAL_INPUT_CONTROLLER_DEBUG
    printf("DEBUG %d init controller\n",
                    thorium_actor_name(actor));
#endif

    concrete_actor->ready_spawners = 0;
    concrete_actor->ready_consumers = 0;
    concrete_actor->partitioner = THORIUM_ACTOR_NOBODY;
    concrete_actor->filled_consumers = 0;

    concrete_actor->counted = 0;
}
Exemplo n.º 4
0
void spate_init(struct thorium_actor *self)
{
    struct spate *concrete_self;

    concrete_self = (struct spate *)thorium_actor_concrete_actor(self);
    core_vector_init(&concrete_self->initial_actors, sizeof(int));
    core_vector_init(&concrete_self->sequence_stores, sizeof(int));
    core_vector_init(&concrete_self->graph_stores, sizeof(int));

    concrete_self->is_leader = 0;

    concrete_self->input_controller = THORIUM_ACTOR_NOBODY;
    concrete_self->manager_for_sequence_stores = THORIUM_ACTOR_NOBODY;
    concrete_self->assembly_graph = THORIUM_ACTOR_NOBODY;
    concrete_self->assembly_graph_builder = THORIUM_ACTOR_NOBODY;

    core_timer_init(&concrete_self->timer);

    thorium_actor_add_action(self,
                    ACTION_START, spate_start);
    thorium_actor_add_action(self,
                    ACTION_ASK_TO_STOP, spate_ask_to_stop);
    thorium_actor_add_action(self,
                    ACTION_SPAWN_REPLY, spate_spawn_reply);
    thorium_actor_add_action(self,
                    ACTION_MANAGER_SET_SCRIPT_REPLY, spate_set_script_reply);
    thorium_actor_add_action(self,
                    ACTION_SET_CONSUMERS_REPLY, spate_set_consumers_reply);
    thorium_actor_add_action(self,
                    ACTION_SET_BLOCK_SIZE_REPLY, spate_set_block_size_reply);
    thorium_actor_add_action(self,
                    ACTION_INPUT_DISTRIBUTE_REPLY, spate_distribute_reply);
    thorium_actor_add_action(self,
                    ACTION_SPATE_ADD_FILES, spate_add_files);
    thorium_actor_add_action(self,
                    ACTION_SPATE_ADD_FILES_REPLY, spate_add_files_reply);
    thorium_actor_add_action(self,
                    ACTION_ADD_FILE_REPLY, spate_add_file_reply);

    thorium_actor_add_action(self,
                    ACTION_START_REPLY, spate_start_reply);

    /*
     * Register required actor scripts now
     */

    thorium_actor_add_script(self, SCRIPT_INPUT_CONTROLLER,
                    &biosal_input_controller_script);
    thorium_actor_add_script(self, SCRIPT_DNA_KMER_COUNTER_KERNEL,
                    &biosal_dna_kmer_counter_kernel_script);
    thorium_actor_add_script(self, SCRIPT_MANAGER,
                    &core_manager_script);
    thorium_actor_add_script(self, SCRIPT_WRITER_PROCESS,
                    &core_writer_process_script);
    thorium_actor_add_script(self, SCRIPT_AGGREGATOR,
                    &biosal_aggregator_script);
    thorium_actor_add_script(self, SCRIPT_KMER_STORE,
                    &biosal_kmer_store_script);
    thorium_actor_add_script(self, SCRIPT_SEQUENCE_STORE,
                    &biosal_sequence_store_script);
    thorium_actor_add_script(self, SCRIPT_COVERAGE_DISTRIBUTION,
                    &biosal_coverage_distribution_script);
    thorium_actor_add_script(self, SCRIPT_ASSEMBLY_GRAPH_BUILDER,
                    &biosal_assembly_graph_builder_script);

    thorium_actor_add_script(self, SCRIPT_ASSEMBLY_GRAPH_STORE,
                    &biosal_assembly_graph_store_script);
    thorium_actor_add_script(self, SCRIPT_ASSEMBLY_SLIDING_WINDOW,
                    &biosal_assembly_sliding_window_script);
    thorium_actor_add_script(self, SCRIPT_ASSEMBLY_BLOCK_CLASSIFIER,
                    &biosal_assembly_block_classifier_script);
    thorium_actor_add_script(self, SCRIPT_COVERAGE_DISTRIBUTION,
                    &biosal_coverage_distribution_script);

    thorium_actor_add_script(self, SCRIPT_ASSEMBLY_ARC_KERNEL,
                    &biosal_assembly_arc_kernel_script);
    thorium_actor_add_script(self, SCRIPT_ASSEMBLY_ARC_CLASSIFIER,
                    &biosal_assembly_arc_classifier_script);
    thorium_actor_add_script(self, SCRIPT_UNITIG_WALKER,
                    &biosal_unitig_walker_script);
    thorium_actor_add_script(self, SCRIPT_UNITIG_VISITOR,
                    &biosal_unitig_visitor_script);
    thorium_actor_add_script(self, SCRIPT_UNITIG_MANAGER,
                    &biosal_unitig_manager_script);

    /*
     * This is the I/O controller block size.
     * This is a number of sequences.
     */
    concrete_self->block_size = 16 * 4096;

    concrete_self->file_index = 0;
}