xbt_dynar_t isends; /* of msg_comm_t */
/* Used to implement irecv+wait */
xbt_dynar_t irecvs; /* of msg_comm_t */
- xbt_dynar_t tasks; /* of m_task_t */
+ xbt_dynar_t tasks; /* of msg_task_t */
} s_process_globals_t, *process_globals_t;
/* Helper function */
{
char *name = NULL;
char mailbox_name[250];
- m_task_t task = NULL;
+ msg_task_t task = NULL;
double clock = MSG_get_clock();
sprintf(mailbox_name, "%s_%s", action[2],
sprintf(mailbox, "%s_%s", action[2],
MSG_process_get_name(MSG_process_self()));
- m_task_t t=NULL;
+ msg_task_t t=NULL;
xbt_dynar_push(globals->tasks,&t);
msg_comm_t c =
MSG_task_irecv(
static void action_wait(const char *const *action)
{
char *name = NULL;
- m_task_t task = NULL;
+ msg_task_t task = NULL;
msg_comm_t comm;
double clock = MSG_get_clock();
process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
XBT_DEBUG("Entering %s", name);
comm = xbt_dynar_pop_as(globals->irecvs,msg_comm_t);
MSG_comm_wait(comm,-1);
- task = xbt_dynar_pop_as(globals->tasks,m_task_t);
+ task = xbt_dynar_pop_as(globals->tasks,msg_task_t);
MSG_comm_destroy(comm);
MSG_task_destroy(task);
char mailbox[80];
double comm_size = parse_double(action[2]);
double comp_size = parse_double(action[3]);
- m_task_t comp_task = NULL;
+ msg_task_t comp_task = NULL;
const char *process_name;
double clock = MSG_get_clock();
XBT_DEBUG("%s: %s is the Root", reduce_identifier, process_name);
msg_comm_t *comms = xbt_new0(msg_comm_t,communicator_size-1);
- m_task_t *tasks = xbt_new0(m_task_t,communicator_size-1);
+ msg_task_t *tasks = xbt_new0(msg_task_t,communicator_size-1);
for (i = 1; i < communicator_size; i++) {
sprintf(mailbox, "%s_p%d_p0", reduce_identifier, i);
comms[i-1] = MSG_task_irecv(&(tasks[i-1]),mailbox);
char *bcast_identifier;
char mailbox[80];
double comm_size = parse_double(action[2]);
- m_task_t task = NULL;
+ msg_task_t task = NULL;
const char *process_name;
double clock = MSG_get_clock();
char mailbox[80];
double comm_size = parse_double(action[2]);
double comp_size = parse_double(action[3]);
- m_task_t task = NULL, comp_task = NULL;
+ msg_task_t task = NULL, comp_task = NULL;
const char *process_name;
double clock = MSG_get_clock();
XBT_DEBUG("%s: %s is the Root", allreduce_identifier, process_name);
msg_comm_t *comms = xbt_new0(msg_comm_t,communicator_size-1);
- m_task_t *tasks = xbt_new0(m_task_t,communicator_size-1);
+ msg_task_t *tasks = xbt_new0(msg_task_t,communicator_size-1);
for (i = 1; i < communicator_size; i++) {
sprintf(mailbox, "%s_p%d_p0", allreduce_identifier, i);
comms[i-1] = MSG_task_irecv(&(tasks[i-1]),mailbox);
{
char *name = NULL;
const char *amout = action[2];
- m_task_t task = MSG_task_create(name, parse_double(amout), 0, NULL);
+ msg_task_t task = MSG_task_create(name, parse_double(amout), 0, NULL);
double clock = MSG_get_clock();
if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
process_globals_t globals = (process_globals_t) calloc(1, sizeof(s_process_globals_t));
globals->isends = xbt_dynar_new(sizeof(msg_comm_t),NULL);
globals->irecvs = xbt_dynar_new(sizeof(msg_comm_t),NULL);
- globals->tasks = xbt_dynar_new(sizeof(m_task_t),NULL);
+ globals->tasks = xbt_dynar_new(sizeof(msg_task_t),NULL);
MSG_process_set_data(MSG_process_self(),globals);
}
// process functions
static int node(int argc, char *argv[]);
-static void handle_task(node_t node, m_task_t task);
+static void handle_task(node_t node, msg_task_t task);
// Chord core
static void create(node_t node);
}
double init_time = MSG_get_clock();
- m_task_t task_received = NULL;
+ msg_task_t task_received = NULL;
int i;
int join_success = 0;
double deadline;
* \param task the task to handle (don't touch it then:
* it will be destroyed, reused or forwarded)
*/
-static void handle_task(node_t node, m_task_t task) {
+static void handle_task(node_t node, msg_task_t task) {
XBT_DEBUG("Handling task %p", task);
char mailbox[MAILBOX_NAME_SIZE];
node->pred_id, to_mailbox);
req_data->type = TASK_SUCCESSOR_LEAVING;
}
- m_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+ msg_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
//char* mailbox = get_mailbox(to_mailbox);
msg_comm_t comm = MSG_task_isend(task, to_mailbox);
xbt_dynar_push(node->comms, &comm);
req_data->issuer_host_name = MSG_host_get_name(MSG_host_self());
// send a "Find Successor" request to ask_to_id
- m_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+ msg_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
XBT_DEBUG("Sending a 'Find Successor' request (task %p) to %d for id %d", task_sent, ask_to, id);
MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
do {
if (node->comm_receive == NULL) {
- m_task_t task_received = NULL;
+ msg_task_t task_received = NULL;
node->comm_receive = MSG_task_irecv(&task_received, node->mailbox);
}
node->comm_receive = NULL;
}
else {
- m_task_t task_received = MSG_comm_get_task(node->comm_receive);
+ msg_task_t task_received = MSG_comm_get_task(node->comm_receive);
XBT_DEBUG("Received a task (%p)", task_received);
task_data_t ans_data = MSG_task_get_data(task_received);
// send a "Get Predecessor" request to ask_to_id
XBT_DEBUG("Sending a 'Get Predecessor' request to %d", ask_to);
- m_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+ msg_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
if (res != MSG_OK) {
do {
if (node->comm_receive == NULL) { // FIXME simplify this
- m_task_t task_received = NULL;
+ msg_task_t task_received = NULL;
node->comm_receive = MSG_task_irecv(&task_received, node->mailbox);
}
node->comm_receive = NULL;
}
else {
- m_task_t task_received = MSG_comm_get_task(node->comm_receive);
+ msg_task_t task_received = MSG_comm_get_task(node->comm_receive);
task_data_t ans_data = MSG_task_get_data(task_received);
if (MC_IS_ENABLED) {
req_data->issuer_host_name = MSG_host_get_name(MSG_host_self());
// send a "Notify" request to notify_id
- m_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+ msg_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
XBT_DEBUG("Sending a 'Notify' request (task %p) to %d", task, notify_id);
char mailbox[MAILBOX_NAME_SIZE];
get_mailbox(notify_id, mailbox);
for (i = 0; i < slaves_count; i++) {
char mailbox_buffer[64];
sprintf(mailbox_buffer,"Slave_%d",i);
- m_task_t finalize = MSG_task_create("finalize", 0, 0, 0);
+ msg_task_t finalize = MSG_task_create("finalize", 0, 0, 0);
MSG_task_send(finalize, mailbox_buffer);
}
int slave_fun(int argc, char *argv[])
{
char *mailbox_name;
- m_task_t task = NULL;
+ msg_task_t task = NULL;
_XBT_GNUC_UNUSED int res;
/* since the slaves will move around, use slave_%d as mailbox names instead of hostnames */
int bool_printed = 0;
double start_time, end_time, elapsed_time;
double gl_data_size[NTASKS];
-m_task_t gl_task_array[NTASKS];
+msg_task_t gl_task_array[NTASKS];
const char *slavenames[NTASKS];
const char *masternames[NTASKS];
int gl_task_array_id = 0;
{
char *slavename = NULL;
double task_comm_size = 0;
- m_task_t todo;
+ msg_task_t todo;
char id_alias[10];
//unique id to control statistics
int id = -1;
int slave(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
int a;
int id = 0;
#ifdef HAVE_LATENCY_BOUND_TRACKING
msg_comm_t comm = NULL;
int i;
- m_task_t task = NULL;
+ msg_task_t task = NULL;
MSG_process_sleep(sleep_start_time);
for (i = 0; i < number_of_tasks; i++) {
char mailbox[256];
/** Receiver function */
int receiver(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
_XBT_GNUC_UNUSED MSG_error_t res;
int id = -1;
char mailbox[80];
msg_comm_t *comm = xbt_new(msg_comm_t, number_of_tasks + receivers_count);
int i;
- m_task_t task = NULL;
+ msg_task_t task = NULL;
for (i = 0; i < number_of_tasks; i++) {
char mailbox[256];
char sprintf_buffer[256];
/** Receiver function */
int receiver(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
_XBT_GNUC_UNUSED MSG_error_t res;
int id = -1;
char mailbox[80];
double coef = 0;
xbt_dynar_t d = xbt_dynar_new(sizeof(msg_comm_t), NULL);
int i;
- m_task_t task;
+ msg_task_t task;
char mailbox[256];
char sprintf_buffer[256];
msg_comm_t comm;
char mailbox[80];
xbt_dynar_t comms = xbt_dynar_new(sizeof(msg_comm_t), NULL);
int tasks = atof(argv[2]);
- m_task_t *task = xbt_new(m_task_t, tasks);
+ msg_task_t *task = xbt_new(msg_task_t, tasks);
_XBT_GNUC_UNUSED int read;
read = sscanf(argv[1], "%d", &id);
}
/* Here we are waiting for the receiving of all communications */
- m_task_t task_com;
+ msg_task_t task_com;
while (!xbt_dynar_is_empty(comms)) {
_XBT_GNUC_UNUSED MSG_error_t err;
xbt_dynar_remove_at(comms, MSG_comm_waitany(comms), &res_irecv);
for (i = 1; i <= number_of_jobs; i++) {
char mailbox[256];
char sprintf_buffer[256];
- m_task_t task = NULL;
+ msg_task_t task = NULL;
sprintf(mailbox, "slave-%ld", i % number_of_slaves);
sprintf(sprintf_buffer, "Task_%d", i);
char mailbox[80];
sprintf(mailbox, "slave-%ld", i % number_of_slaves);
- m_task_t finalize = MSG_task_create("finalize", 0, 0, 0);
+ msg_task_t finalize = MSG_task_create("finalize", 0, 0, 0);
MSG_task_send(finalize, mailbox);
}
/** Receiver function */
int slave(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
_XBT_GNUC_UNUSED int res;
XBT_DEBUG("mailbox: %s",MSG_process_get_name(MSG_process_self()));
{
int slaves_count = 0;
msg_host_t *slaves = NULL;
- m_task_t *todo = NULL;
+ msg_task_t *todo = NULL;
int number_of_tasks = 0;
double task_comp_size = 0;
double task_comm_size = 0;
{ /* Task creation */
char sprintf_buffer[64];
- todo = xbt_new0(m_task_t, number_of_tasks);
+ todo = xbt_new0(msg_task_t, number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
sprintf(sprintf_buffer, "Task_%d", i);
{
XBT_INFO("I'm a slave");
while (1) {
- m_task_t task = NULL;
+ msg_task_t task = NULL;
int a;
a = MSG_task_receive(&task, MSG_host_get_name(MSG_host_self()));
if (a == MSG_OK) {
{
int slaves_count = 0;
msg_host_t *slaves = NULL;
- m_task_t *todo = NULL;
+ msg_task_t *todo = NULL;
int number_of_tasks = 0;
double task_comp_size = 0;
double task_comm_size = 0;
{ /* Task creation */
char sprintf_buffer[64];
- todo = xbt_new0(m_task_t, number_of_tasks);
+ todo = xbt_new0(msg_task_t, number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
sprintf(sprintf_buffer, "Task_%d", i);
{
XBT_INFO("I'm a slave");
while (1) {
- m_task_t task = NULL;
+ msg_task_t task = NULL;
int a;
a = MSG_task_receive(&(task), MSG_host_get_name(MSG_host_self()));
if (a == MSG_OK) {
for (i = 0; i < number_of_tasks; i++) {
char mailbox[256];
char sprintf_buffer[256];
- m_task_t task = NULL;
+ msg_task_t task = NULL;
sprintf(mailbox, "slave-%ld", i % slaves_count);
sprintf(sprintf_buffer, "Task_%d", i);
char mailbox[80];
sprintf(mailbox, "slave-%ld", i % slaves_count);
- m_task_t finalize = MSG_task_create("finalize", 0, 0, 0);
+ msg_task_t finalize = MSG_task_create("finalize", 0, 0, 0);
MSG_task_send(finalize, mailbox);
}
/** Receiver function */
int slave(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
_XBT_GNUC_UNUSED int res;
int id = -1;
char mailbox[80];
XBT_INFO("Got %d task to process :", number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
- m_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size,
+ msg_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size,
xbt_new0(double, 1));
int a;
*((double *) task->data) = MSG_get_clock();
XBT_INFO
("All tasks have been dispatched. Let's tell everybody the computation is over.");
for (i = 0; i < slaves_count; i++) {
- m_task_t task = MSG_task_create("finalize", 0, 0, FINALIZE);
+ msg_task_t task = MSG_task_create("finalize", 0, 0, FINALIZE);
int a = MSG_task_send_with_timeout(task,MSG_host_get_name(slaves[i]),1.0);
if (a == MSG_OK)
continue;
int slave(int argc, char *argv[])
{
while (1) {
- m_task_t task = NULL;
+ msg_task_t task = NULL;
int a;
double time1, time2;
{
int slaves_count = 0;
msg_host_t *slaves = NULL;
- m_task_t *todo = NULL;
+ msg_task_t *todo = NULL;
int number_of_tasks = 0;
double task_comp_size = 0;
double task_comm_size = 0;
{ /* Task creation */
char sprintf_buffer[64];
- todo = xbt_new0(m_task_t, number_of_tasks);
+ todo = xbt_new0(msg_task_t, number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
sprintf(sprintf_buffer, "Task_%d", i);
XBT_INFO
("All tasks have been dispatched. Let's tell everybody the computation is over.");
for (i = 0; i < slaves_count; i++) {
- m_task_t finalize = MSG_task_create("finalize", 0, 0, FINALIZE);
+ msg_task_t finalize = MSG_task_create("finalize", 0, 0, FINALIZE);
MSG_task_send(finalize, MSG_host_get_name(slaves[i]));
}
/** Receiver function */
int slave(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
_XBT_GNUC_UNUSED int res;
while (1) {
res = MSG_task_receive(&(task),MSG_host_get_name(MSG_host_self()));
i = 0;
while (1) {
- m_task_t task = NULL;
+ msg_task_t task = NULL;
int a;
a = MSG_task_receive(&(task),MSG_host_get_name(MSG_host_self()));
if (a == MSG_OK) {
for (i = 0; i < number_of_tasks; i++) {
char mailbox[256];
char sprintf_buffer[256];
- m_task_t task = NULL;
+ msg_task_t task = NULL;
sprintf(mailbox, "slave-%ld", i % slaves_count);
sprintf(sprintf_buffer, "Task_%d", i);
char mailbox[80];
sprintf(mailbox, "slave-%ld", i % slaves_count);
- m_task_t finalize = MSG_task_create("finalize", 0, 0, 0);
+ msg_task_t finalize = MSG_task_create("finalize", 0, 0, 0);
MSG_task_send(finalize, mailbox);
}
/** Receiver function */
int slave(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
_XBT_GNUC_UNUSED int res;
int id = -1;
char mailbox[80];
/** The guy we will move from host to host. It move alone and then is moved by policeman back */
static int emigrant(int argc, char *argv[])
{
- m_task_t task;
+ msg_task_t task;
XBT_INFO
("I'll look for a new job on another machine where the grass is greener.");
MSG_process_migrate(MSG_process_self(), MSG_get_host_by_name("Boivin"));
int bool_printed = 0;
double start_time, end_time, elapsed_time;
double gl_data_size[NTASKS];
-m_task_t gl_task_array[NTASKS];
+msg_task_t gl_task_array[NTASKS];
const char *slavenames[NTASKS];
const char *masternames[NTASKS];
int gl_task_array_id = 0;
{
char *slavename = NULL;
double task_comm_size = 0;
- m_task_t todo;
+ msg_task_t todo;
char id_alias[10];
//unique id to control statistics
int id = -1;
int slave(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
int a = MSG_OK;
int id = 0;
char id_alias[10];
double task_comm_size = 10000;
double *computation_amount = NULL;
double *communication_amount = NULL;
- m_task_t ptask = NULL;
+ msg_task_t ptask = NULL;
int i, j;
slaves_dynar = MSG_hosts_as_dynar();
char buffer[32];
int i, j;
msg_host_t *m_host_list = NULL;
- m_task_t task = NULL;
+ msg_task_t task = NULL;
int host_list_size;
double *computation_duration = NULL;
double *communication_table = NULL;
char buffer[32];
int i, j;
msg_host_t *m_host_list = NULL;
- m_task_t task = NULL;
+ msg_task_t task = NULL;
int host_list_size;
double *computation_duration = NULL;
double *communication_table = NULL;
/* The rest: return the result to node 0 */
}else{
- m_task_t task;
+ msg_task_t task;
XBT_VERB("Multiplication done. Send the sub-result.");
{
int node;
char node_mbox[MAILBOX_NAME_SIZE];
- m_task_t task;
+ msg_task_t task;
msg_comm_t comms[GRID_NUM_NODES - 1] = {0};
XBT_VERB("Broadcast Jobs");
static node_job_t wait_job(int selfid)
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
char self_mbox[MAILBOX_NAME_SIZE];
node_job_t job;
snprintf(self_mbox, MAILBOX_NAME_SIZE - 1, "%d", selfid);
{
int node;
char node_mbox[MAILBOX_NAME_SIZE];
- m_task_t task;
+ msg_task_t task;
xbt_matrix_t sM;
for(node=0; node < num_nodes; node++){
static void get_sub_matrix(xbt_matrix_t *sM, int selfid)
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
char node_mbox[MAILBOX_NAME_SIZE];
XBT_VERB("Get sub-matrix");
}
static void task_cleanup(void *arg){
- m_task_t task = (m_task_t)arg;
+ msg_task_t task = (msg_task_t)arg;
xbt_matrix_t m = (xbt_matrix_t)MSG_task_get_data(task);
xbt_matrix_free(m);
MSG_task_destroy(task);
static void receive_results(result_t *results){
int node;
msg_comm_t comms[GRID_NUM_NODES-1] = {0};
- m_task_t tasks[GRID_NUM_NODES-1] = {0};
+ msg_task_t tasks[GRID_NUM_NODES-1] = {0};
XBT_VERB("Receive Results.");
{
double computation_amount = 0.0;
double priority = 1.0;
- m_task_t task = NULL;
+ msg_task_t task = NULL;
_XBT_GNUC_UNUSED int res = sscanf(argv[1], "%lg", &computation_amount);
xbt_assert(res, "Invalid argument %s\n", argv[1]);
{
msg_host_t host = NULL;
double time;
- m_task_t task_la = NULL;
- m_task_t task_bw = NULL;
+ msg_task_t task_la = NULL;
+ msg_task_t task_bw = NULL;
char sprintf_buffer_la[64];
char sprintf_buffer_bw[64];
int receiver(int argc, char *argv[])
{
double time, time1, sender_time;
- m_task_t task_la = NULL;
- m_task_t task_bw = NULL;
+ msg_task_t task_la = NULL;
+ msg_task_t task_bw = NULL;
int a;
double communication_time = 0;
{
int host_number = atoi(MSG_process_get_name(MSG_process_self()));
char mailbox[256];
- m_task_t task = NULL;
+ msg_task_t task = NULL;
_XBT_GNUC_UNUSED int res;
if (host_number == 0){ //master send then receive
sprintf(mailbox, "%d", host_number+1);
int i;
for (i = 0; i < number_of_tasks; i++) {
- m_task_t task = NULL;
+ msg_task_t task = NULL;
//creating task and setting its category
if (i % 2) {
}
for (i = 0; i < slaves_count; i++) {
- m_task_t finalize = MSG_task_create("finalize", 0, 1000, 0);
+ msg_task_t finalize = MSG_task_create("finalize", 0, 1000, 0);
MSG_task_set_category(finalize, "finalize");
MSG_task_send(finalize, "master_mailbox");
}
/** Receiver function */
int slave(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
while (1) {
MSG_task_receive(&(task), "master_mailbox");
//dump function to create and execute a task
static void create_and_execute_task (void)
{
- m_task_t task = MSG_task_create("task", 1000000, 0, NULL);
+ msg_task_t task = MSG_task_create("task", 1000000, 0, NULL);
MSG_task_execute (task);
MSG_task_destroy (task);
}
//dump function to create and execute a task
static void create_and_execute_task (void)
{
- m_task_t task = MSG_task_create("task", 1000000, 0, NULL);
+ msg_task_t task = MSG_task_create("task", 1000000, 0, NULL);
MSG_task_execute (task);
MSG_task_destroy (task);
}
TRACE_mark("msmark", "start_send_tasks");
int i;
for (i = 0; i < number_of_tasks; i++) {
- m_task_t task = NULL;
+ msg_task_t task = NULL;
task = MSG_task_create("task", task_comp_size, task_comm_size, NULL);
//setting the variable "task_creation" to value i
TRACE_mark("msmark", "finish_send_tasks");
for (i = 0; i < slaves_count; i++) {
- m_task_t finalize = MSG_task_create("finalize", 0, 0, 0);
+ msg_task_t finalize = MSG_task_create("finalize", 0, 0, 0);
MSG_task_set_category(finalize, "finalize");
MSG_task_send(finalize, "master_mailbox");
}
/** Receiver function */
int slave(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()), "is_slave", 1);
TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()),
/** The guy we will move from host to host. It move alone and then is moved by policeman back */
static int emigrant(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
char *destination = NULL;
MSG_process_sleep(2);
static int master(int argc, char *argv[])
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
// I am the master of emigrant process,
// I tell it where it must emigrate to.
/** Emitter function */
int simple_func(int argc, char *argv[])
{
- m_task_t task = MSG_task_create("task", 100, 0, NULL);
+ msg_task_t task = MSG_task_create("task", 100, 0, NULL);
MSG_task_execute (task);
MSG_task_destroy (task);
return 0;
for (i = 0; i < 10; i++) {
//create and execute a task just to make the simulated time advance
- m_task_t task = MSG_task_create("task", 10000, 0, NULL);
+ msg_task_t task = MSG_task_create("task", 10000, 0, NULL);
MSG_task_execute (task);
MSG_task_destroy (task);
for (i = 0; i < 10; i++) {
//create and execute a task just to make the simulated time advance
- m_task_t task = MSG_task_create("task", 10000, 0, NULL);
+ msg_task_t task = MSG_task_create("task", 10000, 0, NULL);
MSG_task_execute (task);
MSG_task_destroy (task);
typedef struct simdata_task *simdata_task_t;
-typedef struct m_task {
+typedef struct msg_task {
char *name; /**< @brief task name if any */
simdata_task_t simdata; /**< @brief simulator data */
void *data; /**< @brief user data */
long long int counter; /* task unique identifier for instrumentation */
char *category; /* task category for instrumentation */
#endif
-} s_m_task_t;
+} s_msg_task_t;
/** @brief Task datatype.
@ingroup m_task_management
amount</em>, a <em>message size</em> and some <em>private
data</em>.
*/
-typedef struct m_task *m_task_t;
+typedef struct msg_task *msg_task_t;
/* ******************************** File ************************************ */
/* Compatibility typedefs */
typedef msg_process_t m_process_t;
typedef msg_host_t m_host_t;
+typedef msg_task_t m_task_t;
#ifdef MSG_USE_DEPRECATED
typedef int m_channel_t;
XBT_PUBLIC(void) MSG_process_auto_restart_set(msg_process_t process, int auto_restart);
/************************** Task handling ************************************/
-XBT_PUBLIC(m_task_t) MSG_task_create(const char *name,
+XBT_PUBLIC(msg_task_t) MSG_task_create(const char *name,
double compute_duration,
double message_size, void *data);
XBT_PUBLIC(m_gpu_task_t) MSG_gpu_task_create(const char *name,
double compute_duration,
double dispatch_latency,
double collect_latency);
-XBT_PUBLIC(m_task_t) MSG_parallel_task_create(const char *name,
+XBT_PUBLIC(msg_task_t) MSG_parallel_task_create(const char *name,
int host_nb,
const msg_host_t * host_list,
double *computation_amount,
double *communication_amount,
void *data);
-XBT_PUBLIC(void *) MSG_task_get_data(m_task_t task);
-XBT_PUBLIC(void) MSG_task_set_data(m_task_t task, void *data);
+XBT_PUBLIC(void *) MSG_task_get_data(msg_task_t task);
+XBT_PUBLIC(void) MSG_task_set_data(msg_task_t task, void *data);
XBT_PUBLIC(void) MSG_task_set_copy_callback(void (*callback) (
- m_task_t task, msg_process_t src, msg_process_t dst));
-XBT_PUBLIC(msg_process_t) MSG_task_get_sender(m_task_t task);
-XBT_PUBLIC(msg_host_t) MSG_task_get_source(m_task_t task);
-XBT_PUBLIC(const char *) MSG_task_get_name(m_task_t task);
-XBT_PUBLIC(void) MSG_task_set_name(m_task_t task, const char *name);
-XBT_PUBLIC(MSG_error_t) MSG_task_cancel(m_task_t task);
-XBT_PUBLIC(MSG_error_t) MSG_task_destroy(m_task_t task);
-
-XBT_PUBLIC(MSG_error_t) MSG_task_receive_from_host(m_task_t * task, const char *alias,
+ msg_task_t task, msg_process_t src, msg_process_t dst));
+XBT_PUBLIC(msg_process_t) MSG_task_get_sender(msg_task_t task);
+XBT_PUBLIC(msg_host_t) MSG_task_get_source(msg_task_t task);
+XBT_PUBLIC(const char *) MSG_task_get_name(msg_task_t task);
+XBT_PUBLIC(void) MSG_task_set_name(msg_task_t task, const char *name);
+XBT_PUBLIC(MSG_error_t) MSG_task_cancel(msg_task_t task);
+XBT_PUBLIC(MSG_error_t) MSG_task_destroy(msg_task_t task);
+
+XBT_PUBLIC(MSG_error_t) MSG_task_receive_from_host(msg_task_t * task, const char *alias,
msg_host_t host);
-XBT_PUBLIC(MSG_error_t) MSG_task_execute(m_task_t task);
-XBT_PUBLIC(MSG_error_t) MSG_parallel_task_execute(m_task_t task);
-XBT_PUBLIC(void) MSG_task_set_priority(m_task_t task, double priority);
+XBT_PUBLIC(MSG_error_t) MSG_task_execute(msg_task_t task);
+XBT_PUBLIC(MSG_error_t) MSG_parallel_task_execute(msg_task_t task);
+XBT_PUBLIC(void) MSG_task_set_priority(msg_task_t task, double priority);
XBT_PUBLIC(MSG_error_t) MSG_process_sleep(double nb_sec);
-XBT_PUBLIC(double) MSG_task_get_compute_duration(m_task_t task);
-XBT_PUBLIC(void) MSG_task_set_compute_duration(m_task_t task,
+XBT_PUBLIC(double) MSG_task_get_compute_duration(msg_task_t task);
+XBT_PUBLIC(void) MSG_task_set_compute_duration(msg_task_t task,
double compute_duration);
-XBT_PUBLIC(double) MSG_task_get_remaining_computation(m_task_t task);
-XBT_PUBLIC(double) MSG_task_get_remaining_communication(m_task_t task);
-XBT_PUBLIC(int) MSG_task_is_latency_bounded(m_task_t task);
-XBT_PUBLIC(double) MSG_task_get_data_size(m_task_t task);
+XBT_PUBLIC(double) MSG_task_get_remaining_computation(msg_task_t task);
+XBT_PUBLIC(double) MSG_task_get_remaining_communication(msg_task_t task);
+XBT_PUBLIC(int) MSG_task_is_latency_bounded(msg_task_t task);
+XBT_PUBLIC(double) MSG_task_get_data_size(msg_task_t task);
XBT_PUBLIC(MSG_error_t)
- MSG_task_receive_ext(m_task_t * task, const char *alias, double timeout,
+ MSG_task_receive_ext(msg_task_t * task, const char *alias, double timeout,
msg_host_t host);
XBT_PUBLIC(MSG_error_t)
- MSG_task_receive_with_timeout(m_task_t * task, const char *alias,
+ MSG_task_receive_with_timeout(msg_task_t * task, const char *alias,
double timeout);
XBT_PUBLIC(MSG_error_t)
- MSG_task_receive(m_task_t * task, const char *alias);
+ MSG_task_receive(msg_task_t * task, const char *alias);
#define MSG_task_recv(t,a) MSG_task_receive(t,a)
-XBT_PUBLIC(msg_comm_t) MSG_task_isend(m_task_t task, const char *alias);
-XBT_PUBLIC(msg_comm_t) MSG_task_isend_with_matching(m_task_t task,
+XBT_PUBLIC(msg_comm_t) MSG_task_isend(msg_task_t task, const char *alias);
+XBT_PUBLIC(msg_comm_t) MSG_task_isend_with_matching(msg_task_t task,
const char *alias,
int (*match_fun)(void*,void*, smx_action_t),
void *match_data);
-XBT_PUBLIC(void) MSG_task_dsend(m_task_t task, const char *alias, void_f_pvoid_t cleanup);
-XBT_PUBLIC(msg_comm_t) MSG_task_irecv(m_task_t * task, const char *alias);
+XBT_PUBLIC(void) MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup);
+XBT_PUBLIC(msg_comm_t) MSG_task_irecv(msg_task_t * task, const char *alias);
XBT_PUBLIC(int) MSG_comm_test(msg_comm_t comm);
XBT_PUBLIC(int) MSG_comm_testany(xbt_dynar_t comms);
XBT_PUBLIC(void) MSG_comm_destroy(msg_comm_t comm);
XBT_PUBLIC(void) MSG_comm_waitall(msg_comm_t * comm, int nb_elem,
double timeout);
XBT_PUBLIC(int) MSG_comm_waitany(xbt_dynar_t comms);
-XBT_PUBLIC(m_task_t) MSG_comm_get_task(msg_comm_t comm);
+XBT_PUBLIC(msg_task_t) MSG_comm_get_task(msg_comm_t comm);
XBT_PUBLIC(MSG_error_t) MSG_comm_get_status(msg_comm_t comm);
XBT_PUBLIC(int) MSG_task_listen(const char *alias);
msg_host_t host);
XBT_PUBLIC(MSG_error_t)
- MSG_task_send_with_timeout(m_task_t task, const char *alias,
+ MSG_task_send_with_timeout(msg_task_t task, const char *alias,
double timeout);
XBT_PUBLIC(MSG_error_t)
- MSG_task_send(m_task_t task, const char *alias);
+ MSG_task_send(msg_task_t task, const char *alias);
XBT_PUBLIC(MSG_error_t)
- MSG_task_send_bounded(m_task_t task, const char *alias, double rate);
+ MSG_task_send_bounded(msg_task_t task, const char *alias, double rate);
XBT_PUBLIC(int) MSG_task_listen_from(const char *alias);
-XBT_PUBLIC(void) MSG_task_set_category (m_task_t task, const char *category);
-XBT_PUBLIC(const char *) MSG_task_get_category (m_task_t task);
+XBT_PUBLIC(void) MSG_task_set_category (msg_task_t task, const char *category);
+XBT_PUBLIC(const char *) MSG_task_get_category (msg_task_t task);
/************************** Task handling ************************************/
XBT_PUBLIC(MSG_error_t)
- MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
+ MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, msg_task_t * task,
msg_host_t host, double timeout);
XBT_PUBLIC(MSG_error_t)
- MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
+ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, msg_task_t task,
double timeout);
/************************** Action handling **********************************/
#define MSG_process_change_host(h) MSG_process_migrate(MSG_process_self(),h);
XBT_PUBLIC(MSG_error_t) MSG_get_errno(void);
-XBT_PUBLIC(MSG_error_t) MSG_task_get(m_task_t * task, m_channel_t channel);
-XBT_PUBLIC(MSG_error_t) MSG_task_get_with_timeout(m_task_t * task,
+XBT_PUBLIC(MSG_error_t) MSG_task_get(msg_task_t * task, m_channel_t channel);
+XBT_PUBLIC(MSG_error_t) MSG_task_get_with_timeout(msg_task_t * task,
m_channel_t channel,
double max_duration);
-XBT_PUBLIC(MSG_error_t) MSG_task_get_from_host(m_task_t * task,
+XBT_PUBLIC(MSG_error_t) MSG_task_get_from_host(msg_task_t * task,
int channel, msg_host_t host);
-XBT_PUBLIC(MSG_error_t) MSG_task_get_ext(m_task_t * task, int channel,
+XBT_PUBLIC(MSG_error_t) MSG_task_get_ext(msg_task_t * task, int channel,
double max_duration,
msg_host_t host);
-XBT_PUBLIC(MSG_error_t) MSG_task_put(m_task_t task, msg_host_t dest,
+XBT_PUBLIC(MSG_error_t) MSG_task_put(msg_task_t task, msg_host_t dest,
m_channel_t channel);
-XBT_PUBLIC(MSG_error_t) MSG_task_put_bounded(m_task_t task,
+XBT_PUBLIC(MSG_error_t) MSG_task_put_bounded(msg_task_t task,
msg_host_t dest,
m_channel_t channel,
double max_rate);
-XBT_PUBLIC(MSG_error_t) MSG_task_put_with_timeout(m_task_t task,
+XBT_PUBLIC(MSG_error_t) MSG_task_put_with_timeout(msg_task_t task,
msg_host_t dest,
m_channel_t channel,
double max_duration);
MSG_error_t res = MSG_comm_wait(comm, timeout);
if (res == MSG_OK) {
- m_task_t task = MSG_comm_get_task(comm);
+ msg_task_t task = MSG_comm_get_task(comm);
if (MSG_task_get_sender(task) == MSG_process_self()) {
/* I'm the sender */
return 0;
MSG_error_t res = MSG_comm_get_status(comm);
if (res == MSG_OK) {
- m_task_t task = MSG_comm_get_task(comm);
+ msg_task_t task = MSG_comm_get_task(comm);
if (MSG_task_get_sender(task) == MSG_process_self()) {
/* I'm the sender */
lua_pushboolean(L, 1);
#include "msg/msg.h"
void sglua_register_task_functions(lua_State* L);
-m_task_t sglua_check_task(lua_State* L, int index);
+msg_task_t sglua_check_task(lua_State* L, int index);
void sglua_task_register(lua_State* L);
-void sglua_task_unregister(lua_State* L, m_task_t task);
+void sglua_task_unregister(lua_State* L, msg_task_t task);
void sglua_register_comm_functions(lua_State* L);
msg_comm_t sglua_check_comm(lua_State* L, int index);
* \param index an index in the Lua stack
* \return the C task corresponding to this Lua task
*/
-m_task_t sglua_check_task(lua_State* L, int index)
+msg_task_t sglua_check_task(lua_State* L, int index)
{
sglua_stack_dump("check task: ", L);
luaL_checktype(L, index, LUA_TTABLE);
/* ... task ... */
lua_getfield(L, index, "__simgrid_task");
/* ... task ... ctask */
- m_task_t task = *((m_task_t*) luaL_checkudata(L, -1, TASK_MODULE_NAME));
+ msg_task_t task = *((msg_task_t*) luaL_checkudata(L, -1, TASK_MODULE_NAME));
lua_pop(L, 1);
/* ... task ... */
/* name comp comm */
lua_settop(L, 0);
/* -- */
- m_task_t msg_task = MSG_task_create(name, comp_size, msg_size, NULL);
+ msg_task_t msg_task = MSG_task_create(name, comp_size, msg_size, NULL);
lua_newtable(L);
/* task */
/* task mt */
lua_setmetatable(L, -2);
/* task */
- m_task_t* lua_task = (m_task_t*) lua_newuserdata(L, sizeof(m_task_t));
+ msg_task_t* lua_task = (msg_task_t*) lua_newuserdata(L, sizeof(msg_task_t));
/* task ctask */
*lua_task = msg_task;
luaL_getmetatable(L, TASK_MODULE_NAME);
*/
static int l_task_get_name(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
+ msg_task_t task = sglua_check_task(L, 1);
lua_pushstring(L, MSG_task_get_name(task));
return 1;
}
*/
static int l_task_get_computation_duration(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
+ msg_task_t task = sglua_check_task(L, 1);
lua_pushnumber(L, MSG_task_get_compute_duration(task));
return 1;
}
*/
static int l_task_execute(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
+ msg_task_t task = sglua_check_task(L, 1);
MSG_error_t res = MSG_task_execute(task);
if (res == MSG_OK) {
*/
void sglua_task_register(lua_State* L) {
- m_task_t task = sglua_check_task(L, -1);
+ msg_task_t task = sglua_check_task(L, -1);
/* ... task */
/* put in the C task a ref to the lua task so that the receiver finds it */
unsigned long ref = luaL_ref(L, LUA_REGISTRYINDEX);
* \param L a lua state
* \param task a C task
*/
-void sglua_task_unregister(lua_State* L, m_task_t task) {
+void sglua_task_unregister(lua_State* L, msg_task_t task) {
/* ... */
/* the task is in my registry, put it onto my stack */
* \param src_process the sender
* \param dst_process the receiver
*/
-static void task_copy_callback(m_task_t task, msg_process_t src_process,
+static void task_copy_callback(msg_task_t task, msg_process_t src_process,
msg_process_t dst_process) {
lua_State* src = MSG_process_get_data(src_process);
* make the sender forget the C task so that it doesn't garbage */
lua_getfield(src, -1, "__simgrid_task");
/* src: ... task ctask */
- m_task_t* udata = (m_task_t*) luaL_checkudata(src, -1, TASK_MODULE_NAME);
+ msg_task_t* udata = (msg_task_t*) luaL_checkudata(src, -1, TASK_MODULE_NAME);
*udata = NULL;
lua_pop(src, 2);
/* src: ... */
*/
static int l_task_send(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
+ msg_task_t task = sglua_check_task(L, 1);
const char* mailbox = luaL_checkstring(L, 2);
double timeout;
if (lua_gettop(L) >= 3) {
*/
static int l_task_isend(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
+ msg_task_t task = sglua_check_task(L, 1);
const char* mailbox = luaL_checkstring(L, 2);
/* task mailbox ... */
lua_settop(L, 1);
*/
static int l_task_dsend(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
+ msg_task_t task = sglua_check_task(L, 1);
const char* mailbox = luaL_checkstring(L, 2);
/* task mailbox ... */
lua_settop(L, 1);
*/
static int l_task_recv(lua_State* L)
{
- m_task_t task = NULL;
+ msg_task_t task = NULL;
const char* mailbox = luaL_checkstring(L, 1);
double timeout;
if (lua_gettop(L) >= 2) {
{
const char* mailbox = luaL_checkstring(L, 1);
/* mailbox ... */
- m_task_t* task = xbt_new0(m_task_t, 1); // FIXME fix this leak
+ msg_task_t* task = xbt_new0(msg_task_t, 1); // FIXME fix this leak
msg_comm_t comm = MSG_task_irecv(task, mailbox);
sglua_push_comm(L, comm);
/* mailbox ... comm */
static int l_task_gc(lua_State* L)
{
/* ctask */
- m_task_t task = *((m_task_t*) luaL_checkudata(L, 1, TASK_MODULE_NAME));
+ msg_task_t task = *((msg_task_t*) luaL_checkudata(L, 1, TASK_MODULE_NAME));
/* the task is NULL if I sent it to someone else */
if (task != NULL) {
MSG_task_destroy(task);
*/
static int l_task_tostring(lua_State* L)
{
- m_task_t task = *((m_task_t*) luaL_checkudata(L, 1, TASK_MODULE_NAME));
+ msg_task_t task = *((msg_task_t*) luaL_checkudata(L, 1, TASK_MODULE_NAME));
lua_pushfstring(L, "Task: %p", task);
return 1;
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg, instr, "MSG");
-void TRACE_msg_set_task_category(m_task_t task, const char *category)
+void TRACE_msg_set_task_category(msg_task_t task, const char *category)
{
xbt_assert(task->category == NULL, "Task %p(%s) already has a category (%s).",
task, task->name, task->category);
}
/* MSG_task_create related function*/
-void TRACE_msg_task_create(m_task_t task)
+void TRACE_msg_task_create(msg_task_t task)
{
static long long counter = 0;
task->counter = counter++;
}
/* MSG_task_execute related functions */
-void TRACE_msg_task_execute_start(m_task_t task)
+void TRACE_msg_task_execute_start(msg_task_t task)
{
XBT_DEBUG("EXEC,in %p, %lld, %s", task, task->counter, task->category);
}
}
-void TRACE_msg_task_execute_end(m_task_t task)
+void TRACE_msg_task_execute_end(msg_task_t task)
{
XBT_DEBUG("EXEC,out %p, %lld, %s", task, task->counter, task->category);
}
/* MSG_task_destroy related functions */
-void TRACE_msg_task_destroy(m_task_t task)
+void TRACE_msg_task_destroy(msg_task_t task)
{
XBT_DEBUG("DESTROY %p, %lld, %s", task, task->counter, task->category);
}
}
-void TRACE_msg_task_get_end(double start_time, m_task_t task)
+void TRACE_msg_task_get_end(double start_time, msg_task_t task)
{
XBT_DEBUG("GET,out %p, %lld, %s", task, task->counter, task->category);
}
/* MSG_task_put related functions */
-int TRACE_msg_task_put_start(m_task_t task)
+int TRACE_msg_task_put_start(msg_task_t task)
{
XBT_DEBUG("PUT,in %p, %lld, %s", task, task->counter, task->category);
void new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value);
/* declaration of instrumentation functions from msg_task_instr.c */
-void TRACE_msg_set_task_category(m_task_t task, const char *category);
-void TRACE_msg_task_create(m_task_t task);
-void TRACE_msg_task_execute_start(m_task_t task);
-void TRACE_msg_task_execute_end(m_task_t task);
-void TRACE_msg_task_destroy(m_task_t task);
+void TRACE_msg_set_task_category(msg_task_t task, const char *category);
+void TRACE_msg_task_create(msg_task_t task);
+void TRACE_msg_task_execute_start(msg_task_t task);
+void TRACE_msg_task_execute_end(msg_task_t task);
+void TRACE_msg_task_destroy(msg_task_t task);
void TRACE_msg_task_get_start(void);
-void TRACE_msg_task_get_end(double start_time, m_task_t task);
-int TRACE_msg_task_put_start(m_task_t task); //returns TRUE if the task_put_end must be called
+void TRACE_msg_task_get_end(double start_time, msg_task_t task);
+int TRACE_msg_task_put_start(msg_task_t task); //returns TRUE if the task_put_end must be called
void TRACE_msg_task_put_end(void);
/* declaration of instrumentation functions from msg_process_instr.c */
*
* This function is used for describing the behavior of a process. It
* takes only one parameter.
- * \param task a #m_task_t to execute on the location on which the process is running.
+ * \param task a #msg_task_t to execute on the location on which the process is running.
* \return #MSG_OK if the task was successfully completed, #MSG_TASK_CANCELED
* or #MSG_HOST_FAILURE otherwise
*/
-MSG_error_t MSG_task_execute(m_task_t task)
+MSG_error_t MSG_task_execute(msg_task_t task)
{
return MSG_parallel_task_execute(task);
}
/** \ingroup msg_task_usage
* \brief Executes a parallel task and waits for its termination.
*
- * \param task a #m_task_t to execute on the location on which the process is running.
+ * \param task a #msg_task_t to execute on the location on which the process is running.
*
* \return #MSG_OK if the task was successfully completed, #MSG_TASK_CANCELED
* or #MSG_HOST_FAILURE otherwise
*/
-MSG_error_t MSG_parallel_task_execute(m_task_t task)
+MSG_error_t MSG_parallel_task_execute(msg_task_t task)
{
xbt_ex_t e;
simdata_task_t simdata = task->simdata;
* simply compare the host names, for example. After sufficient testing, provide an example that
* we could add to the distribution, and your first contribution to SimGrid is ready. Thanks in advance.
*
- * \param task a memory location for storing a #m_task_t.
+ * \param task a memory location for storing a #msg_task_t.
* \param alias name of the mailbox to receive the task from
* \param host a #msg_host_t host from where the task was sent
*
* #MSG_HOST_FAILURE, or #MSG_TRANSFER_FAILURE otherwise.
*/
MSG_error_t
-MSG_task_receive_from_host(m_task_t * task, const char *alias,
+MSG_task_receive_from_host(msg_task_t * task, const char *alias,
msg_host_t host)
{
return MSG_task_receive_ext(task, alias, -1, host);
* until the task is received. See #MSG_task_irecv
* for receiving tasks asynchronously.
*
- * \param task a memory location for storing a #m_task_t.
+ * \param task a memory location for storing a #msg_task_t.
* \param alias name of the mailbox to receive the task from
*
* \return Returns
* #MSG_OK if the task was successfully received,
* #MSG_HOST_FAILURE, or #MSG_TRANSFER_FAILURE otherwise.
*/
-MSG_error_t MSG_task_receive(m_task_t * task, const char *alias)
+MSG_error_t MSG_task_receive(msg_task_t * task, const char *alias)
{
return MSG_task_receive_with_timeout(task, alias, -1);
}
* for receiving tasks asynchronously. You can provide a -1 timeout
* to obtain an infinite timeout.
*
- * \param task a memory location for storing a #m_task_t.
+ * \param task a memory location for storing a #msg_task_t.
* \param alias name of the mailbox to receive the task from
* \param timeout is the maximum wait time for completion (if -1, this call is the same as #MSG_task_receive)
*
* #MSG_HOST_FAILURE, or #MSG_TRANSFER_FAILURE, or #MSG_TIMEOUT otherwise.
*/
MSG_error_t
-MSG_task_receive_with_timeout(m_task_t * task, const char *alias,
+MSG_task_receive_with_timeout(msg_task_t * task, const char *alias,
double timeout)
{
return MSG_task_receive_ext(task, alias, timeout, NULL);
* for receiving tasks asynchronously. You can provide a -1 timeout
* to obtain an infinite timeout.
*
- * \param task a memory location for storing a #m_task_t.
+ * \param task a memory location for storing a #msg_task_t.
* \param alias name of the mailbox to receive the task from
* \param timeout is the maximum wait time for completion (provide -1 for no timeout)
* \param host a #msg_host_t host from where the task was sent
* #MSG_HOST_FAILURE, or #MSG_TRANSFER_FAILURE, or #MSG_TIMEOUT otherwise.
*/
MSG_error_t
-MSG_task_receive_ext(m_task_t * task, const char *alias, double timeout,
+MSG_task_receive_ext(msg_task_t * task, const char *alias, double timeout,
msg_host_t host)
{
XBT_DEBUG
* This is a non blocking function: use MSG_comm_wait() or MSG_comm_test()
* to end the communication.
*
- * \param task a #m_task_t to send on another location.
+ * \param task a #msg_task_t to send on another location.
* \param alias name of the mailbox to sent the task to
* \return the msg_comm_t communication created
*/
-msg_comm_t MSG_task_isend(m_task_t task, const char *alias)
+msg_comm_t MSG_task_isend(msg_task_t task, const char *alias)
{
return MSG_task_isend_with_matching(task,alias,NULL,NULL);
}
* This is a non blocking function: use MSG_comm_wait() or MSG_comm_test()
* to end the communication.
*
- * \param task a #m_task_t to send on another location.
+ * \param task a #msg_task_t to send on another location.
* \param alias name of the mailbox to sent the task to
* \param match_fun boolean function which parameters are:
* - match_data_provided_here
* \param match_data user provided data passed to match_fun
* \return the msg_comm_t communication created
*/
-XBT_INLINE msg_comm_t MSG_task_isend_with_matching(m_task_t task, const char *alias,
+XBT_INLINE msg_comm_t MSG_task_isend_with_matching(msg_task_t task, const char *alias,
int (*match_fun)(void*,void*, smx_action_t),
void *match_data)
{
* <a href="http://lists.gforge.inria.fr/pipermail/simgrid-user/2011-November/002649.html">this thread</a>
* in the SimGrid-user mailing list archive.
*
- * \param task a #m_task_t to send on another location.
+ * \param task a #msg_task_t to send on another location.
* \param alias name of the mailbox to sent the task to
* \param cleanup a function to destroy the task if the
* communication fails, e.g. MSG_task_destroy
* (if NULL, no function will be called)
*/
-void MSG_task_dsend(m_task_t task, const char *alias, void_f_pvoid_t cleanup)
+void MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup)
{
simdata_task_t t_simdata = NULL;
msg_process_t process = MSG_process_self();
* This is a non blocking function: use MSG_comm_wait() or MSG_comm_test()
* to end the communication.
*
- * \param task a memory location for storing a #m_task_t. has to be valid until the end of the communication.
+ * \param task a memory location for storing a #msg_task_t. has to be valid until the end of the communication.
* \param name of the mailbox to receive the task on
* \return the msg_comm_t communication created
*/
-msg_comm_t MSG_task_irecv(m_task_t *task, const char *name)
+msg_comm_t MSG_task_irecv(msg_task_t *task, const char *name)
{
smx_rdv_t rdv = MSG_mailbox_get_by_alias(name);
}
/** \ingroup msg_task_usage
- * \brief Get a task (#m_task_t) from a communication
+ * \brief Get a task (#msg_task_t) from a communication
*
* \param comm the communication where to get the task
* \return the task from the communication
*/
-m_task_t MSG_comm_get_task(msg_comm_t comm)
+msg_task_t MSG_comm_get_task(msg_comm_t comm)
{
xbt_assert(comm, "Invalid parameter");
// notify the user callback if any
if (msg_global->task_copy_callback) {
- m_task_t task = buff;
+ msg_task_t task = buff;
msg_global->task_copy_callback(task,
simcall_comm_get_src_proc(comm), simcall_comm_get_dst_proc(comm));
}
* \return Returns #MSG_OK if the task was successfully sent,
* #MSG_HOST_FAILURE, or #MSG_TRANSFER_FAILURE otherwise.
*/
-MSG_error_t MSG_task_send(m_task_t task, const char *alias)
+MSG_error_t MSG_task_send(msg_task_t task, const char *alias)
{
XBT_DEBUG("MSG_task_send: Trying to send a message on mailbox '%s'", alias);
return MSG_task_send_with_timeout(task, alias, -1);
* #MSG_HOST_FAILURE, or #MSG_TRANSFER_FAILURE otherwise.
*/
MSG_error_t
-MSG_task_send_bounded(m_task_t task, const char *alias, double maxrate)
+MSG_task_send_bounded(msg_task_t task, const char *alias, double maxrate)
{
task->simdata->rate = maxrate;
return MSG_task_send(task, alias);
* #MSG_HOST_FAILURE, or #MSG_TRANSFER_FAILURE, or #MSG_TIMEOUT otherwise.
*/
MSG_error_t
-MSG_task_send_with_timeout(m_task_t task, const char *alias,
+MSG_task_send_with_timeout(msg_task_t task, const char *alias,
double timeout)
{
return MSG_mailbox_put_with_timeout(MSG_mailbox_get_by_alias(alias),
*/
int MSG_task_listen_from(const char *alias)
{
- m_task_t task;
+ msg_task_t task;
if (NULL ==
(task = MSG_mailbox_get_head(MSG_mailbox_get_by_alias(alias))))
*
* \see MSG_task_get_category, TRACE_category, TRACE_category_with_color
*/
-void MSG_task_set_category (m_task_t task, const char *category)
+void MSG_task_set_category (msg_task_t task, const char *category)
{
#ifdef HAVE_TRACING
TRACE_msg_set_task_category (task, category);
*
* \return Returns the name of the tracing category of the given task, NULL otherwise
*/
-const char *MSG_task_get_category (m_task_t task)
+const char *MSG_task_get_category (msg_task_t task)
{
#ifdef HAVE_TRACING
return task->category;
*
* This function is used for describing the behavior of a process. It
* takes three parameter.
- * \param task a #m_task_t to send on another location. This task
+ * \param task a #msg_task_t to send on another location. This task
will not be usable anymore when the function will return. There is
no automatic task duplication and you have to save your parameters
before calling this function. Tasks are unique and once it has been
* #MSG_TRANSFER_FAILURE if the transfer could not be properly done
* (network failure, dest failure) or #MSG_OK if it succeeded.
*/
-MSG_error_t MSG_task_put(m_task_t task, msg_host_t dest, m_channel_t channel)
+MSG_error_t MSG_task_put(msg_task_t task, msg_host_t dest, m_channel_t channel)
{
XBT_WARN("DEPRECATED! Now use MSG_task_send");
return MSG_task_put_with_timeout(task, dest, channel, -1.0);
* \sa MSG_task_put
*/
MSG_error_t
-MSG_task_put_bounded(m_task_t task, msg_host_t dest, m_channel_t channel,
+MSG_task_put_bounded(msg_task_t task, msg_host_t dest, m_channel_t channel,
double maxrate)
{
XBT_WARN("DEPRECATED! Now use MSG_task_send_bounded");
*
* This function is used for describing the behavior of a process. It
* takes four parameter.
- * \param task a #m_task_t to send on another location. This task
+ * \param task a #msg_task_t to send on another location. This task
will not be usable anymore when the function will return. There is
no automatic task duplication and you have to save your parameters
before calling this function. Tasks are unique and once it has been
(network failure, dest failure, timeout...) or #MSG_OK if the communication succeeded.
*/
MSG_error_t
-MSG_task_put_with_timeout(m_task_t task, msg_host_t dest,
+MSG_task_put_with_timeout(msg_task_t task, msg_host_t dest,
m_channel_t channel, double timeout)
{
XBT_WARN("DEPRECATED! Now use MSG_task_send_with_timeout");
int MSG_task_probe_from(m_channel_t channel)
{
XBT_WARN("DEPRECATED! Now use MSG_task_listen_from");
- m_task_t task;
+ msg_task_t task;
xbt_assert((channel >= 0)
&& (channel < msg_global->max_channel), "Invalid channel %d",
* \brief Listen on \a channel and waits for receiving a task from \a host.
*
* It takes three parameters.
- * \param task a memory location for storing a #m_task_t. It will
+ * \param task a memory location for storing a #msg_task_t. It will
hold a task when this function will return. Thus \a task should not
be equal to \c NULL and \a *task should be equal to \c NULL. If one of
those two condition does not hold, there will be a warning message.
* \return a #MSG_error_t indicating whether the operation was successful (#MSG_OK), or why it failed otherwise.
*/
MSG_error_t
-MSG_task_get_from_host(m_task_t * task, m_channel_t channel, msg_host_t host)
+MSG_task_get_from_host(msg_task_t * task, m_channel_t channel, msg_host_t host)
{
XBT_WARN("DEPRECATED! Now use MSG_task_receive_from_host");
return MSG_task_get_ext(task, channel, -1, host);
* \brief Listen on a channel and wait for receiving a task.
*
* It takes two parameters.
- * \param task a memory location for storing a #m_task_t. It will
+ * \param task a memory location for storing a #msg_task_t. It will
hold a task when this function will return. Thus \a task should not
be equal to \c NULL and \a *task should be equal to \c NULL. If one of
those two condition does not hold, there will be a warning message.
number of channels fixed with MSG_set_channel_number().
* \return a #MSG_error_t indicating whether the operation was successful (#MSG_OK), or why it failed otherwise.
*/
-MSG_error_t MSG_task_get(m_task_t * task, m_channel_t channel)
+MSG_error_t MSG_task_get(msg_task_t * task, m_channel_t channel)
{
XBT_WARN("DEPRECATED! Now use MSG_task_receive");
return MSG_task_get_with_timeout(task, channel, -1);
* \brief Listen on a channel and wait for receiving a task with a timeout.
*
* It takes three parameters.
- * \param task a memory location for storing a #m_task_t. It will
+ * \param task a memory location for storing a #msg_task_t. It will
hold a task when this function will return. Thus \a task should not
be equal to \c NULL and \a *task should be equal to \c NULL. If one of
those two condition does not hold, there will be a warning message.
* \return a #MSG_error_t indicating whether the operation was successful (#MSG_OK), or why it failed otherwise.
*/
MSG_error_t
-MSG_task_get_with_timeout(m_task_t * task, m_channel_t channel,
+MSG_task_get_with_timeout(msg_task_t * task, m_channel_t channel,
double max_duration)
{
XBT_WARN("DEPRECATED! Now use MSG_task_receive_with_timeout");
}
MSG_error_t
-MSG_task_get_ext(m_task_t * task, m_channel_t channel, double timeout,
+MSG_task_get_ext(msg_task_t * task, m_channel_t channel, double timeout,
msg_host_t host)
{
XBT_WARN("DEPRECATED! Now use MSG_task_receive_ext");
return (NULL == simcall_rdv_get_head(mailbox));
}
-m_task_t MSG_mailbox_get_head(msg_mailbox_t mailbox)
+msg_task_t MSG_mailbox_get_head(msg_mailbox_t mailbox)
{
smx_action_t comm = simcall_rdv_get_head(mailbox);
if (!comm)
return NULL;
- return (m_task_t) simcall_comm_get_src_data(comm);
+ return (msg_task_t) simcall_comm_get_src_data(comm);
}
int
}
MSG_error_t
-MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
+MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, msg_task_t * task,
msg_host_t host, double timeout)
{
xbt_ex_t e;
}
MSG_error_t
-MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
+MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, msg_task_t task,
double timeout)
{
xbt_ex_t e;
*
* \return The task at the head of the mailbox.
*/
-XBT_PUBLIC(m_task_t)
+XBT_PUBLIC(msg_task_t)
MSG_mailbox_get_head(msg_mailbox_t mailbox);
/*! \brief MSG_mailbox_get_count_host_waiting_tasks - Return the number of tasks
m_channel_t put_channel; /* used for debugging purposes */
#endif
smx_action_t waiting_action;
- m_task_t waiting_task;
+ msg_task_t waiting_task;
char **argv; /* arguments table if any */
int argc; /* arguments number if any */
MSG_error_t last_errno; /* the last value returned by a MSG_function */
typedef struct msg_comm {
smx_action_t s_comm; /* SIMIX communication object encapsulated (the same for both processes) */
- m_task_t task_sent; /* task sent (NULL for the receiver) */
- m_task_t *task_received; /* where the task will be received (NULL for the sender) */
+ msg_task_t task_sent; /* task sent (NULL for the receiver) */
+ msg_task_t *task_received; /* where the task will be received (NULL for the sender) */
MSG_error_t status; /* status of the communication once finished */
} s_msg_comm_t;
int PID;
int session;
unsigned long int sent_msg; /* Total amount of messages sent during the simulation */
- void (*task_copy_callback) (m_task_t task, msg_process_t src, msg_process_t dst);
+ void (*task_copy_callback) (msg_task_t task, msg_process_t src, msg_process_t dst);
void_f_pvoid_t process_data_cleanup;
xbt_swag_t vms;
} s_MSG_Global_t, *MSG_Global_t;
m_process_management (to create a new #msg_process_t for example),
in \ref m_host_management (only the read-only functions i.e. whose
name contains the word get), in \ref m_task_management (to create
- or destroy some #m_task_t for example) and in \ref
+ or destroy some #msg_task_t for example) and in \ref
msg_task_usage (to handle file transfers and task processing).
* \param data a pointer to any data one may want to attach to the new
object. It is for user-level information and can be NULL. It can
m_process_management (to create a new #msg_process_t for example),
in \ref m_host_management (only the read-only functions i.e. whose
name contains the word get), in \ref m_task_management (to create
- or destroy some #m_task_t for example) and in \ref
+ or destroy some #msg_task_t for example) and in \ref
msg_task_usage (to handle file transfers and task processing).
* \param data a pointer to any data one may want to attach to the new
object. It is for user-level information and can be NULL. It can
/********************************* Task **************************************/
/** \ingroup m_task_management
- * \brief Creates a new #m_task_t.
+ * \brief Creates a new #msg_task_t.
*
- * A constructor for #m_task_t taking four arguments and returning the
+ * A constructor for #msg_task_t taking four arguments and returning the
corresponding object.
* \param name a name for the object. It is for user-level information
and can be NULL.
* \param data a pointer to any data may want to attach to the new
object. It is for user-level information and can be NULL. It can
be retrieved with the function \ref MSG_task_get_data.
- * \see m_task_t
+ * \see msg_task_t
* \return The new corresponding object.
*/
-m_task_t MSG_task_create(const char *name, double compute_duration,
+msg_task_t MSG_task_create(const char *name, double compute_duration,
double message_size, void *data)
{
- m_task_t task = xbt_new(s_m_task_t, 1);
+ msg_task_t task = xbt_new(s_msg_task_t, 1);
simdata_task_t simdata = xbt_new(s_simdata_task_t, 1);
task->simdata = simdata;
}
/** \ingroup m_task_management
- * \brief Creates a new #m_task_t (a parallel one....).
+ * \brief Creates a new #msg_task_t (a parallel one....).
*
- * A constructor for #m_task_t taking six arguments and returning the
+ * A constructor for #msg_task_t taking six arguments and returning the
corresponding object.
* \param name a name for the object. It is for user-level information
and can be NULL.
* \param data a pointer to any data may want to attach to the new
object. It is for user-level information and can be NULL. It can
be retrieved with the function \ref MSG_task_get_data.
- * \see m_task_t
+ * \see msg_task_t
* \return The new corresponding object.
*/
-m_task_t
+msg_task_t
MSG_parallel_task_create(const char *name, int host_nb,
const msg_host_t * host_list,
double *computation_amount,
double *communication_amount, void *data)
{
- m_task_t task = MSG_task_create(name, 0, 0, data);
+ msg_task_t task = MSG_task_create(name, 0, 0, data);
simdata_task_t simdata = task->simdata;
int i;
/*************** End GPU ***************/
/** \ingroup m_task_management
- * \brief Return the user data of a #m_task_t.
+ * \brief Return the user data of a #msg_task_t.
*
* This function checks whether \a task is a valid pointer or not and return
the user data associated to \a task if it is possible.
*/
-void *MSG_task_get_data(m_task_t task)
+void *MSG_task_get_data(msg_task_t task)
{
xbt_assert((task != NULL), "Invalid parameter");
}
/** \ingroup m_task_management
- * \brief Sets the user data of a #m_task_t.
+ * \brief Sets the user data of a #msg_task_t.
*
* This function allows to associate a new pointer to
the user data associated of \a task.
*/
-void MSG_task_set_data(m_task_t task, void *data)
+void MSG_task_set_data(msg_task_t task, void *data)
{
xbt_assert((task != NULL), "Invalid parameter");
* \param callback a callback function
*/
void MSG_task_set_copy_callback(void (*callback)
- (m_task_t task, msg_process_t sender, msg_process_t receiver)) {
+ (msg_task_t task, msg_process_t sender, msg_process_t receiver)) {
msg_global->task_copy_callback = callback;
}
/** \ingroup m_task_management
- * \brief Return the sender of a #m_task_t.
+ * \brief Return the sender of a #msg_task_t.
*
* This functions returns the #msg_process_t which sent this task
*/
-msg_process_t MSG_task_get_sender(m_task_t task)
+msg_process_t MSG_task_get_sender(msg_task_t task)
{
xbt_assert(task, "Invalid parameters");
return ((simdata_task_t) task->simdata)->sender;
}
/** \ingroup m_task_management
- * \brief Return the source of a #m_task_t.
+ * \brief Return the source of a #msg_task_t.
*
* This functions returns the #msg_host_t from which this task was sent
*/
-msg_host_t MSG_task_get_source(m_task_t task)
+msg_host_t MSG_task_get_source(msg_task_t task)
{
xbt_assert(task, "Invalid parameters");
return ((simdata_task_t) task->simdata)->source;
}
/** \ingroup m_task_management
- * \brief Return the name of a #m_task_t.
+ * \brief Return the name of a #msg_task_t.
*
- * This functions returns the name of a #m_task_t as specified on creation
+ * This functions returns the name of a #msg_task_t as specified on creation
*/
-const char *MSG_task_get_name(m_task_t task)
+const char *MSG_task_get_name(msg_task_t task)
{
xbt_assert(task, "Invalid parameters");
return task->name;
}
/** \ingroup m_task_management
- * \brief Sets the name of a #m_task_t.
+ * \brief Sets the name of a #msg_task_t.
*
* This functions allows to associate a name to a task
*/
-void MSG_task_set_name(m_task_t task, const char *name)
+void MSG_task_set_name(msg_task_t task, const char *name)
{
xbt_assert(task, "Invalid parameters");
task->name = xbt_strdup(name);
}
/** \ingroup m_task_management
- * \brief Destroy a #m_task_t.
+ * \brief Destroy a #msg_task_t.
*
- * Destructor for #m_task_t. Note that you should free user data, if any, \b
+ * Destructor for #msg_task_t. Note that you should free user data, if any, \b
* before calling this function.
*
* Only the process that owns the task can destroy it.
* supposed to destroy it. The sender should not use it anymore.
* If the task failed to be sent, the sender remains the owner of the task.
*/
-MSG_error_t MSG_task_destroy(m_task_t task)
+MSG_error_t MSG_task_destroy(msg_task_t task)
{
smx_action_t action = NULL;
xbt_assert((task != NULL), "Invalid parameter");
/** \ingroup m_task_usage
- * \brief Cancel a #m_task_t.
+ * \brief Cancel a #msg_task_t.
* \param task the task to cancel. If it was executed or transfered, it
stops the process that were working on it.
*/
-MSG_error_t MSG_task_cancel(m_task_t task)
+MSG_error_t MSG_task_cancel(msg_task_t task)
{
xbt_assert((task != NULL), "Invalid parameter");
}
/** \ingroup m_task_management
- * \brief Returns the computation amount needed to process a task #m_task_t.
+ * \brief Returns the computation amount needed to process a task #msg_task_t.
* Once a task has been processed, this amount is thus set to 0...
*/
-double MSG_task_get_compute_duration(m_task_t task)
+double MSG_task_get_compute_duration(msg_task_t task)
{
xbt_assert((task != NULL)
&& (task->simdata != NULL), "Invalid parameter");
/** \ingroup m_task_management
- * \brief set the computation amount needed to process a task #m_task_t.
+ * \brief set the computation amount needed to process a task #msg_task_t.
*/
-void MSG_task_set_compute_duration(m_task_t task,
+void MSG_task_set_compute_duration(msg_task_t task,
double computation_amount)
{
xbt_assert(task, "Invalid parameter");
}
/** \ingroup m_task_management
- * \brief Returns the remaining computation amount of a task #m_task_t.
+ * \brief Returns the remaining computation amount of a task #msg_task_t.
*
*/
-double MSG_task_get_remaining_computation(m_task_t task)
+double MSG_task_get_remaining_computation(msg_task_t task)
{
xbt_assert((task != NULL)
&& (task->simdata != NULL), "Invalid parameter");
}
/** \ingroup m_task_management
- * \brief Returns the total amount received by a task #m_task_t.
+ * \brief Returns the total amount received by a task #msg_task_t.
* If the communication does not exist it will return 0.
* So, if the communication has FINISHED or FAILED it returns
* zero.
*/
-double MSG_task_get_remaining_communication(m_task_t task)
+double MSG_task_get_remaining_communication(msg_task_t task)
{
xbt_assert((task != NULL)
&& (task->simdata != NULL), "Invalid parameter");
* \brief Return 1 if communication task is limited by latency, 0 otherwise
*
*/
-int MSG_task_is_latency_bounded(m_task_t task)
+int MSG_task_is_latency_bounded(msg_task_t task)
{
xbt_assert((task != NULL)
&& (task->simdata != NULL), "Invalid parameter");
#endif
/** \ingroup m_task_management
- * \brief Returns the size of the data attached to a task #m_task_t.
+ * \brief Returns the size of the data attached to a task #msg_task_t.
*
*/
-double MSG_task_get_data_size(m_task_t task)
+double MSG_task_get_data_size(msg_task_t task)
{
xbt_assert((task != NULL)
&& (task->simdata != NULL), "Invalid parameter");
* cpu power than the other ones.
*
*/
-void MSG_task_set_priority(m_task_t task, double priority)
+void MSG_task_set_priority(msg_task_t task, double priority)
{
xbt_assert((task != NULL)
&& (task->simdata != NULL), "Invalid parameter");
static int receive(int argc, char *argv[])
{
XBT_INFO("Receiving");
- m_task_t task = NULL;
+ msg_task_t task = NULL;
MSG_task_receive_with_timeout(&task, MSG_host_get_name(MSG_host_self()), DBL_MAX);
xbt_assert(MSG_task_get_sender(task), "No sender received");
XBT_INFO("Got a message sent by '%s'",
/** test the trace integration cpu model */
int test_trace(int argc, char *argv[])
{
- m_task_t task;
+ msg_task_t task;
double task_comp_size = 2800;
double task_prio = 1.0;