X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/194df46818e3f10278130de231015fb42a6b29f7..28e032fe2974bf84e0414e4d3d4cd89a38752dae:/src/msg/msg_gos.c diff --git a/src/msg/msg_gos.c b/src/msg/msg_gos.c index 73c91df534..4aa46346da 100644 --- a/src/msg/msg_gos.c +++ b/src/msg/msg_gos.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2004-2014. The SimGrid Team. +/* Copyright (c) 2004-2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -52,9 +52,7 @@ msg_error_t MSG_parallel_task_execute(msg_task_t task) e_smx_state_t comp_state; msg_error_t status = MSG_OK; -#ifdef HAVE_TRACING TRACE_msg_task_execute_start(task); -#endif xbt_assert((!simdata->compute) && (task->simdata->isused == 0), "This task is executed somewhere else. Go fix your code! %d", @@ -62,10 +60,8 @@ msg_error_t MSG_parallel_task_execute(msg_task_t task) XBT_DEBUG("Computing on %s", MSG_process_get_name(MSG_process_self())); - if (simdata->computation_amount == 0 && !simdata->host_nb) { -#ifdef HAVE_TRACING + if (simdata->flops_amount == 0 && !simdata->host_nb) { TRACE_msg_task_execute_end(task); -#endif return MSG_OK; } @@ -80,8 +76,8 @@ msg_error_t MSG_parallel_task_execute(msg_task_t task) simdata->compute = simcall_host_parallel_execute(task->name, simdata->host_nb, simdata->host_list, - simdata->comp_amount, - simdata->comm_amount, + simdata->flops_parallel_amount, + simdata->bytes_parallel_amount, 1.0, -1.0); XBT_DEBUG("Parallel execution action created: %p", simdata->compute); } else { @@ -90,16 +86,14 @@ msg_error_t MSG_parallel_task_execute(msg_task_t task) simdata->compute = simcall_host_execute(task->name, p_simdata->m_host, - simdata->computation_amount, + simdata->flops_amount, simdata->priority, simdata->bound, affinity_mask ); } -#ifdef HAVE_TRACING simcall_set_category(simdata->compute, task->category); -#endif p_simdata->waiting_action = simdata->compute; comp_state = simcall_host_execution_wait(simdata->compute); @@ -127,12 +121,10 @@ msg_error_t MSG_parallel_task_execute(msg_task_t task) } /* action ended, set comm and compute = NULL, the actions is already destroyed * in the main function */ - simdata->computation_amount = 0.0; + simdata->flops_amount = 0.0; simdata->comm = NULL; simdata->compute = NULL; -#ifdef HAVE_TRACING TRACE_msg_task_execute_end(task); -#endif MSG_RETURN(status); } @@ -151,17 +143,7 @@ msg_error_t MSG_process_sleep(double nb_sec) msg_error_t status = MSG_OK; /*msg_process_t proc = MSG_process_self();*/ -#ifdef HAVE_TRACING TRACE_msg_process_sleep_in(MSG_process_self()); -#endif - - /* create action to sleep */ - - /*proc->simdata->waiting_action = act_sleep; - - FIXME: check if not setting the waiting_action breaks something on msg - - proc->simdata->waiting_action = NULL;*/ TRY { simcall_process_sleep(nb_sec); @@ -184,9 +166,7 @@ msg_error_t MSG_process_sleep(double nb_sec) xbt_ex_free(e); } - #ifdef HAVE_TRACING - TRACE_msg_process_sleep_out(MSG_process_self()); - #endif + TRACE_msg_process_sleep_out(MSG_process_self()); MSG_RETURN(status); } @@ -358,6 +338,9 @@ MSG_task_receive_ext(msg_task_t * task, const char *alias, double timeout, } CATCH(e) { switch (e.category) { + case host_error: + ret = MSG_HOST_FAILURE; + break; case cancel_error: /* may be thrown by MSG_mailbox_get_by_alias */ ret = MSG_HOST_FAILURE; break; @@ -399,17 +382,14 @@ MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, double timeou */ static XBT_INLINE msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *alias, - int (*match_fun)(void*,void*, smx_action_t), + int (*match_fun)(void*,void*, smx_synchro_t), void *match_data, void_f_pvoid_t cleanup, int detached) { simdata_task_t t_simdata = NULL; msg_process_t process = MSG_process_self(); msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias); - -#ifdef HAVE_TRACING int call_end = TRACE_msg_task_put_start(task); -#endif /* Prepare the task to send */ t_simdata = task->simdata; @@ -436,7 +416,7 @@ msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *alias, msg_global->sent_msg++; /* Send it by calling SIMIX network layer */ - smx_action_t act = simcall_comm_isend(SIMIX_process_self(), mailbox, t_simdata->message_size, + smx_synchro_t act = simcall_comm_isend(SIMIX_process_self(), mailbox, t_simdata->bytes_amount, t_simdata->rate, task, sizeof(void *), match_fun, cleanup, NULL, match_data,detached); t_simdata->comm = act; /* FIXME: is the field t_simdata->comm still useful? */ @@ -452,14 +432,10 @@ msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *alias, comm->s_comm = act; } -#ifdef HAVE_TRACING - if (TRACE_is_enabled()) { + if (TRACE_is_enabled()) simcall_set_category(act, task->category); - } - if (call_end) TRACE_msg_task_put_end(); -#endif return comm; } @@ -511,13 +487,13 @@ msg_comm_t MSG_task_isend_bounded(msg_task_t task, const char *alias, * \param match_fun boolean function which parameters are: * - match_data_provided_here * - match_data_provided_by_other_side_if_any - * - the_smx_action_describing_the_other_side + * - the_smx_synchro_describing_the_other_side * \param match_data user provided data passed to match_fun * \return the msg_comm_t communication created */ msg_comm_t MSG_task_isend_with_matching(msg_task_t task, const char *alias, int (*match_fun)(void*, void*, - smx_action_t), + smx_synchro_t), void *match_data) { return MSG_task_isend_internal(task, alias, match_fun, match_data, NULL, 0); @@ -676,7 +652,7 @@ int MSG_comm_testany(xbt_dynar_t comms) int finished_index = -1; /* create the equivalent dynar with SIMIX objects */ - xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_action_t), NULL); + xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_synchro_t), NULL); msg_comm_t comm; unsigned int cursor; xbt_dynar_foreach(comms, cursor, comm) { @@ -799,7 +775,7 @@ int MSG_comm_waitany(xbt_dynar_t comms) int finished_index = -1; /* create the equivalent dynar with SIMIX objects */ - xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_action_t), NULL); + xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_synchro_t), NULL); msg_comm_t comm; unsigned int cursor; xbt_dynar_foreach(comms, cursor, comm) { @@ -876,7 +852,7 @@ msg_task_t MSG_comm_get_task(msg_comm_t comm) * \param buff the data copied * \param buff_size size of the buffer */ -void MSG_comm_copy_data_from_SIMIX(smx_action_t comm, void* buff, size_t buff_size) { +void MSG_comm_copy_data_from_SIMIX(smx_synchro_t comm, void* buff, size_t buff_size) { // copy the task SIMIX_comm_copy_pointer_callback(comm, buff, buff_size); @@ -1043,9 +1019,7 @@ int MSG_task_listen_from(const char *alias) */ void MSG_task_set_category (msg_task_t task, const char *category) { -#ifdef HAVE_TRACING TRACE_msg_set_task_category (task, category); -#endif } /** \ingroup msg_task_usage @@ -1060,11 +1034,7 @@ void MSG_task_set_category (msg_task_t task, const char *category) */ const char *MSG_task_get_category (msg_task_t task) { -#ifdef HAVE_TRACING return task->category; -#else - return NULL; -#endif } /**