本文整理汇总了C++中InterColComm::globalCommRank方法的典型用法代码示例。如果您正苦于以下问题:C++ InterColComm::globalCommRank方法的具体用法?C++ InterColComm::globalCommRank怎么用?C++ InterColComm::globalCommRank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InterColComm
的用法示例。
在下文中一共展示了InterColComm::globalCommRank方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outputState
/**
* @time
* @l
*/
int GradientCheckProbe::outputState(double timed)
{
#ifdef PV_USE_MPI
InterColComm * icComm = parent->icCommunicator();
MPI_Comm comm = icComm->globalCommunicator();
int rank = icComm->globalCommRank();
#endif // PV_USE_MPI
std::cout << name << " probeOutputState on timestep " << timed << "\n";
return PV_SUCCESS;
}
示例2: main
int main(int argc, char * argv[]) {
PV_Init* initObj = new PV_Init(&argc, &argv, false/*allowUnrecognizedArguments*/);
InterColComm * icComm = new InterColComm(initObj->getArguments());
PV_Arguments * arguments = initObj->getArguments();
if (arguments->getParamsFile() != NULL) {
int rank = icComm->globalCommRank();
if (rank==0) {
fprintf(stderr, "%s does not take -p as an option. Instead the necessary params file is hard-coded.\n", arguments->getProgramName());
}
MPI_Barrier(MPI_COMM_WORLD);
exit(EXIT_FAILURE);
}
arguments->setParamsFile("input/TransposeHyPerConnTest.params");
initObj->initialize();
// Don't call buildandrun because it will delete hc before returning. (I could use the customexit hook)
HyPerCol * hc = build(initObj);
hc->run(); // Weight values are initialized when run calls allocateDataStructures
int status = PV_SUCCESS;
HyPerConn * originalMap = NULL;
TransposeConn * transpose = NULL;
TransposeConn * transposeOfTranspose = NULL;
BaseConnection * baseConn;
baseConn = hc->getConnFromName("Original Map for One to One Test");
originalMap = dynamic_cast<HyPerConn *>(baseConn);
//assert(originalMap->usingSharedWeights());
transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for One to One Test of TransposeConn"));
transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for One to One Test of TransposeConn"));
status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "One-to-one case, TransposeConn");
baseConn = hc->getConnFromName("Original Map for Many to One Test");
originalMap = dynamic_cast<HyPerConn *>(baseConn);
//assert(originalMap->usingSharedWeights());
transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for Many to One Test of TransposeConn"));
transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for Many to One Test of TransposeConn"));
status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "Many-to-one case, TransposeConn");
baseConn = hc->getConnFromName("Original Map for One to Many Test");
originalMap = dynamic_cast<HyPerConn *>(baseConn);
//assert(originalMap->usingSharedWeights());
transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for One to Many Test of TransposeConn"));
transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for One to Many Test of TransposeConn"));
status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "One-to-many case, TransposeConn");
baseConn = hc->getConnFromName("Original Map for One to One Test");
originalMap = dynamic_cast<HyPerConn *>(baseConn);
//assert(originalMap->usingSharedWeights());
transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for One to One Test of FeedbackConn"));
transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for One to One Test of FeedbackConn"));
status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "One-to-one case, FeedbackConn");
baseConn = hc->getConnFromName("Original Map for Many to One Test");
originalMap = dynamic_cast<HyPerConn *>(baseConn);
//assert(originalMap->usingSharedWeights());
transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for Many to One Test of FeedbackConn"));
transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for Many to One Test of FeedbackConn"));
status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "Many-to-one case, FeedbackConn");
baseConn = hc->getConnFromName("Original Map for One to Many Test");
originalMap = dynamic_cast<HyPerConn *>(baseConn);
//assert(originalMap->usingSharedWeights());
transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for One to Many Test of FeedbackConn"));
transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for One to Many Test of FeedbackConn"));
status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "One-to-many case, FeedbackConn");
delete hc;
delete initObj;
return status;
}