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


C++ TimerPtr::restart方法代码示例

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


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

示例1: loadGraphFrom

void GraphIO::loadGraphFrom(const YAML::Node& doc)
{
    TimerPtr timer = getProfiler()->getTimer("load graph");
    timer->restart();

    SemanticVersion version;
    if(doc["version"].IsDefined()) {
        version = doc["version"].as<SemanticVersion>();
    } else {
        // with 0.9.7 versioning was introduced, so assume that the version was 0.9.6
        version = SemanticVersion(0, 9, 6);
    }

    graph_.getLocalGraph()->beginTransaction();
    {
        auto interlude = timer->step("load nodes");
        loadNodes(doc, version);
    }

    {
        auto interlude = timer->step("load connections");
        loadConnections(doc, version);
    }
    graph_.getLocalGraph()->finalizeTransaction();

    {
        auto interlude = timer->step("load view");
        loadViewRequest(graph_, doc);
    }

    timer->finish();
}
开发者ID:cogsys-tuebingen,项目名称:csapex,代码行数:32,代码来源:graphio.cpp

示例2: saveGraphTo

void GraphIO::saveGraphTo(YAML::Node& yaml)
{
    TimerPtr timer = getProfiler()->getTimer("save graph");
    timer->restart();

    yaml["version"] = csapex::info::CSAPEX_VERSION;

    saveNodes(yaml);
    saveConnections(yaml);

    {
        auto interlude = timer->step("save view");
        saveViewRequest(graph_, yaml);
    }

    timer->finish();
}
开发者ID:cogsys-tuebingen,项目名称:csapex,代码行数:17,代码来源:graphio.cpp

示例3: deviceHandler

	void GPUERT::deviceHandler(){
		m_devId = m_gfxMgr->createDeviceContext(m_devId);
		calculateMaxNodes(m_devId);
		initResources();

		m_constantsBagging.cb_baggingActivated = false;
		TimerPtr timerKernel = TimerPtr(new boost::timer);

		TimerPtr timer = TimerPtr(new boost::timer);
		TimerPtr timerTotal = TimerPtr(new boost::timer);

		m_internalNodes = 0, m_leafNodes = 0;
		int treesLeft = m_numTrees;
		int treesToLaunch = m_maxTreesPerIteration;
		int lastLaunch = 0;
		int checkSum = m_maxTreesPerIteration;
		int newNodes = m_maxTreesPerIteration;
		std::vector<int> checkVars(4,0);

		m_buildTime = 0;
		m_baggingTime = 0;
		m_classificationTime = 0;
		m_depth = 0;

		timerTotal->restart();
		int numIter = ceil(float(m_numTrees)/float(m_maxTreesPerIteration));
		for(unsigned int j=0; j<numIter; ++j){
			checkSum = treesToLaunch;
			newNodes = treesToLaunch;
			m_constants.cb_nodeBufferStart = 0;
			m_constants.cb_nodeIdFlip = 0;

			initResourceBatch(lastLaunch == treesToLaunch);
			lastLaunch = treesToLaunch;

			treesLeft -= treesToLaunch;
			timer->restart();
			for(unsigned int i=0; i<m_MaxDepth; ++i){
				if(i > m_depth)
					m_depth = i;

				assert(newNodes < m_maxNodesPerIteration);
				int nodeLimit = 10000;
				int innerNodes = newNodes;
				int numInnerIter = ceil(float(innerNodes)/float(nodeLimit));
				int launchCount = 0;

				m_constants.cb_availableNodes = newNodes;
				m_constants.cb_numFeatures = 0;
				timerKernel->restart();
				for(unsigned int k=0; k<m_numFeatures; ++k){
					innerNodes = newNodes;
					numInnerIter = ceil(float(innerNodes)/float(nodeLimit));
					launchCount = 0;

					// Best split kernel
					m_gfxMgr->setGPUBuffer(m_devId,m_setBufferIdsExFindSplit,m_setResourceTypesExFindSplit);
					m_gfxMgr->setGPUProgram(m_devId,m_gpuFunctionIds["RFP_ExFindSplit"]);

					innerNodes = newNodes;
					launchCount = 0;
					m_constants.cb_currentDepth = 0;
					for(unsigned int l=0; l<numInnerIter; ++l){
						launchCount = innerNodes > nodeLimit ? nodeLimit : innerNodes;
						
						m_gfxMgr->copyToGPU(m_devId,m_bufferIds["RFB_constants"],&ConstantUpdate(&m_constants,KID_ExtremeFindSplit),sizeof(m_constants));
						m_gfxMgr->launchComputation(m_devId,launchCount*thread_group_size,1,1);

						m_constants.cb_currentDepth += launchCount;
						innerNodes -= launchCount;
						if(innerNodes <= 0)
							break;
					}
					++m_constants.cb_numFeatures;
				}
				if(m_kernelSpecificTimings){
					m_gfxMgr->syncDevice(m_devId);
					m_kernelTimes[L"RFP_ExFindSplit"] += timerKernel->elapsed();
				}

				innerNodes = newNodes;
				launchCount = 0;
				m_constants.cb_currentDepth = 0;
				m_gfxMgr->setGPUBuffer(m_devId,m_setBufferIdsExMakeSplit,m_setResourceTypesExMakeSplit);
				m_gfxMgr->setGPUProgram(m_devId,m_gpuFunctionIds["RFP_ExMakeSplit"]);

				// Split data
				timerKernel->restart();
				for(unsigned int k=0; k<numInnerIter; ++k){
					launchCount = innerNodes > nodeLimit ? nodeLimit : innerNodes;
						
					m_gfxMgr->copyToGPU(m_devId,m_bufferIds["RFB_constants"],&ConstantUpdate(&m_constants,KID_ExtremeMakeSplit),sizeof(m_constants));
					m_gfxMgr->launchComputation(m_devId,launchCount*thread_group_size,1,1);

					m_constants.cb_currentDepth += launchCount;
					innerNodes -= launchCount;
					if(innerNodes <= 0)
						break;
				}
				if(m_kernelSpecificTimings){
//.........这里部分代码省略.........
开发者ID:KarlJansson,项目名称:GPU_tree-ensembles,代码行数:101,代码来源:GPUERT.cpp


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