Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
blah
authormarkls <markls@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sun, 23 Dec 2007 06:17:02 +0000 (06:17 +0000)
committermarkls <markls@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sun, 23 Dec 2007 06:17:02 +0000 (06:17 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5156 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/smpi/private.h
src/smpi/smpi_receiver.c
src/smpi/smpi_sender.c

index 69d63f5..dccaec0 100644 (file)
@@ -66,6 +66,8 @@ typedef struct smpi_received_message_t {
        void *data;
        int forward;
 
        void *data;
        int forward;
 
+       smx_action_t action;
+
 } s_smpi_received_message_t;
 typedef struct smpi_received_message_t *smpi_received_message_t;
 
 } s_smpi_received_message_t;
 typedef struct smpi_received_message_t *smpi_received_message_t;
 
index edfb213..34a6280 100644 (file)
@@ -66,9 +66,12 @@ int smpi_receiver(int argc, char **argv)
                                NULL != message_item;
                                message_item = xbt_fifo_get_next_item(message_item)) {
                                message = xbt_fifo_get_item_content(message_item);
                                NULL != message_item;
                                message_item = xbt_fifo_get_next_item(message_item)) {
                                message = xbt_fifo_get_item_content(message_item);
-                               if (request->comm == message->comm &&
-                                  (MPI_ANY_SOURCE == request->src || request->src == message->src) &&
-                                  (MPI_ANY_TAG == request->tag || request->tag == message->tag)) {
+                               if (
+                                       request->comm == message->comm &&
+                                       (MPI_ANY_SOURCE == request->src || request->src == message->src) &&
+                                       (MPI_ANY_TAG == request->tag || request->tag == message->tag) &&
+                                       (message->action != SURF_ACTION_READY && message->action != SURF_ACTION_RUNNING)
+                               ) {
                                        xbt_fifo_remove_item(request_queue, request_item);
                                        xbt_fifo_remove_item(message_queue, message_item);
                                        goto stopsearch;
                                        xbt_fifo_remove_item(request_queue, request_item);
                                        xbt_fifo_remove_item(message_queue, message_item);
                                        goto stopsearch;
index a03b421..0c84106 100644 (file)
@@ -94,6 +94,12 @@ int smpi_sender(int argc, char **argv)
 
                        action = SIMIX_action_communicate(shost, dhost, "communication", request->datatype->size * request->count, -1.0);
 
 
                        action = SIMIX_action_communicate(shost, dhost, "communication", request->datatype->size * request->count, -1.0);
 
+                       message->action = action;
+
+                       SIMIX_mutex_lock(smpi_global->received_message_queues_mutexes[dindex]);
+                       xbt_fifo_push(smpi_global->received_message_queues[dindex], message);
+                       SIMIX_mutex_unlock(smpi_global->received_message_queues_mutexes[dindex]);
+
                        SIMIX_register_action_to_condition(action, request->cond);
 
                        for (
                        SIMIX_register_action_to_condition(action, request->cond);
 
                        for (
@@ -110,10 +116,6 @@ int smpi_sender(int argc, char **argv)
 
                        SIMIX_mutex_unlock(request->mutex);
 
 
                        SIMIX_mutex_unlock(request->mutex);
 
-                       SIMIX_mutex_lock(smpi_global->received_message_queues_mutexes[dindex]);
-                       xbt_fifo_push(smpi_global->received_message_queues[dindex], message);
-                       SIMIX_mutex_unlock(smpi_global->received_message_queues_mutexes[dindex]);
-
                        // wake up receiver if necessary
                        receiver_process = smpi_global->receiver_processes[dindex];
                        if (SIMIX_process_is_suspended(receiver_process)) {
                        // wake up receiver if necessary
                        receiver_process = smpi_global->receiver_processes[dindex];
                        if (SIMIX_process_is_suspended(receiver_process)) {