Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
authormlaurent <mathieu.laurent@ens-rennes.fr>
Fri, 16 Jun 2023 08:37:21 +0000 (10:37 +0200)
committermlaurent <mathieu.laurent@ens-rennes.fr>
Fri, 16 Jun 2023 08:37:21 +0000 (10:37 +0200)
1  2 
src/kernel/actor/CommObserver.cpp
src/mc/transition/TransitionComm.cpp

@@@ -16,9 -16,8 +16,9 @@@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(obs_com
  
  namespace simgrid::kernel::actor {
  
 -ActivityTestanySimcall::ActivityTestanySimcall(ActorImpl* actor, const std::vector<activity::ActivityImpl*>& activities)
 -    : ResultingSimcall(actor, -1), activities_(activities)
 +ActivityTestanySimcall::ActivityTestanySimcall(ActorImpl* actor, const std::vector<activity::ActivityImpl*>& activities,
 +                                               std::string fun_call)
 +    : ResultingSimcall(actor, -1), activities_(activities), fun_call_(fun_call)
  {
    indexes_.clear();
    // list all the activities that are ready
@@@ -43,7 -42,7 +43,7 @@@ static void serialize_activity_test(con
  {
    if (const auto* comm = dynamic_cast<activity::CommImpl const*>(act)) {
      stream << "  " << (short)mc::Transition::Type::COMM_TEST;
-     stream << ' ' << (uintptr_t)comm;
+     stream << ' ' << comm->get_id();
      stream << ' ' << (comm->src_actor_ != nullptr ? comm->src_actor_->get_pid() : -1);
      stream << ' ' << (comm->dst_actor_ != nullptr ? comm->dst_actor_->get_pid() : -1);
      stream << ' ' << comm->get_mailbox_id();
@@@ -57,7 -56,7 +57,7 @@@ static std::string to_string_activity_t
    if (const auto* comm = dynamic_cast<activity::CommImpl const*>(act)) {
      const std::string src_buff_id = ptr_to_id<unsigned char>(comm->src_buff_);
      const std::string dst_buff_id = ptr_to_id<unsigned char>(comm->dst_buff_);
-     return "CommTest(comm_id:" + ptr_to_id<activity::CommImpl const>(comm) +
+     return "CommTest(comm_id:" + std::to_string(comm->get_id()) +
             " src:" + std::to_string(comm->src_actor_ != nullptr ? comm->src_actor_->get_pid() : -1) +
             " dst:" + std::to_string(comm->dst_actor_ != nullptr ? comm->dst_actor_->get_pid() : -1) +
             " mbox:" + std::to_string(comm->get_mailbox_id()) + " srcbuf:" + src_buff_id + " dstbuf:" + dst_buff_id +
@@@ -73,7 -72,6 +73,7 @@@ void ActivityTestanySimcall::serialize(
      serialize_activity_test(act, stream);
      stream << ' ';
    }
 +  stream << fun_call_;
  }
  std::string ActivityTestanySimcall::to_string() const
  {
@@@ -87,7 -85,6 +87,7 @@@
  void ActivityTestSimcall::serialize(std::stringstream& stream) const
  {
    serialize_activity_test(activity_, stream);
 +  stream << ' ' << fun_call_;
  }
  std::string ActivityTestSimcall::to_string() const
  {
@@@ -97,7 -94,7 +97,7 @@@ static void serialize_activity_wait(con
  {
    if (const auto* comm = dynamic_cast<activity::CommImpl const*>(act)) {
      stream << (short)mc::Transition::Type::COMM_WAIT << ' ';
-     stream << timeout << ' ' << (uintptr_t)comm;
+     stream << timeout << ' ' << comm->get_id();
  
      stream << ' ' << (comm->src_actor_ != nullptr ? comm->src_actor_->get_pid() : -1);
      stream << ' ' << (comm->dst_actor_ != nullptr ? comm->dst_actor_->get_pid() : -1);
@@@ -112,7 -109,7 +112,7 @@@ static std::string to_string_activity_w
    if (const auto* comm = dynamic_cast<activity::CommImpl const*>(act)) {
      const std::string src_buff_id = ptr_to_id<unsigned char>(comm->src_buff_);
      const std::string dst_buff_id = ptr_to_id<unsigned char>(comm->dst_buff_);
-     return "CommWait(comm_id:" + ptr_to_id<activity::CommImpl const>(comm) +
+     return "CommWait(comm_id:" + std::to_string(comm->get_id()) +
             " src:" + std::to_string(comm->src_actor_ != nullptr ? comm->src_actor_->get_pid() : -1) +
             " dst:" + std::to_string(comm->dst_actor_ != nullptr ? comm->dst_actor_->get_pid() : -1) +
             " mbox:" + (comm->get_mailbox() == nullptr ? "-" : comm->get_mailbox()->get_name()) +
  void ActivityWaitSimcall::serialize(std::stringstream& stream) const
  {
    serialize_activity_wait(activity_, timeout_ > 0, stream);
 +  stream << ' ' << fun_call_;
  }
  void ActivityWaitanySimcall::serialize(std::stringstream& stream) const
  {
      serialize_activity_wait(act, timeout_ > 0, stream);
      stream << ' ';
    }
 +  stream << fun_call_;
  }
  std::string ActivityWaitSimcall::to_string() const
  {
@@@ -150,8 -145,8 +150,8 @@@ std::string ActivityWaitanySimcall::to_
    return buffer.str();
  }
  ActivityWaitanySimcall::ActivityWaitanySimcall(ActorImpl* actor, const std::vector<activity::ActivityImpl*>& activities,
 -                                               double timeout)
 -    : ResultingSimcall(actor, -1), activities_(activities), timeout_(timeout)
 +                                               double timeout, std::string fun_call)
 +    : ResultingSimcall(actor, -1), activities_(activities), timeout_(timeout), fun_call_(fun_call)
  {
    // list all the activities that are ready
    indexes_.clear();
@@@ -204,15 -199,14 +204,15 @@@ void CommIsendSimcall::serialize(std::s
  {
    /* Note that the comm_ is 0 until after the execution of the simcall */
    stream << (short)mc::Transition::Type::COMM_ASYNC_SEND << ' ';
-   stream << (uintptr_t)comm_ << ' ' << mbox_->get_id() << ' ' << (uintptr_t)src_buff_ << ' ' << src_buff_size_ << ' '
-          << tag_;
+   stream << (comm_ ? comm_->get_id() : 0) << ' ' << mbox_->get_id() << ' ' << (uintptr_t)src_buff_ << ' '
+          << src_buff_size_ << ' ' << tag_;
    XBT_DEBUG("SendObserver comm:%p mbox:%u buff:%p size:%zu tag:%d", comm_, mbox_->get_id(), src_buff_, src_buff_size_,
              tag_);
 +  stream << ' ' << fun_call_;
  }
  std::string CommIsendSimcall::to_string() const
  {
-   return "CommAsyncSend(comm_id: " + std::to_string((uintptr_t)comm_) + " mbox:" + std::to_string(mbox_->get_id()) +
+   return "CommAsyncSend(comm_id: " + std::to_string(comm_->get_id()) + " mbox:" + std::to_string(mbox_->get_id()) +
           " srcbuf:" + ptr_to_id<unsigned char>(src_buff_) + " bufsize:" + std::to_string(src_buff_size_) +
           " tag: " + std::to_string(tag_) + ")";
  }
@@@ -221,15 -215,13 +221,14 @@@ void CommIrecvSimcall::serialize(std::s
  {
    /* Note that the comm_ is 0 until after the execution of the simcall */
    stream << (short)mc::Transition::Type::COMM_ASYNC_RECV << ' ';
-   stream << (uintptr_t)comm_ << ' ' << mbox_->get_id() << ' ' << (uintptr_t)dst_buff_ << ' ' << tag_;
+   stream << (comm_ ? comm_->get_id() : 0) << ' ' << mbox_->get_id() << ' ' << (uintptr_t)dst_buff_ << ' ' << tag_;
    XBT_DEBUG("RecvObserver comm:%p mbox:%u buff:%p tag:%d", comm_, mbox_->get_id(), dst_buff_, tag_);
 +  stream << ' ' << fun_call_;
  }
  std::string CommIrecvSimcall::to_string() const
  {
-   return "CommAsyncRecv(comm_id: " + ptr_to_id<activity::CommImpl const>(comm_) +
-          " mbox:" + std::to_string(mbox_->get_id()) + " dstbuf:" + ptr_to_id<unsigned char>(dst_buff_) +
-          " tag: " + std::to_string(tag_) + ")";
+   return "CommAsyncRecv(comm_id: " + std::to_string(comm_->get_id()) + " mbox:" + std::to_string(mbox_->get_id()) +
+          " dstbuf:" + ptr_to_id<unsigned char>(dst_buff_) + " tag: " + std::to_string(tag_) + ")";
  }
  
  } // namespace simgrid::kernel::actor
@@@ -18,15 -18,15 +18,15 @@@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_tran
  
  namespace simgrid::mc {
  
- CommWaitTransition::CommWaitTransition(aid_t issuer, int times_considered, bool timeout_, uintptr_t comm_,
-                                        aid_t sender_, aid_t receiver_, unsigned mbox_, uintptr_t sbuff_,
-                                        uintptr_t rbuff_, size_t size_)
+ CommWaitTransition::CommWaitTransition(aid_t issuer, int times_considered, bool timeout_, unsigned comm_, aid_t sender_,
+                                        aid_t receiver_, unsigned mbox_, uintptr_t sbuff_, uintptr_t rbuff_,
+                                        size_t size_)
      : Transition(Type::COMM_WAIT, issuer, times_considered)
      , timeout_(timeout_)
      , comm_(comm_)
+     , mbox_(mbox_)
      , sender_(sender_)
      , receiver_(receiver_)
-     , mbox_(mbox_)
      , sbuff_(sbuff_)
      , rbuff_(rbuff_)
      , size_(size_)
  CommWaitTransition::CommWaitTransition(aid_t issuer, int times_considered, std::stringstream& stream)
      : Transition(Type::COMM_WAIT, issuer, times_considered)
  {
 -  xbt_assert(stream >> timeout_ >> comm_ >> sender_ >> receiver_ >> mbox_ >> sbuff_ >> rbuff_ >> size_);
 +  xbt_assert(stream >> timeout_ >> comm_ >> sender_ >> receiver_ >> mbox_ >> sbuff_ >> rbuff_ >> size_ >>
 +             user_fun_call_);
-   XBT_DEBUG("CommWaitTransition %s comm:%" PRIxPTR ", sender:%ld receiver:%ld mbox:%u sbuff:%" PRIxPTR
-             " rbuff:%" PRIxPTR " size:%zu",
+   XBT_DEBUG("CommWaitTransition %s comm:%u, sender:%ld receiver:%ld mbox:%u sbuff:%" PRIxPTR " rbuff:%" PRIxPTR
+             " size:%zu",
              (timeout_ ? "timeout" : "no-timeout"), comm_, sender_, receiver_, mbox_, sbuff_, rbuff_, size_);
  }
  std::string CommWaitTransition::to_string(bool verbose) const
@@@ -68,14 -67,14 +68,14 @@@ bool CommWaitTransition::depends(const 
  
    return false; // Comm transitions are INDEP with non-comm transitions
  }
- CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, uintptr_t comm_, aid_t sender_,
+ CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, unsigned comm_, aid_t sender_,
                                         aid_t receiver_, unsigned mbox_, uintptr_t sbuff_, uintptr_t rbuff_,
                                         size_t size_)
      : Transition(Type::COMM_TEST, issuer, times_considered)
      , comm_(comm_)
+     , mbox_(mbox_)
      , sender_(sender_)
      , receiver_(receiver_)
-     , mbox_(mbox_)
      , sbuff_(sbuff_)
      , rbuff_(rbuff_)
      , size_(size_)
@@@ -84,8 -83,8 +84,8 @@@
  CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, std::stringstream& stream)
      : Transition(Type::COMM_TEST, issuer, times_considered)
  {
 -  xbt_assert(stream >> comm_ >> sender_ >> receiver_ >> mbox_ >> sbuff_ >> rbuff_ >> size_);
 +  xbt_assert(stream >> comm_ >> sender_ >> receiver_ >> mbox_ >> sbuff_ >> rbuff_ >> size_ >> user_fun_call_);
-   XBT_DEBUG("CommTestTransition comm:%" PRIxPTR ", sender:%ld receiver:%ld mbox:%u sbuff:%" PRIxPTR " rbuff:%" PRIxPTR
+   XBT_DEBUG("CommTestTransition comm:%u, sender:%ld receiver:%ld mbox:%u sbuff:%" PRIxPTR " rbuff:%" PRIxPTR
              " size:%zu",
              comm_, sender_, receiver_, mbox_, sbuff_, rbuff_, size_);
  }
@@@ -122,7 -121,7 +122,7 @@@ bool CommTestTransition::depends(const 
    return false; // Comm transitions are INDEP with non-comm transitions
  }
  
- CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, uintptr_t comm_, unsigned mbox_,
+ CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_,
                                         uintptr_t rbuff_, int tag_)
      : Transition(Type::COMM_ASYNC_RECV, issuer, times_considered)
      , comm_(comm_)
  CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, std::stringstream& stream)
      : Transition(Type::COMM_ASYNC_RECV, issuer, times_considered)
  {
 -  xbt_assert(stream >> comm_ >> mbox_ >> rbuff_ >> tag_);
 +  xbt_assert(stream >> comm_ >> mbox_ >> rbuff_ >> tag_ >> user_fun_call_);
  }
  std::string CommRecvTransition::to_string(bool verbose) const
  {
@@@ -163,7 -162,7 +163,7 @@@ bool CommRecvTransition::depends(const 
      if (mbox_ != test->mbox_)
        return false;
  
-     if ((aid_ != test->sender_) && (aid_ != test->receiver_) && (test->rbuff_ != rbuff_))
+     if ((aid_ != test->sender_) && (aid_ != test->receiver_))
        return false;
  
      // If the test is checking a paired comm already, we're independent!
      if (mbox_ != wait->mbox_)
        return false;
  
-     if ((aid_ != wait->sender_) && (aid_ != wait->receiver_) && (wait->rbuff_ != rbuff_))
+     if ((aid_ != wait->sender_) && (aid_ != wait->receiver_))
        return false;
  
      // If the wait is waiting on a paired comm already, we're independent!
    return false; // Comm transitions are INDEP with non-comm transitions
  }
  
- CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, uintptr_t comm_, unsigned mbox_,
+ CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_,
                                         uintptr_t sbuff_, size_t size_, int tag_)
      : Transition(Type::COMM_ASYNC_SEND, issuer, times_considered)
      , comm_(comm_)
  CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, std::stringstream& stream)
      : Transition(Type::COMM_ASYNC_SEND, issuer, times_considered)
  {
 -  xbt_assert(stream >> comm_ >> mbox_ >> sbuff_ >> size_ >> tag_);
 +  xbt_assert(stream >> comm_ >> mbox_ >> sbuff_ >> size_ >> tag_ >> user_fun_call_);
-   XBT_DEBUG("SendTransition comm:%" PRIxPTR " mbox:%u sbuff:%" PRIxPTR " size:%zu", comm_, mbox_, sbuff_, size_);
+   XBT_DEBUG("SendTransition comm:%u mbox:%u sbuff:%" PRIxPTR " size:%zu", comm_, mbox_, sbuff_, size_);
  }
  std::string CommSendTransition::to_string(bool verbose = false) const
  {
@@@ -239,7 -238,7 +239,7 @@@ bool CommSendTransition::depends(const 
      if (mbox_ != test->mbox_)
        return false;
  
-     if ((aid_ != test->sender_) && (aid_ != test->receiver_) && (test->sbuff_ != sbuff_))
+     if ((aid_ != test->sender_) && (aid_ != test->receiver_))
        return false;
  
      // If the test is checking a paired comm already, we're independent!
      if (mbox_ != wait->mbox_)
        return false;
  
-     if ((aid_ != wait->sender_) && (aid_ != wait->receiver_) && (wait->sbuff_ != sbuff_))
+     if ((aid_ != wait->sender_) && (aid_ != wait->receiver_))
        return false;
  
      // If the wait is waiting on a paired comm already, we're independent!