当前位置: 首页>>代码示例>>C++>>正文


C++ Shell::setHardware方法代码示例

本文整理汇总了C++中Shell::setHardware方法的典型用法代码示例。如果您正苦于以下问题:C++ Shell::setHardware方法的具体用法?C++ Shell::setHardware怎么用?C++ Shell::setHardware使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shell的用法示例。


在下文中一共展示了Shell::setHardware方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

Id init( int argc, char** argv, bool& doUnitTests, bool& doRegressionTests,
         unsigned int& benchmark )
{
    unsigned int numCores = getNumCores();
    int numNodes = 1;
    int myNode = 0;
    bool isInfinite = 0;
    int opt;
    benchmark = 0; // Default, means don't do any benchmarks.
    Cinfo::rebuildOpIndex();
#ifdef USE_MPI
    /*
    // OpenMPI does not use argc or argv.
    // unsigned int temp_argc = 1;
    int provided;
    MPI_Init_thread( &argc, &argv, MPI_THREAD_SERIALIZED, &provided );
    */
    MPI_Init( &argc, &argv );

    MPI_Comm_size( MPI_COMM_WORLD, &numNodes );
    MPI_Comm_rank( MPI_COMM_WORLD, &myNode );
    /*
    if ( provided < MPI_THREAD_SERIALIZED && myNode == 0 ) {
    	cout << "Warning: This MPI implementation does not like multithreading: " << provided << "\n";
    }
    */
    // myNode = MPI::COMM_WORLD.Get_rank();
#endif
    /**
     * Here we allow the user to override the automatic identification
     * of processor configuration
     */
    while ( ( opt = getopt( argc, argv, "hiqurn:b:B:" ) ) != -1 )
    {
        switch ( opt )
        {
        case 'i' : // infinite loop, used for multinode debugging, to give gdb something to attach to.
            isInfinite = 1;
            break;
        case 'n': // Multiple nodes
            numNodes = (unsigned int)atoi( optarg );
            break;
        case 'b': // Benchmark:
            benchmark = atoi( optarg );
            break;
        case 'B': // Benchmark plus dump data: handle later.
            break;
        case 'u': // Do unit tests, pass back.
            doUnitTests = 1;
            break;
        case 'r': // Do regression tests: pass back
            doRegressionTests = 1;
            break;
        case 'q': // quit immediately after completion.
            quitFlag = 1;
            break;
        case 'h': // help
        default:
            cout << "Usage: moose -help -infiniteLoop -unit_tests -regression_tests -quit -n numNodes -benchmark [ksolve intFire hhNet msg_<msgType>_<size>]\n";

            exit( 1 );
        }
    }
    if ( myNode == 0 )
    {

#if 0
        cout << "on node " << myNode << ", numNodes = "
             << numNodes << ", numCores = " << numCores << endl;
#endif
    }

    Id shellId;
    Element* shelle =
        new GlobalDataElement( shellId, Shell::initCinfo(), "root", 1 );

    Id clockId = Id::nextId();
    assert( clockId.value() == 1 );
    Id classMasterId = Id::nextId();
    Id postMasterId = Id::nextId();

    Shell* s = reinterpret_cast< Shell* >( shellId.eref().data() );
    s->setShellElement( shelle );
    s->setHardware( numCores, numNodes, myNode );
    s->loadBalance();

    /// Sets up the Elements that represent each class of Msg.
    unsigned int numMsg = Msg::initMsgManagers();

    new GlobalDataElement( clockId, Clock::initCinfo(), "clock", 1 );
    new GlobalDataElement( classMasterId, Neutral::initCinfo(), "classes", 1);
    new GlobalDataElement( postMasterId, PostMaster::initCinfo(), "postmaster", 1 );

    assert ( shellId == Id() );
    assert( clockId == Id( 1 ) );
    assert( classMasterId == Id( 2 ) );
    assert( postMasterId == Id( 3 ) );



//.........这里部分代码省略.........
开发者ID:hrani,项目名称:moose-core,代码行数:101,代码来源:pymooseinit.cpp


注:本文中的Shell::setHardware方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。