/** * Spawn mpi slaves, get their handshakes, tell the slaves to exit. * This is used to initialize (and test) the basic MPI functionality. * It also has the side-effect of cleaning any MPI-related state left * in the filesystem by the previous incarnation (i.e. process) of this instance. */ shared_ptr<Array> execute(std::vector< shared_ptr<Array> >& inputArrays, shared_ptr<Query> query) { MpiManager::getInstance()->forceInitMpi(); launchMPISlaves(query, query->getInstancesCount()); boost::shared_ptr<MpiSlaveProxy> slave = _ctx->getSlave(_launchId); mpi::Command cmd; cmd.setCmd(string("EXIT")); slave->sendCommand(cmd, _ctx); slave->waitForExit(_ctx); // wait for the slave to disconnect unlaunchMPISlaves(); resetMPI(); return shared_ptr<Array> (new MemArray(_schema,query)); }
/// Cleanup the context created by launchMPISlaves() on the instance not participating in the launch void unlaunchMPISlavesNonParticipating() { unlaunchMPISlaves(); }