Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 1 Aug 2016 08:45:28 +0000 (10:45 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 1 Aug 2016 08:45:28 +0000 (10:45 +0200)
include/simgrid/s4u.hpp
include/simgrid/simix.h
src/msg/msg_process.cpp
src/s4u/s4u_actor.cpp
src/simix/libsmx.cpp
src/simix/smx_network.cpp
src/simix/smx_process.cpp
src/simix/smx_process_private.h
src/simix/smx_synchro.cpp
src/smpi/smpi_comm.cpp
src/smpi/smpi_global.cpp

index 4ffe876..7c01396 100644 (file)
@@ -6,17 +6,17 @@
 #ifndef SIMGRID_S4U_S4U_H
 #define SIMGRID_S4U_S4U_H
 
-#include "s4u/Actor.hpp"
-#include "s4u/mailbox.hpp"
-#include "s4u/engine.hpp"
-#include "s4u/host.hpp"
+#include <simgrid/s4u/Activity.hpp>
+#include <simgrid/s4u/Actor.hpp>
+#include <simgrid/s4u/mailbox.hpp>
+#include <simgrid/s4u/engine.hpp>
+#include <simgrid/s4u/host.hpp>
 
-#include "s4u/Mutex.hpp"
-#include "s4u/conditionVariable.hpp"
-#include "s4u/Activity.hpp"
-#include "s4u/comm.hpp"
+#include <simgrid/s4u/Mutex.hpp>
+#include <simgrid/s4u/conditionVariable.hpp>
+#include <simgrid/s4u/comm.hpp>
 
-#include "s4u/storage.hpp"
-#include "s4u/file.hpp"
+#include <simgrid/s4u/storage.hpp>
+#include <simgrid/s4u/file.hpp>
 
 #endif /* SIMGRID_S4U_S4U_H */
index d28bcd8..4d766f2 100644 (file)
@@ -301,8 +301,6 @@ XBT_PUBLIC(int) simcall_process_count(void);
 XBT_PUBLIC(void *) simcall_process_get_data(smx_process_t process);
 XBT_PUBLIC(void) simcall_process_set_data(smx_process_t process, void *data);
 XBT_PUBLIC(void) simcall_process_set_host(smx_process_t process, sg_host_t dest);
-XBT_PUBLIC(int) simcall_process_get_PID(smx_process_t process);
-XBT_PUBLIC(int) simcall_process_get_PPID(smx_process_t process);
 XBT_PUBLIC(int) simcall_process_is_suspended(smx_process_t process);
 XBT_PUBLIC(xbt_dict_t) simcall_process_get_properties(smx_process_t host);
 XBT_PUBLIC(void) simcall_process_set_kill_time(smx_process_t process, double kill_time);
index d68bad5..0a2d2a9 100644 (file)
@@ -363,10 +363,9 @@ int MSG_process_get_PID(msg_process_t process)
 {
   /* Do not raise an exception here: this function is called by the logs
    * and the exceptions, so it would be called back again and again */
-  if (process == nullptr) {
+  if (process == nullptr)
     return 0;
-  }
-  return simcall_process_get_PID(process);
+  return process->pid;
 }
 
 /** \ingroup m_process_management
@@ -377,8 +376,7 @@ int MSG_process_get_PID(msg_process_t process)
  */
 int MSG_process_get_PPID(msg_process_t process)
 {
-  xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
-  return simcall_process_get_PPID(process);
+  return process->ppid;
 }
 
 /** \ingroup m_process_management
index 5ea9f88..68f66fd 100644 (file)
@@ -70,7 +70,7 @@ simgrid::xbt::string Actor::getName() {
 }
 
 int Actor::getPid(){
-  return simcall_process_get_PID(pimpl_);
+  return pimpl_->pid;
 }
 
 void Actor::setKillTime(double time) {
@@ -154,7 +154,7 @@ void send(Mailbox &chan, void *payload, size_t simulatedSize) {
 }
 
 int getPid() {
-  return simcall_process_get_PID(SIMIX_process_self());
+  return SIMIX_process_self()->pid;
 }
 
 }
index 7b69dee..4d68d3d 100644 (file)
@@ -444,28 +444,6 @@ int simcall_process_count(void)
   return simgrid::simix::kernelImmediate(SIMIX_process_count);
 }
 
-/**
- * \ingroup simix_process_management
- * \brief Return the PID of a #smx_process_t.
- * \param process a SIMIX process
- * \return the PID of this process
- */
-int simcall_process_get_PID(smx_process_t process)
-{
-  return SIMIX_process_get_PID(process);
-}
-
-/**
- * \ingroup simix_process_management
- * \brief Return the parent PID of a #smx_process_t.
- * \param process a SIMIX process
- * \return the PID of this process parenrt
- */
-int simcall_process_get_PPID(smx_process_t process)
-{
-  return SIMIX_process_get_PPID(process);
-}
-
 /**
  * \ingroup simix_process_management
  * \brief Return the user data of a #smx_process_t.
index cbc15eb..722116e 100644 (file)
@@ -104,7 +104,7 @@ void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_synchro_t synchro)
       mbox->comm_queue. erase(it);
       return;
     }
-  xbt_die("Cannot remove this comm that is not part of the mailbox");
+  xbt_die("Cannot remove the comm %p that is not part of the mailbox %s",comm, mbox->name);
 }
 
 /**
@@ -194,7 +194,6 @@ XBT_PRIVATE smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_
       other_comm->dst_proc=mbox->permanent_receiver.get();
       other_comm->ref();
       mbox->done_comm_queue.push_back(other_synchro);
-      other_comm->mbox=mbox;
       XBT_DEBUG("pushing a message into the permanent receive fifo %p, comm %p", mbox, &(other_comm));
 
     }else{
index 4e4454a..9d23a07 100644 (file)
@@ -273,13 +273,12 @@ smx_process_t SIMIX_process_create(
     /* Initiliaze data segment to default value */
     SIMIX_segment_index_set(process, -1);
 
-     if (parent_process != nullptr) {
-       process->ppid = SIMIX_process_get_PID(parent_process);
-       /* SMPI process have their own data segment and
-          each other inherit from their father */
+    if (parent_process != nullptr) {
+      process->ppid = parent_process->pid;
+      /* SMPI process have their own data segment and each other inherit from their father */
 #if HAVE_SMPI
-       if(smpi_privatize_global_variables){
-         if( parent_process->pid != 0){
+       if( smpi_privatize_global_variables) {
+         if (parent_process->pid != 0) {
            SIMIX_segment_index_set(process, parent_process->segment_index);
          } else {
            SIMIX_segment_index_set(process, process->pid - 1);
@@ -358,12 +357,11 @@ smx_process_t SIMIX_process_attach(
   /* Initiliaze data segment to default value */
   SIMIX_segment_index_set(process, -1);
   if (parent_process != nullptr) {
-    process->ppid = SIMIX_process_get_PID(parent_process);
-   /* SMPI process have their own data segment and
-      each other inherit from their father */
+    process->ppid = parent_process->pid;
+    /* SMPI process have their own data segment and each other inherit from their father */
 #if HAVE_SMPI
-    if(smpi_privatize_global_variables){
-      if(parent_process->pid != 0){
+    if (smpi_privatize_global_variables) {
+      if (parent_process->pid != 0) {
         SIMIX_segment_index_set(process, parent_process->segment_index);
       } else {
         SIMIX_segment_index_set(process, process->pid - 1);
@@ -676,20 +674,14 @@ int SIMIX_process_count()
   return xbt_swag_size(simix_global->process_list);
 }
 
-int SIMIX_process_get_PID(smx_process_t self){
+int SIMIX_process_get_PID(smx_process_t self)
+{
   if (self == nullptr)
     return 0;
   else
     return self->pid;
 }
 
-int SIMIX_process_get_PPID(smx_process_t self){
-  if (self == nullptr)
-    return 0;
-  else
-    return self->ppid;
-}
-
 void* SIMIX_process_self_get_data()
 {
   smx_process_t self = SIMIX_process_self();
index 195ed7f..bcfe57a 100644 (file)
@@ -130,7 +130,6 @@ XBT_PRIVATE void SIMIX_process_change_host(smx_process_t process,
 XBT_PRIVATE smx_synchro_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer);
 XBT_PRIVATE void SIMIX_process_resume(smx_process_t process, smx_process_t issuer);
 XBT_PRIVATE int SIMIX_process_get_PID(smx_process_t self);
-XBT_PRIVATE int SIMIX_process_get_PPID(smx_process_t self);
 XBT_PRIVATE void* SIMIX_process_get_data(smx_process_t process);
 XBT_PRIVATE void SIMIX_process_set_data(smx_process_t process, void *data);
 XBT_PRIVATE smx_process_t SIMIX_process_get_by_name(const char* name);
index 0db61fd..93120cb 100644 (file)
@@ -167,8 +167,8 @@ void Mutex::unlock(smx_process_t issuer)
 
   /* If the mutex is not owned by the issuer, that's not good */
   if (issuer != this->owner)
-    THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%d), not by you.",
-        this->owner->name.c_str(),SIMIX_process_get_PID(this->owner));
+    THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%ld), not by you.",
+        this->owner->name.c_str(),this->owner->pid);
 
   if (xbt_swag_size(this->sleeping) > 0) {
     /*process to wake up */
index d91a5df..9029fde 100644 (file)
@@ -375,7 +375,7 @@ void smpi_comm_init_smp(MPI_Comm comm){
   int min_index=INT_MAX;//the minimum index will be the leader
   smx_process_t process = nullptr;
   xbt_swag_foreach(process, process_list) {
-    int index = SIMIX_process_get_PID(process) -1;
+    int index = process->pid -1;
 
     if(smpi_group_rank(smpi_comm_group(comm),  index)!=MPI_UNDEFINED){
         intra_comm_size++;
@@ -390,7 +390,7 @@ void smpi_comm_init_smp(MPI_Comm comm){
   i=0;
   process = nullptr;
   xbt_swag_foreach(process, process_list) {
-    int index = SIMIX_process_get_PID(process) -1;
+    int index = process->pid -1;
     if(smpi_group_rank(smpi_comm_group(comm),  index)!=MPI_UNDEFINED){
       smpi_group_set_mapping(group_intra, index, i);
       i++;
index 797873c..7767c88 100644 (file)
@@ -96,16 +96,13 @@ static char *get_mailbox_name_small(char *str, int index)
 
 void smpi_process_init(int *argc, char ***argv)
 {
-  int index=-1;
-  smpi_process_data_t data;
-  smx_process_t proc;
 
   if (argc != nullptr && argv != nullptr) {
-    proc = SIMIX_process_self();
+    smx_process_t proc = SIMIX_process_self();
     SIMIX_process_set_cleanup_function(proc, MSG_process_cleanup_from_SIMIX);
     char* instance_id = (*argv)[1];
     int rank = xbt_str_parse_int((*argv)[2], "Invalid rank: %s");
-    index = smpi_process_index_of_smx_process(proc);
+    int index = smpi_process_index_of_smx_process(proc);
 
     if(index_to_process_data == nullptr){
       index_to_process_data=static_cast<int*>(xbt_malloc(SIMIX_process_count()*sizeof(int)));
@@ -121,8 +118,8 @@ void smpi_process_init(int *argc, char ***argv)
     MPI_Comm* temp_comm_world;
     xbt_bar_t temp_bar;
     smpi_deployment_register_process(instance_id, rank, index, &temp_comm_world, &temp_bar);
-    data              = smpi_process_remote_data(index);
-    data->comm_world  = temp_comm_world;
+    smpi_process_data_t data = smpi_process_remote_data(index);
+    data->comm_world         = temp_comm_world;
     if(temp_bar != nullptr) 
       data->finalization_barrier = temp_bar;
     data->index       = index;
@@ -145,8 +142,8 @@ void smpi_process_init(int *argc, char ***argv)
     XBT_DEBUG("<%d> New process in the game: %p", index, proc);
   }
   xbt_assert(smpi_process_data(),
-      "smpi_process_data() returned nullptr. You probably gave a nullptr parameter to MPI_Init. Although it's required by "
-      "MPI-2, this is currently not supported by SMPI.");
+      "smpi_process_data() returned nullptr. You probably gave a nullptr parameter to MPI_Init. "
+      "Although it's required by MPI-2, this is currently not supported by SMPI.");
 }
 
 void smpi_process_destroy()