: name(name)
, size(max_no_processes)
, present_processes(0)
- , index(process_count)
, comm_world(comm)
, finalization_barrier(finalization_barrier)
- {
- }
+ { }
const char* name;
int size;
int present_processes;
- int index; // Badly named. This should be "no_processes_when_registering" ;)
MPI_Comm comm_world;
msg_bar_t finalization_barrier;
};
static std::map<std::string, Instance> smpi_instances;
extern int process_count; // How many processes have been allocated over all instances?
-extern int* index_to_process_data;
/** \ingroup smpi_simulation
* \brief Registers a running instance of a MPI program.
static int already_called = 0;
if (not already_called) {
already_called = 1;
- std::vector<simgrid::s4u::Host*> list;
- simgrid::s4u::Engine::getInstance()->getHostList(&list);
+ std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->getAllHosts();
for (auto const& host : list) {
host->extension_set(new simgrid::smpi::SmpiHost(host));
}
smpi_instances.insert(std::pair<std::string, Instance>(name, instance));
}
-//get the index of the process in the process_data array
-void smpi_deployment_register_process(const char* instance_id, int rank, int index)
+void smpi_deployment_register_process(const char* instance_id, int rank, simgrid::s4u::ActorPtr actor)
{
- if (smpi_instances.empty()) { // no instance registered, we probably used smpirun.
- index_to_process_data[index]=index;
+ if (smpi_instances.empty()) // no instance registered, we probably used smpirun.
return;
- }
Instance& instance = smpi_instances.at(instance_id);
instance.present_processes++;
- index_to_process_data[index] = instance.index + rank;
- instance.comm_world->group()->set_mapping(index, rank);
+ instance.comm_world->group()->set_mapping(actor, rank);
}
-//get the index of the process in the process_data array
MPI_Comm* smpi_deployment_comm_world(const char* instance_id)
{
if (smpi_instances.empty()) { // no instance registered, we probably used smpirun.