#include "smpi_process.hpp"
#include "mc/mc.h"
#include "private.hpp"
+#include "simgrid/s4u/forward.hpp"
#include "smpi_comm.hpp"
#include "smpi_group.hpp"
#include "src/mc/mc_replay.hpp"
namespace simgrid{
namespace smpi{
-Process::Process(int index, msg_bar_t finalization_barrier)
+using simgrid::s4u::ActorPtr;
+
+Process::Process(ActorPtr actor, msg_bar_t finalization_barrier)
: finalization_barrier_(finalization_barrier)
{
char name[MAILBOX_NAME_MAXLEN];
+ process_ = actor;
+ int index = actor->getPid() - 1; // TODO cheinrich: This needs to be removed! Just a quick hack to make the following 2 lines work
mailbox_ = simgrid::s4u::Mailbox::byName(get_mailbox_name(name, index));
mailbox_small_ = simgrid::s4u::Mailbox::byName(get_mailbox_name_small(name, index));
mailboxes_mutex_ = xbt_mutex_init();
instance_id_ = instance_id;
index_ = index;
- process_ = SIMIX_process_self();
- static_cast<simgrid::msg::ActorExt*>(process_->userdata)->data = this;
+ process_ = simgrid::s4u::Actor::self();
+ static_cast<simgrid::msg::ActorExt*>(process_->getImpl()->userdata)->data = this;
if (*argc > 3) {
memmove(&(*argv)[0], &(*argv)[2], sizeof(char *) * (*argc - 2));
return data_;
}
-smx_actor_t Process::process(){
+ActorPtr Process::process(){
return process_;
}
if(comm_self_==MPI_COMM_NULL){
MPI_Group group = new Group(1);
comm_self_ = new Comm(group, nullptr);
- group->set_mapping(index_, 0);
+ group->set_mapping(process_, 0);
}
return comm_self_;
}
xbt_die("SimGrid was not initialized properly before entering MPI_Init. Aborting, please check compilation process and use smpirun\n");
}
if (argc != nullptr && argv != nullptr) {
- smx_actor_t proc = SIMIX_process_self();
- proc->context->set_cleanup(&MSG_process_cleanup_from_SIMIX);
+ simgrid::s4u::ActorPtr proc = simgrid::s4u::Actor::self();
+ proc->getImpl()->context->set_cleanup(&MSG_process_cleanup_from_SIMIX);
- int index = proc->pid - 1; // The maestro process has always ID 0 but we don't need that process here
+ int index = proc->getPid() - 1; // The maestro process has always ID 0 but we don't need that process here
char* instance_id = (*argv)[1];
try {
// cheinrich: I'm not sure what the impact of the SMPI_switch_data_segment on this call is. I moved
// this up here so that I can set the privatized region before the switch.
- Process* process = smpi_process_remote(index);
+ Process* process = smpi_process_remote(proc);
if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){
/* Now using the segment index of this process */
- index = proc->segment_index;
+ index = proc->getImpl()->segment_index;
process->set_privatized_region(smpi_init_global_memory_segment_process());
/* Done at the process's creation */
SMPI_switch_data_segment(index);