Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Taking into account last SURF modifications (suspend, resume and is_suspended moved...
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sat, 15 Jan 2005 00:54:20 +0000 (00:54 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sat, 15 Jan 2005 00:54:20 +0000 (00:54 +0000)
Introducing a new convenient function: MSG_task_put_bounded

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@760 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/msg/msg.h
src/msg/environment.c
src/msg/gos.c
src/msg/m_process.c
src/msg/private.h
src/msg/task.c

index 2202096..b431910 100644 (file)
@@ -79,6 +79,9 @@ MSG_error_t MSG_task_destroy(m_task_t task);
 MSG_error_t MSG_task_get(m_task_t * task, m_channel_t channel);
 MSG_error_t MSG_task_put(m_task_t task, m_host_t dest, 
                         m_channel_t channel);
+MSG_error_t MSG_task_put_bounded(m_task_t task,
+                                m_host_t dest, m_channel_t channel,
+                                long double max_rate);
 MSG_error_t MSG_task_execute(m_task_t task);
 int MSG_task_Iprobe(m_channel_t channel);
 int MSG_task_probe_from(m_channel_t channel);
index 1bb3d29..942ed2a 100644 (file)
@@ -64,7 +64,8 @@ void MSG_create_environment(const char *file) {
   char *name = NULL;
   void *workstation = NULL;
 
-  surf_workstation_resource_init_CLM03(file);
+/*   surf_workstation_resource_init_CLM03(file); */
+  surf_workstation_resource_init_KCCFLN05(file);
 
   xbt_dict_foreach(workstation_set, cursor, name, workstation) {
     __MSG_host_create(name, workstation, NULL);
index 7e7a349..77fa324 100644 (file)
@@ -75,9 +75,11 @@ MSG_error_t MSG_task_get(m_task_t * task,
 
   /* Transfer */
   t_simdata->using++;
+
   t_simdata->comm = surf_workstation_resource->extension_public->
     communicate(MSG_process_get_host(t_simdata->sender)->simdata->host,
-               h->simdata->host, t_simdata->message_size);
+               h->simdata->host, t_simdata->message_size,t_simdata->rate);
+  
   surf_workstation_resource->common_public->action_set_data(t_simdata->comm,t);
 
   if(__MSG_process_isBlocked(t_simdata->sender)) 
@@ -189,14 +191,14 @@ MSG_error_t MSG_task_put(m_task_t task,
     
   if(remote_host->simdata->sleeping[channel]) 
     __MSG_process_unblock(remote_host->simdata->sleeping[channel]);
-  else {
+/*   else { */
     process->simdata->put_host = dest;
     process->simdata->put_channel = channel;
     while(!(task_simdata->comm)) 
       __MSG_process_block();
     process->simdata->put_host = NULL;
     process->simdata->put_channel = -1;
-  }
+/*   } */
 
   do {
     __MSG_task_wait_event(process, task);
@@ -212,6 +214,14 @@ MSG_error_t MSG_task_put(m_task_t task,
   else MSG_RETURN(MSG_TRANSFER_FAILURE);
 }
 
+MSG_error_t MSG_task_put_bounded(m_task_t task,
+                                m_host_t dest, m_channel_t channel,
+                                long double max_rate)
+{
+  task->simdata->rate=max_rate;
+  return(MSG_task_put(task, dest, channel));
+}
+
 /** \ingroup msg_gos_functions
  * \brief Executes a task and waits for its termination.
  *
index fc9d302..af8e813 100644 (file)
@@ -285,9 +285,9 @@ MSG_error_t MSG_process_suspend(m_process_t process)
                "Got a problem in deciding which action to choose !");
     simdata->suspended = 1;
     if(simdata_task->compute) 
-      surf_workstation_resource->extension_public->suspend(simdata_task->compute);
+      surf_workstation_resource->common_public->suspend(simdata_task->compute);
     else
-      surf_workstation_resource->extension_public->suspend(simdata_task->comm);
+      surf_workstation_resource->common_public->suspend(simdata_task->comm);
   } else {
     m_task_t dummy = MSG_TASK_UNINITIALIZED;
     dummy = MSG_task_create("suspended", 0.0, 0, NULL);
@@ -295,7 +295,7 @@ MSG_error_t MSG_process_suspend(m_process_t process)
     simdata = process->simdata;
     simdata->suspended = 1;
     __MSG_task_execute(process,dummy);
-    surf_workstation_resource->extension_public->suspend(dummy->simdata->compute);
+    surf_workstation_resource->common_public->suspend(dummy->simdata->compute);
     __MSG_wait_for_computation(process,dummy);
     simdata->suspended = 0;
 
@@ -334,9 +334,9 @@ MSG_error_t MSG_process_resume(m_process_t process)
 
 
   if(simdata_task->compute) 
-    surf_workstation_resource->extension_public->resume(simdata_task->compute);
+    surf_workstation_resource->common_public->resume(simdata_task->compute);
   else 
-    surf_workstation_resource->extension_public->resume(simdata_task->comm);
+    surf_workstation_resource->common_public->resume(simdata_task->comm);
 
   MSG_RETURN(MSG_OK);
 }
@@ -367,7 +367,7 @@ MSG_error_t __MSG_process_block(void)
   
   process->simdata->blocked=1;
   __MSG_task_execute(process,dummy);
-  surf_workstation_resource->extension_public->suspend(dummy->simdata->compute);
+  surf_workstation_resource->common_public->suspend(dummy->simdata->compute);
   __MSG_wait_for_computation(process,dummy);
   process->simdata->blocked=0;
 
@@ -397,7 +397,7 @@ MSG_error_t __MSG_process_unblock(m_process_t process)
 
   xbt_assert0(simdata->blocked,"Process not blocked");
 
-  surf_workstation_resource->extension_public->resume(simdata_task->compute);
+  surf_workstation_resource->common_public->resume(simdata_task->compute);
 
   MSG_RETURN(MSG_OK);
 }
index d7fa359..4e47231 100644 (file)
@@ -35,6 +35,7 @@ typedef struct simdata_task {
   double computation_amount;   /* Computation size  */
   xbt_dynar_t sleeping;                /* process to wake-up */
   m_process_t sender;
+  double rate;
   int using;
 } s_simdata_task_t;
 
index af973f0..007160c 100644 (file)
@@ -48,9 +48,11 @@ m_task_t MSG_task_create(const char *name, long double compute_duration,
   simdata->sleeping = xbt_dynar_new(sizeof(m_process_t),NULL);
   simdata->computation_amount = compute_duration;
   simdata->message_size = message_size;
+  simdata->rate = -1.0;
   simdata->using = 1;
   simdata->sender = NULL;
 
+
   return task;
 }