void smpi_global_init()
{
- int i;
MPI_Group group;
- int smpirun=0;
if (!MC_is_active()) {
global_timer = xbt_os_timer_new();
}
}
#endif
+
+ int smpirun = 0;
if (process_count == 0){
process_count = SIMIX_process_count();
smpirun=1;
}
smpi_universe_size = process_count;
process_data = new simgrid::smpi::Process*[process_count];
- for (i = 0; i < process_count; i++) {
- process_data[i] = new simgrid::smpi::Process(i);
+ for (int i = 0; i < process_count; i++) {
+ process_data[i] = new simgrid::smpi::Process(i);
}
//if the process was launched through smpirun script we generate a global mpi_comm_world
//if not, we let MPI_COMM_NULL, and the comm world will be private to each mpi instance
- if(smpirun){
+ if (smpirun) {
group = new simgrid::smpi::Group(process_count);
MPI_COMM_WORLD = new simgrid::smpi::Comm(group, nullptr);
MPI_Attr_put(MPI_COMM_WORLD, MPI_UNIVERSE_SIZE, reinterpret_cast<void *>(process_count));
msg_bar_t bar = MSG_barrier_init(process_count);
- for (i = 0; i < process_count; i++) {
+ for (int i = 0; i < process_count; i++) {
group->set_mapping(i, i);
process_data[i]->set_finalization_barrier(bar);
}
mailboxes_mutex_ = xbt_mutex_init();
timer_ = xbt_os_timer_new();
state_ = SMPI_UNINITIALIZED;
+ index_ = index;
if (MC_is_active())
MC_ignore_heap(timer_, xbt_os_timer_size());
#endif
}
-void Process::set_data(int index, int *argc, char ***argv)
+void Process::set_data(int* argc, char*** argv)
{
char* instance_id = (*argv)[1];
msg_bar_t bar = smpi_deployment_finalization_barrier(instance_id);
if (bar!=nullptr) // don't overwrite the default one
finalization_barrier_ = bar;
- index_ = index;
instance_id_ = instance_id;
static_cast<simgrid::MsgActorExt*>(SIMIX_process_self()->data)->data = this;
// set the process attached to the mailbox
mailbox_small_->setReceiver(simgrid::s4u::Actor::self());
process_ = SIMIX_process_self();
- XBT_DEBUG("<%d> New process in the game: %p", index, SIMIX_process_self());
+ XBT_DEBUG("<%d> New process in the game: %p", index_, SIMIX_process_self());
}
void Process::destroy()
}
Process* process = smpi_process_remote(index);
- process->set_data(index, argc, argv);
+ process->set_data(argc, argv);
}
xbt_assert(smpi_process(),
"smpi_process() returned nullptr. You probably gave a nullptr parameter to MPI_Init. "