Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Completely remove channel mecanism with tesh tested examples.
authornavarro <navarro@caraja.(none)>
Tue, 17 Jan 2012 16:47:48 +0000 (17:47 +0100)
committernavarro <navarro@caraja.(none)>
Tue, 17 Jan 2012 16:47:48 +0000 (17:47 +0100)
19 files changed:
examples/msg/chord/chord.c
examples/msg/chord/chord_stateful.c
examples/msg/gtnets/gtnets.c
examples/msg/icomms/peer.c
examples/msg/icomms/peer2.c
examples/msg/icomms/peer3.c
examples/msg/masterslave/masterslave_bypass.c
examples/msg/masterslave/masterslave_cluster.c
examples/msg/masterslave/masterslave_console.c
examples/msg/masterslave/masterslave_failure.c
examples/msg/masterslave/masterslave_forwarder.c
examples/msg/masterslave/masterslave_mailbox.c
examples/msg/parallel_task/parallel_task.c
examples/msg/parallel_task/test_ptask.c
examples/msg/priority/priority.c
examples/msg/sendrecv/sendrecv.c
examples/msg/suspend/suspend.c
examples/msg/token_ring/ring_call.c
teshsuite/msg/get_sender.c

index 2bfaa48..5a18518 100644 (file)
@@ -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);
index 481da7a..5a1c2cf 100644 (file)
@@ -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);
index b60e800..11a895e 100644 (file)
@@ -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);
   }
 
index dff859e..a9fa072 100644 (file)
@@ -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 */
index fde2c5a..9e27e9b 100644 (file)
@@ -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 */
index 410e0f7..a86a0cc 100644 (file)
@@ -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 */
index b35ebe6..4c6f2a8 100644 (file)
@@ -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);
 
index 396b361..7676189 100644 (file)
@@ -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);
index eff5909..5b4a1ab 100644 (file)
@@ -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);
index f93761e..c882244 100644 (file)
@@ -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 */
index 5978b0e..b428b60 100644 (file)
@@ -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 */
index f789f15..551e38b 100644 (file)
@@ -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 */
index ced1cf2..f546f6c 100644 (file)
@@ -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();
index 03c5b94..4417558 100644 (file)
@@ -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 */
index 48aaeaf..e4686cb 100644 (file)
@@ -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 */
index cd5ea88..56bd375 100644 (file)
@@ -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 */
index 2dc8304..e1e2ba8 100644 (file)
 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 */
index 8cdf4e9..be67d1c 100644 (file)
@@ -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();
index aecfda8..6a766c5 100644 (file)
@@ -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);