From 48a6c50a85f2d0d71990bd4a57d23fb6d763f64a Mon Sep 17 00:00:00 2001 From: navarro Date: Tue, 17 Jan 2012 17:47:48 +0100 Subject: [PATCH] Completely remove channel mecanism with tesh tested examples. --- examples/msg/chord/chord.c | 1 - examples/msg/chord/chord_stateful.c | 1 - examples/msg/gtnets/gtnets.c | 6 ------ examples/msg/icomms/peer.c | 1 - examples/msg/icomms/peer2.c | 1 - examples/msg/icomms/peer3.c | 1 - examples/msg/masterslave/masterslave_bypass.c | 14 ++++--------- .../msg/masterslave/masterslave_cluster.c | 14 ++++--------- .../msg/masterslave/masterslave_console.c | 8 +------- .../msg/masterslave/masterslave_failure.c | 14 ++++--------- .../msg/masterslave/masterslave_forwarder.c | 20 +++++++------------ .../msg/masterslave/masterslave_mailbox.c | 1 - examples/msg/parallel_task/parallel_task.c | 1 - examples/msg/parallel_task/test_ptask.c | 6 ------ examples/msg/priority/priority.c | 1 - examples/msg/sendrecv/sendrecv.c | 14 ++++--------- examples/msg/suspend/suspend.c | 6 ------ examples/msg/token_ring/ring_call.c | 6 ------ teshsuite/msg/get_sender.c | 6 ++---- 19 files changed, 26 insertions(+), 96 deletions(-) diff --git a/examples/msg/chord/chord.c b/examples/msg/chord/chord.c index 2bfaa484ec..5a18518fc1 100644 --- a/examples/msg/chord/chord.c +++ b/examples/msg/chord/chord.c @@ -911,7 +911,6 @@ int main(int argc, char *argv[]) chord_initialize(); - MSG_set_channel_number(0); MSG_create_environment(platform_file); MSG_function_register("node", node); diff --git a/examples/msg/chord/chord_stateful.c b/examples/msg/chord/chord_stateful.c index 481da7ab1c..5a1c2cf97e 100644 --- a/examples/msg/chord/chord_stateful.c +++ b/examples/msg/chord/chord_stateful.c @@ -927,7 +927,6 @@ int main(int argc, char *argv[]) chord_initialize(); - MSG_set_channel_number(0); MSG_create_environment(platform_file); MSG_function_register("node", node); diff --git a/examples/msg/gtnets/gtnets.c b/examples/msg/gtnets/gtnets.c index b60e800a29..11a895ef50 100644 --- a/examples/msg/gtnets/gtnets.c +++ b/examples/msg/gtnets/gtnets.c @@ -21,11 +21,6 @@ MSG_error_t test_all(const char *platform_file, int timer_start = 1; -typedef enum { - PORT_22 = 0, - MAX_CHANNEL -} channel_t; - //keep a pointer to all surf running tasks. #define NTASKS 1500 int bool_printed = 0; @@ -209,7 +204,6 @@ MSG_error_t test_all(const char *platform_file, /* MSG_config("workstation/model", "GTNETS"); */ /* MSG_config("workstation/model","KCCFLN05"); */ { /* Simulation setting */ - MSG_set_channel_number(MAX_CHANNEL); MSG_create_environment(platform_file); } diff --git a/examples/msg/icomms/peer.c b/examples/msg/icomms/peer.c index dff859edd0..a9fa072589 100644 --- a/examples/msg/icomms/peer.c +++ b/examples/msg/icomms/peer.c @@ -141,7 +141,6 @@ MSG_error_t test_all(const char *platform_file, /* MSG_config("workstation/model","KCCFLN05"); */ { /* Simulation setting */ - MSG_set_channel_number(0); MSG_create_environment(platform_file); } { /* Application deployment */ diff --git a/examples/msg/icomms/peer2.c b/examples/msg/icomms/peer2.c index fde2c5a4c8..9e27e9b43b 100644 --- a/examples/msg/icomms/peer2.c +++ b/examples/msg/icomms/peer2.c @@ -100,7 +100,6 @@ MSG_error_t test_all(const char *platform_file, /* MSG_config("workstation/model","KCCFLN05"); */ { /* Simulation setting */ - MSG_set_channel_number(0); MSG_create_environment(platform_file); } { /* Application deployment */ diff --git a/examples/msg/icomms/peer3.c b/examples/msg/icomms/peer3.c index 410e0f721e..a86a0cc7ac 100644 --- a/examples/msg/icomms/peer3.c +++ b/examples/msg/icomms/peer3.c @@ -134,7 +134,6 @@ MSG_error_t test_all(const char *platform_file, /* MSG_config("workstation/model","KCCFLN05"); */ { /* Simulation setting */ - MSG_set_channel_number(0); MSG_create_environment(platform_file); } { /* Application deployment */ diff --git a/examples/msg/masterslave/masterslave_bypass.c b/examples/msg/masterslave/masterslave_bypass.c index b35ebe692f..4c6f2a8cea 100644 --- a/examples/msg/masterslave/masterslave_bypass.c +++ b/examples/msg/masterslave/masterslave_bypass.c @@ -152,11 +152,6 @@ int master(int argc, char *argv[]); int slave(int argc, char *argv[]); MSG_error_t test_all(void); -typedef enum { - PORT_22 = 0, - MAX_CHANNEL -} channel_t; - /** Emitter function */ int master(int argc, char *argv[]) { @@ -217,15 +212,15 @@ int master(int argc, char *argv[]) if (MSG_host_self() == slaves[i % slaves_count]) { XBT_INFO("Hey ! It's me ! :)"); } - MSG_task_put(todo[i], slaves[i % slaves_count], PORT_22); + MSG_task_send(todo[i], MSG_host_get_name(slaves[i % slaves_count])); XBT_INFO("Send completed"); } XBT_INFO ("All tasks have been dispatched. Let's tell everybody the computation is over."); for (i = 0; i < slaves_count; i++) - MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE), - slaves[i], PORT_22); + MSG_task_send(MSG_task_create("finalize", 0, 0, FINALIZE), + MSG_host_get_name(slaves[i])); XBT_INFO("Goodbye now!"); free(slaves); @@ -240,7 +235,7 @@ int slave(int argc, char *argv[]) while (1) { m_task_t task = NULL; int a; - a = MSG_task_get(&(task), PORT_22); + a = MSG_task_receive(&task, MSG_host_get_name(MSG_host_self())); if (a == MSG_OK) { XBT_INFO("Received \"%s\" ", MSG_task_get_name(task)); if (MSG_task_get_data(task) == FINALIZE) { @@ -266,7 +261,6 @@ MSG_error_t test_all(void) MSG_error_t res = MSG_OK; /* Simulation setting */ - MSG_set_channel_number(MAX_CHANNEL); surf_parse = surf_parse_bypass_platform; MSG_create_environment(NULL); diff --git a/examples/msg/masterslave/masterslave_cluster.c b/examples/msg/masterslave/masterslave_cluster.c index 396b361bb7..7676189b61 100644 --- a/examples/msg/masterslave/masterslave_cluster.c +++ b/examples/msg/masterslave/masterslave_cluster.c @@ -22,11 +22,6 @@ MSG_error_t test_all(const char *platform_file); int master(int argc, char *argv[]); int slave(int argc, char *argv[]); -typedef enum { - PORT_22 = 0, - MAX_CHANNEL -} channel_t; - /** Emitter function */ int master(int argc, char *argv[]) { @@ -87,15 +82,15 @@ int master(int argc, char *argv[]) if (MSG_host_self() == slaves[i % slaves_count]) { XBT_INFO("Hey ! It's me ! :)"); } - MSG_task_put(todo[i], slaves[i % slaves_count], PORT_22); + MSG_task_send(todo[i], MSG_host_get_name(slaves[i % slaves_count])); XBT_INFO("Send completed"); } XBT_INFO ("All tasks have been dispatched. Let's tell everybody the computation is over."); for (i = 0; i < slaves_count; i++) - MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE), - slaves[i], PORT_22); + MSG_task_send(MSG_task_create("finalize", 0, 0, FINALIZE), + MSG_host_get_name(slaves[i])); XBT_INFO("Goodbye now!"); free(slaves); @@ -110,7 +105,7 @@ int slave(int argc, char *argv[]) while (1) { m_task_t task = NULL; int a; - a = MSG_task_get(&(task), PORT_22); + a = MSG_task_receive(&(task), MSG_host_get_name(MSG_host_self())); if (a == MSG_OK) { XBT_INFO("Received \"%s\" ", MSG_task_get_name(task)); if (MSG_task_get_data(task) == FINALIZE) { @@ -202,7 +197,6 @@ static int bypass_deployment(void) MSG_error_t test_all(const char *platform_file) { MSG_error_t res = MSG_OK; - MSG_set_channel_number(MAX_CHANNEL); MSG_create_environment(platform_file); MSG_function_register("master", master); MSG_function_register("slave", slave); diff --git a/examples/msg/masterslave/masterslave_console.c b/examples/msg/masterslave/masterslave_console.c index eff59091a9..5b4a1abfec 100644 --- a/examples/msg/masterslave/masterslave_console.c +++ b/examples/msg/masterslave/masterslave_console.c @@ -18,11 +18,6 @@ int master(int argc, char *argv[]); int slave(int argc, char *argv[]); MSG_error_t test_all(const char *); -typedef enum { - PORT_22 = 0, - MAX_CHANNEL -} channel_t; - /** Emitter function */ int master(int argc, char *argv[]) { @@ -102,8 +97,7 @@ int slave(int argc, char *argv[]) MSG_error_t test_all(const char *file) //(void) { MSG_error_t res = MSG_OK; - /* Simulation setting */ - MSG_set_channel_number(MAX_CHANNEL); + /*start by registering functions before loading script */ MSG_function_register("master", master); MSG_function_register("slave", slave); diff --git a/examples/msg/masterslave/masterslave_failure.c b/examples/msg/masterslave/masterslave_failure.c index f93761eb0d..c882244eea 100644 --- a/examples/msg/masterslave/masterslave_failure.c +++ b/examples/msg/masterslave/masterslave_failure.c @@ -20,11 +20,6 @@ int forwarder(int argc, char *argv[]); MSG_error_t test_all(const char *platform_file, const char *application_file); -typedef enum { - PORT_22 = 0, - MAX_CHANNEL -} channel_t; - #define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */ /** Emitter function */ @@ -70,8 +65,8 @@ int master(int argc, char *argv[]) int a; *((double *) task->data) = MSG_get_clock(); - a = MSG_task_put_with_timeout(task, slaves[i % slaves_count], PORT_22, - 10.0); + a = MSG_task_send_with_timeout(task,MSG_host_get_name(slaves[i % slaves_count]),10.0); + if (a == MSG_OK) { XBT_INFO("Send completed"); } else if (a == MSG_HOST_FAILURE) { @@ -103,7 +98,7 @@ int master(int argc, char *argv[]) ("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); - int a = MSG_task_put_with_timeout(task, slaves[i], PORT_22, 1.0); + int a = MSG_task_send_with_timeout(task,MSG_host_get_name(slaves[i]),1.0); if (a == MSG_OK) continue; if (a == MSG_HOST_FAILURE) { @@ -141,7 +136,7 @@ int slave(int argc, char *argv[]) double time1, time2; time1 = MSG_get_clock(); - a = MSG_task_get(&(task), PORT_22); + a = MSG_task_receive( &(task), MSG_host_get_name(MSG_host_self()) ); time2 = MSG_get_clock(); if (a == MSG_OK) { XBT_INFO("Received \"%s\"", MSG_task_get_name(task)); @@ -189,7 +184,6 @@ MSG_error_t test_all(const char *platform_file, /* MSG_config("workstation/model","KCCFLN05"); */ { /* Simulation setting */ - MSG_set_channel_number(MAX_CHANNEL); MSG_create_environment(platform_file); } { /* Application deployment */ diff --git a/examples/msg/masterslave/masterslave_forwarder.c b/examples/msg/masterslave/masterslave_forwarder.c index 5978b0e6a5..b428b60ff6 100644 --- a/examples/msg/masterslave/masterslave_forwarder.c +++ b/examples/msg/masterslave/masterslave_forwarder.c @@ -20,11 +20,6 @@ int forwarder(int argc, char *argv[]); MSG_error_t test_all(const char *platform_file, const char *application_file); -typedef enum { - PORT_22 = 0, - MAX_CHANNEL -} channel_t; - #define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */ /** Emitter function */ @@ -82,7 +77,7 @@ int master(int argc, char *argv[]) XBT_INFO("Hey ! It's me ! :)"); } - MSG_task_put(todo[i], slaves[i % slaves_count], PORT_22); + MSG_task_send(todo[i], MSG_host_get_name(slaves[i % slaves_count])); XBT_INFO("Sent"); } @@ -90,7 +85,7 @@ int master(int argc, char *argv[]) ("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_put(finalize, slaves[i], PORT_22); + MSG_task_send(finalize, MSG_host_get_name(slaves[i])); } XBT_INFO("Goodbye now!"); @@ -105,7 +100,7 @@ int slave(int argc, char *argv[]) m_task_t task = NULL; _XBT_GNUC_UNUSED int res; while (1) { - res = MSG_task_get(&(task), PORT_22); + res = MSG_task_receive(&(task),MSG_host_get_name(MSG_host_self())); xbt_assert(res == MSG_OK, "MSG_task_get failed"); XBT_INFO("Received \"%s\"", MSG_task_get_name(task)); @@ -148,21 +143,21 @@ int forwarder(int argc, char *argv[]) while (1) { m_task_t task = NULL; int a; - a = MSG_task_get(&(task), PORT_22); + a = MSG_task_receive(&(task),MSG_host_get_name(MSG_host_self())); if (a == MSG_OK) { XBT_INFO("Received \"%s\"", MSG_task_get_name(task)); if (MSG_task_get_data(task) == FINALIZE) { XBT_INFO ("All tasks have been dispatched. Let's tell everybody the computation is over."); for (i = 0; i < slaves_count; i++) - MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE), - slaves[i], PORT_22); + MSG_task_send(MSG_task_create("finalize", 0, 0, FINALIZE), + MSG_host_get_name(slaves[i])); MSG_task_destroy(task); break; } XBT_INFO("Sending \"%s\" to \"%s\"", MSG_task_get_name(task), slaves[i % slaves_count]->name); - MSG_task_put(task, slaves[i % slaves_count], PORT_22); + MSG_task_send(task, MSG_host_get_name(slaves[i % slaves_count])); i++; } else { XBT_INFO("Hey ?! What's up ? "); @@ -183,7 +178,6 @@ MSG_error_t test_all(const char *platform_file, /* MSG_config("workstation/model","KCCFLN05"); */ { /* Simulation setting */ - MSG_set_channel_number(MAX_CHANNEL); MSG_create_environment(platform_file); } { /* Application deployment */ diff --git a/examples/msg/masterslave/masterslave_mailbox.c b/examples/msg/masterslave/masterslave_mailbox.c index f789f1557c..551e38b79f 100644 --- a/examples/msg/masterslave/masterslave_mailbox.c +++ b/examples/msg/masterslave/masterslave_mailbox.c @@ -105,7 +105,6 @@ MSG_error_t test_all(const char *platform_file, /* MSG_config("workstation/model","KCCFLN05"); */ { /* Simulation setting */ - MSG_set_channel_number(0); MSG_create_environment(platform_file); } { /* Application deployment */ diff --git a/examples/msg/parallel_task/parallel_task.c b/examples/msg/parallel_task/parallel_task.c index ced1cf2014..f546f6cea9 100644 --- a/examples/msg/parallel_task/parallel_task.c +++ b/examples/msg/parallel_task/parallel_task.c @@ -65,7 +65,6 @@ MSG_error_t test_all(const char *platform_file) m_host_t *hosts; MSG_config("workstation/model", "ptask_L07"); - MSG_set_channel_number(1); MSG_create_environment(platform_file); hosts = MSG_get_host_table(); diff --git a/examples/msg/parallel_task/test_ptask.c b/examples/msg/parallel_task/test_ptask.c index 03c5b949bb..44175583ee 100644 --- a/examples/msg/parallel_task/test_ptask.c +++ b/examples/msg/parallel_task/test_ptask.c @@ -20,11 +20,6 @@ int redistribute(int argc, char *argv[]); MSG_error_t test_all(const char *platform_file, const char *application_file); -typedef enum { - PORT_22 = 0, - MAX_CHANNEL -} channel_t; - int execute(int argc, char *argv[]) { @@ -145,7 +140,6 @@ MSG_error_t test_all(const char *platform_file, MSG_config("workstation/model", "ptask_L07"); /* Simulation setting */ - MSG_set_channel_number(MAX_CHANNEL); MSG_create_environment(platform_file); /* Application deployment */ diff --git a/examples/msg/priority/priority.c b/examples/msg/priority/priority.c index 48aaeaf546..e4686cbd26 100644 --- a/examples/msg/priority/priority.c +++ b/examples/msg/priority/priority.c @@ -43,7 +43,6 @@ static MSG_error_t test_all(const char *platform_file, MSG_error_t res = MSG_OK; { /* Simulation setting */ - MSG_set_channel_number(1); MSG_create_environment(platform_file); } { /* Application deployment */ diff --git a/examples/msg/sendrecv/sendrecv.c b/examples/msg/sendrecv/sendrecv.c index cd5ea884ea..56bd3751ba 100644 --- a/examples/msg/sendrecv/sendrecv.c +++ b/examples/msg/sendrecv/sendrecv.c @@ -22,11 +22,6 @@ int receiver(int argc, char *argv[]); MSG_error_t test_all(const char *platform_file, const char *application_file); -typedef enum { - PORT_22 = 0, - MAX_CHANNEL -} channel_t; - double task_comm_size_lat = 10e0; double task_comm_size_bw = 10e8; @@ -61,7 +56,7 @@ int sender(int argc, char *argv[]) task_la->data = xbt_new(double, 1); *(double *) task_la->data = time; XBT_INFO("task_la->data = %le", *((double *) task_la->data)); - MSG_task_put(task_la, host, PORT_22); + MSG_task_send(task_la, argv[1]); /* Bandwidth */ time = MSG_get_clock(); @@ -71,7 +66,7 @@ int sender(int argc, char *argv[]) task_bw->data = xbt_new(double, 1); *(double *) task_bw->data = time; XBT_INFO("task_bw->data = %le", *((double *) task_bw->data)); - MSG_task_put(task_bw, host, PORT_22); + MSG_task_send(task_bw, argv[1]); return 0; } /* end_of_client */ @@ -90,7 +85,7 @@ int receiver(int argc, char *argv[]) time = MSG_get_clock(); /* Get Latency */ - a = MSG_task_get(&task_la, PORT_22); + a = MSG_task_receive(&task_la,MSG_host_get_name(MSG_host_self())); if (a == MSG_OK) { time1 = MSG_get_clock(); sender_time = *((double *) (task_la->data)); @@ -107,7 +102,7 @@ int receiver(int argc, char *argv[]) /* Get Bandwidth */ - a = MSG_task_get(&task_bw, PORT_22); + a = MSG_task_receive(&task_bw,MSG_host_get_name(MSG_host_self())); if (a == MSG_OK) { time1 = MSG_get_clock(); sender_time = *((double *) (task_bw->data)); @@ -139,7 +134,6 @@ MSG_error_t test_all(const char *platform_file, XBT_INFO("test_all"); /* Simulation setting */ - MSG_set_channel_number(MAX_CHANNEL); MSG_create_environment(platform_file); /* Application deployment */ diff --git a/examples/msg/suspend/suspend.c b/examples/msg/suspend/suspend.c index 2dc830414e..e1e2ba87a6 100644 --- a/examples/msg/suspend/suspend.c +++ b/examples/msg/suspend/suspend.c @@ -12,11 +12,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); -typedef enum { - PORT_22 = 0, - MAX_CHANNEL -} channel_t; - /** Lazy guy function. This process suspends itself asap. */ static int lazy_guy(int argc, char *argv[]) @@ -51,7 +46,6 @@ static MSG_error_t test_all(const char *platform_file, MSG_error_t res = MSG_OK; { /* Simulation setting */ - MSG_set_channel_number(MAX_CHANNEL); MSG_create_environment(platform_file); } { /* Application deployment */ diff --git a/examples/msg/token_ring/ring_call.c b/examples/msg/token_ring/ring_call.c index 8cdf4e9d3a..be67d1ccae 100644 --- a/examples/msg/token_ring/ring_call.c +++ b/examples/msg/token_ring/ring_call.c @@ -50,16 +50,10 @@ int host(int argc, char *argv[]) return 0; } -typedef enum { - PORT_22 = 20, - MAX_CHANNEL -} channel_t; - int main(int argc, char **argv) { int i,res; MSG_global_init(&argc, argv); - MSG_set_channel_number(MAX_CHANNEL); MSG_create_environment(argv[1]); m_host_t *host_table = MSG_get_host_table(); number_of_hosts = MSG_get_host_number(); diff --git a/teshsuite/msg/get_sender.c b/teshsuite/msg/get_sender.c index aecfda8418..6a766c518d 100644 --- a/teshsuite/msg/get_sender.c +++ b/teshsuite/msg/get_sender.c @@ -14,8 +14,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Messages specific to this example"); static int send(int argc, char *argv[]) { XBT_INFO("Sending"); - MSG_task_put(MSG_task_create("Blah", 0.0, 0.0, NULL), MSG_host_self(), - 0); + MSG_task_send(MSG_task_create("Blah", 0.0, 0.0, NULL), MSG_host_get_name(MSG_host_self())); MSG_process_sleep(1.); /* FIXME: if the sender exits before the receiver calls get_sender(), bad thing happens */ XBT_INFO("Exiting"); return 0; @@ -25,7 +24,7 @@ static int receive(int argc, char *argv[]) { XBT_INFO("Receiving"); m_task_t task = NULL; - MSG_task_get_with_timeout(&task, 0, DBL_MAX); + 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'", MSG_process_get_name(MSG_task_get_sender(task))); @@ -38,7 +37,6 @@ int main(int argc, char *argv[]) MSG_error_t res = MSG_OK; MSG_global_init(&argc, argv); - MSG_set_channel_number(100); /* Application deployment */ MSG_function_register("send", &send); -- 2.20.1