Exemplo n.º 1
0
static void send_mrsg_data (msg_task_t msg)
{
    char         mailbox[MAILBOX_ALIAS_SIZE];
    double       data_size;
    size_t       my_id;
    mrsg_task_info_t  ti;

    my_id = get_mrsg_worker_id (MSG_host_self ());

    sprintf (mailbox, TASK_MRSG_MAILBOX,
	    get_mrsg_worker_id (MSG_task_get_source (msg)),
	    MSG_process_get_PID (MSG_task_get_sender (msg)));

    if (mrsg_message_is (msg, SMS_GET_MRSG_CHUNK))
    {
	MSG_task_dsend (MSG_task_create ("DATA-C", 0.0, config_mrsg.mrsg_chunk_size, NULL), mailbox, NULL);
    }
    else if (mrsg_message_is (msg, SMS_GET_INTER_MRSG_PAIRS))
    {
	ti = (mrsg_task_info_t) MSG_task_get_data (msg);
	data_size = job_mrsg.map_output[my_id][ti->mrsg_tid] - ti->map_output_copied[my_id];
	MSG_task_dsend (MSG_task_create ("DATA-IP", 0.0, data_size, NULL), mailbox, NULL);
    }

    MSG_task_destroy (msg);
}
Exemplo n.º 2
0
int data_node_mrsg (int argc, char* argv[])
{
    char         mailbox[MAILBOX_ALIAS_SIZE];
    msg_error_t  status;
    msg_task_t   msg = NULL;

    sprintf (mailbox, DATANODE_MRSG_MAILBOX, get_mrsg_worker_id (MSG_host_self ()));

    while (!job_mrsg.finished)
    {
	msg = NULL;
	status = receive (&msg, mailbox);
	if (status == MSG_OK)
	{
	    if (mrsg_message_is (msg, SMS_FINISH_MRSG))
	    {
		MSG_task_destroy (msg);
		break;
	    }
	    else
	    {
		send_mrsg_data (msg);
	    }
	}
    }

    return 0;
}
Exemplo n.º 3
0
msg_error_t send (const char* str, double cpu, double net, void* data, const char* mailbox)
{
    msg_error_t  status;
    msg_task_t   msg = NULL;

    msg = MSG_task_create (str, cpu, net, data);

#ifdef VERBOSE
    if (!mrsg_message_is (msg, SMS_HEARTBEAT_MRSG))
	    XBT_INFO ("TX (%s): %s", mailbox, str);
#endif

    status = MSG_task_send (msg, mailbox);

#ifdef VERBOSE
    if (status != MSG_OK)
	XBT_INFO ("ERROR %d MRSG_SENDING MESSAGE: %s", status, str);
#endif

    return status;
}