use of mpi.Intracomm in project twister2 by DSC-SPIDAL.
the class MPIWorkerStarter method startWorkerWithJM.
private void startWorkerWithJM() {
if (JobMasterContext.jobMasterRunsInClient(config)) {
wInfo = createWorkerInfo(config, globalRank);
WorkerRuntime.init(config, job, wInfo, restartCount);
startWorker(MPI.COMM_WORLD);
} else {
// lets broadcast the worker info
// broadcast the port of job master
// when JM is not running in the submitting client,
// it is running at rank 0 of MPI world
// Split JM MPI world and worker MPI worlds
int color = globalRank == 0 ? 0 : 1;
int splittedRank;
Intracomm splittedComm;
try {
splittedComm = MPI.COMM_WORLD.split(color, globalRank);
splittedRank = splittedComm.getRank();
} catch (MPIException e) {
throw new Twister2RuntimeException("Can not split MPI.COMM_WORLD", e);
}
if (globalRank == 0) {
wInfo = createWorkerInfo(config, -1);
} else {
wInfo = createWorkerInfo(config, splittedRank);
}
// broadcast the job master information to all workers
broadCastMasterInformation(globalRank);
if (globalRank == 0) {
startMaster();
} else {
// init WorkerRuntime
WorkerRuntime.init(config, job, wInfo, restartCount);
startWorker(splittedComm);
}
}
}
Aggregations