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


C++ CkExit函数代码示例

本文整理汇总了C++中CkExit函数的典型用法代码示例。如果您正苦于以下问题:C++ CkExit函数的具体用法?C++ CkExit怎么用?C++ CkExit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: namdInitPapiCounters

static void namdInitPapiCounters(){
	if(CkMyRank()==0){
		//only initialize per OS process (i.e. a charm node)
		int retval = PAPI_library_init(PAPI_VER_CURRENT);
		if(retval != PAPI_VER_CURRENT) {
			if(CkMyPe()==0){
				CkPrintf("ERROR: PAPI library is not compatitible!");
				CkExit();
			}
		}
	#if CMK_SMP
		//now only consider systems that are compatible with POSIX
		if(PAPI_thread_init(pthread_self)!=PAPI_OK) {
			if(CkMyPe()==0){
				CkPrintf("ERROR: multi-thread mode in PAPI could not be initialized!");
				CkExit();
			}
		}
	#endif
	}
	CkpvInitialize(int *, papiEvents);
	CkpvAccess(papiEvents) = new int[NUM_PAPI_EVENTS];

#if MEASURE_PAPI_CACHE
	if(PAPI_query_event(PAPI_L1_DCM)==PAPI_OK) {
		CkpvAccess(papiEvents)[0] = PAPI_L1_DCM;
	}else{
		if(CkMyPe()==0){
			CkPrintf("WARNING: PAPI_L1_DCM doesn't exsit on this platform!\n");			
		}
		//if not default to PAPI_TOT_INS
		CkpvAccess(papiEvents)[0] = PAPI_TOT_INS;
	}

	if(PAPI_query_event(PAPI_L2_DCM)==PAPI_OK) {
		CkpvAccess(papiEvents)[1] = PAPI_L2_DCM;
	}else{
		//if not default to PAPI_TOT_CYC
		CkpvAccess(papiEvents)[1] = PAPI_TOT_CYC;
	}	
#elif MEASURE_PAPI_FLOPS
	if(PAPI_query_event(PAPI_FP_INS)==PAPI_OK) {
		CkpvAccess(papiEvents)[0] = PAPI_FP_INS;
	}else{
		if(CkMyPe()==0){
			CkPrintf("WARNING: PAPI_FP_INS doesn't exsit on this platform!\n");
		}
		//if not default to PAPI_TOT_INS
		CkpvAccess(papiEvents)[0] = PAPI_TOT_INS;
	}

	if(PAPI_query_event(PAPI_FMA_INS)==PAPI_OK) {
		CkpvAccess(papiEvents)[1] = PAPI_FMA_INS;
	}else{
		//if not default to PAPI_TOT_CYC
		CkpvAccess(papiEvents)[1] = PAPI_TOT_CYC;
	}
#endif
}
开发者ID:wware,项目名称:namd-povray-cloud,代码行数:59,代码来源:Node.C

示例2: processGhosts

  void processGhosts(ghostMsg *msg) {
      int kk=0; 
      int size = msg->size;

      switch(msg->dir) {
      case LEFT:
        for(int j=jstart;j<=jend;j++) for (int i=iend+1; i<=iend+RADIUS; i++)
	  IN(i,j) = msg->edge[kk++];
        break;

      case RIGHT:
        for(int j=jstart;j<=jend;j++) for (int i=istart-RADIUS; i<=istart-1; i++)
	  IN(i,j) = msg->edge[kk++];
        break;

      case BOTTOM:
        for (int j=jend+1; j<=jend+RADIUS; j++) for(int i=istart;i<=iend;i++){
	  IN(i,j) = msg->edge[kk++];
        }
        break;

      case TOP:
        for (int j=jstart-RADIUS; j<=jstart-1; j++) for(int i=istart;i<=iend;i++)
	  IN(i,j) = msg->edge[kk++];
        break;

      default: CkPrintf("ERROR: invalid direction\n");
	CkExit();
      }
      delete msg;
  }
开发者ID:ParRes,项目名称:Kernels,代码行数:31,代码来源:stencil.C

示例3: CkPrintf

main::main(CkArgMsg* m)
  {
    //Process command-line arguments
    //Start the computation

    mainProxy = thishandle;
    if(m->argc<2)
      {
	      CkPrintf("Needs number of array elements\n");
	CkExit();
      }
    units=atoi(m->argv[1]);
    // 4 MB size
    allredSize= 4194304; //atoi(m->argv[2]);
    baseSize = 262144;
    currentSize = baseSize;
    sizeInd = 0;
    numItr = 10;
    sizesNo = 5;
    timeForEach = new double[sizesNo];
    iterNo = 0;
    for(int i=0; i<sizesNo; i++)
	    timeForEach[i] = 0.0;
    arr = CProxy_AllReduce::ckNew(thisProxy, units);

    CkPrintf("AllReduce for %d pes on %d units for %d size\n",
	     CkNumPes(),units,allredSize);

    arr.init();
    startTime = CkWallTimer();
    arr.dowork(baseSize);
  }
开发者ID:gitter-badger,项目名称:quinoa,代码行数:32,代码来源:AllReduce.C

示例4: double

void Main::save_temp(int SIZE, double *number, int row_number){
	int i,j;

	double (*temp)[matrix_size] = (double (*)[matrix_size]) result;
	
	for(i = 0; i < matrix_size/CkNumPes(); i++){
		for(j = 0; j < matrix_size; j++) {
			temp[i+row_number*matrix_size/CkNumPes()][j] = number[i*matrix_size+j];
		}
	}

	
 	doneCount ++;
	//CkPrintf("donecount: %d ",doneCount);
	if (doneCount == CkNumPes()){
/*
		for (i = 0; i < matrix_size; i++) {
			CkPrintf("tulemus: ");
			for (j = 0; j < matrix_size; j++) {
			
	  			CkPrintf(" %.1f ",temp[i][j]);			
				
			}
			CkPrintf("\n");
		}
*/

		CkExit();
	}
}
开发者ID:ogbash,项目名称:charm_tests,代码行数:30,代码来源:main.C

示例5: CkExit

void Main::checkIn() {

  checkInCount ++;
  if( checkInCount >= m*n)
    CkExit();

}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:7,代码来源:main.C

示例6: CkPrintf

/** Count the number of elements on edge (n1, n2) */
int FEM_Mesh::countElementsOnEdge(int n1, int n2) {
  if (n1==n2) {
    CkPrintf("ERROR: You called countElementsOnEdge() with two identical nodes %d, and %d \n", n1, n2);
    CkExit();
  }
  
  int *n1AdjElems=0, *n2AdjElems=0;
  int n1NumElems, n2NumElems;

  CkAssert(node.is_valid_any_idx(n1));
  CkAssert(node.is_valid_any_idx(n2));

  n2e_getAll(n1, n1AdjElems, n1NumElems);
  n2e_getAll(n2, n2AdjElems, n2NumElems);
  CkAssert(n1AdjElems!=0);
  CkAssert(n2AdjElems!=0);
  int count=0;


  for (int i=0; i<n1NumElems; i++) {
    for (int j=0; j<n2NumElems; j++) {
      if (n1AdjElems[i] == n2AdjElems[j]) {
        count++;
      }
    }
  }
  delete[] n1AdjElems;
  delete[] n2AdjElems;

  return count;
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:32,代码来源:mesh_adjacency.C

示例7: Main

 //! \brief Constructor
 //! \details The main chare constructor is the main entry point of the
 //!   program, called by the Charm++ runtime system. The constructor does
 //!   basic initialization steps, e.g., parser the command-line, prints out
 //!   some useful information to screen (in verbose mode), and instantiates
 //!   a driver. Since Charm++ is fully asynchronous, the constructor
 //!   usually spawns asynchronous objects and immediately exits. Thus in the
 //!   body of the main chare constructor we fire up an 'execute' chare,
 //!   which then calls back to Main::execute(). Finishing the main chare
 //!   constructor the Charm++ runtime system then starts the
 //!   network-migration of all global-scope data (if any). The execute chare
 //!   calling back to Main::execute() signals the end of the migration of
 //!   the global-scope data. Then we are ready to execute the driver. Since
 //!   the unit test suite is parallel and asynchronous, its driver fires up
 //!   additional Charm++ chare objects which then call back to
 //!   Main::finalize() at some point in the future when all work has been
 //!   finished. finalize() then exits by calling Charm++'s CkExit(),
 //!   shutting down the runtime system.
 //! \see http://charm.cs.illinois.edu/manuals/html/charm++/manual.html
 Main( CkArgMsg* msg )
 try :
   // Parse command line into m_cmdline using default simple pretty printer
   m_cmdParser( msg->argc, msg->argv, tk::Print(), m_cmdline, m_helped ),
   // Create pretty printer initializing output streams based on command line
   m_print( m_cmdline.get< tag::verbose >() ? std::cout : std::clog ),
   // Create UnitTest driver
   m_driver( tk::Main< unittest::UnitTestDriver >
                     ( msg->argc, msg->argv,
                       m_cmdline,
                       tk::HeaderType::UNITTEST,
                       UNITTEST_EXECUTABLE,
                       m_print ) ),
   m_timer(1)  // Start new timer measuring the serial+Charm++ runtime
 {
   // Immediately exit if any help was requested; help is printed in main()
   if (m_helped) CkExit();
   // Save executable name to global-scope string so FileParser can access it
   unittest::g_executable = msg->argv[0];
   delete msg;
   mainProxy = thisProxy;
   // Fire up an asynchronous execute object, which when created at some
   // future point in time will call back to this->execute(). This is
   // necessary so that this->execute() can access already migrated
   // global-scope data.
   CProxy_execute::ckNew();
   // Start new timer measuring the migration of global-scope data
   m_timer.emplace_back();
 } catch (...) { tk::processExceptionCharm(); }
开发者ID:gitter-badger,项目名称:quinoa,代码行数:48,代码来源:UnitTest.C

示例8: findarea

		void findarea(int x, bool done)
		{
			
			ckout<<"Radius of circle is: "<<x<<"Area of the circle is: "<<y*x*x<<endl;
			if(done)
				CkExit();
		};
开发者ID:ChinmaySKulkarni,项目名称:Charm-Practice-Programs,代码行数:7,代码来源:async.C

示例9: processGhosts

  void processGhosts(ghostMsg *msg) {
      int k; k=0; 
      int size = msg->size;

      switch(msg->dir) {
      case LEFT:
        for(int j=0;j<size;++j) for (int i=0; i<RADIUS; i++)
	  IN(width+i,j) = msg->edge[k++];
        break;

      case RIGHT:
        for(int j=0;j<size;++j) for (int i=0; i<RADIUS; i++)
	  IN(-RADIUS+i,j) = msg->edge[k++];
        break;

      case BOTTOM:
        for (int j=0; j<RADIUS; j++) for(int i=0;i<size;++i){
	  IN(i,height+j) = msg->edge[k++];
        }
        break;

      case TOP:
        for (int j=0; j<RADIUS; j++) for(int i=0;i<size;++i)
	  IN(i,-RADIUS+j) = msg->edge[k++];
        break;

      default: CkPrintf("ERROR: invalid direction\n");
	CkExit();
      }
      delete msg;
  }
开发者ID:nchaimov,项目名称:ParResKernels,代码行数:31,代码来源:stencil.C

示例10: CkPrintf

void TheMain::exit() {
  //CkPrintf("called = %d\n",called);
  if (++called >= CmiNumPes()) {
    CkPrintf("All done\n");
    CkExit();
  }
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:7,代码来源:benchmark.C

示例11: CkExit

/// Exit the simulation
void pose::exit(void) 
{ 
  if (callBackSet)
    cb.send(); // need to make callback here
  else
    CkExit();
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:8,代码来源:pose.C

示例12: done

		void done() {
				endt = CkWallTimer();
				CkPrintf("Main: done\n");
				CkPrintf("\tnumber of uchares %ld, number of sent messages %f*10^6\n", N_uChares, ((double)(N_uChares*(N_uChares-1)))/(1000000));
				CkPrintf("\t%f secs, %f.4 MMsg/s \n", endt-startt, ((double)(N_uChares*(N_uChares-1)))/(1000000 *(endt-startt)));
				CkExit();
		}
开发者ID:DISLab,项目名称:xcharm,代码行数:7,代码来源:test_pingping.C

示例13: maindone

  void maindone(void)
  {
      niter++;
      if(niter == START_TRACE_ITER)
          _traceControl.startTrace();
      if(niter == END_TRACE_ITER)
          _traceControl.endTrace();

      if(niter == iterations)
      {
          double pingTimer = CkWallTimer() - start_time;
          CkPrintf("Pingping %d\t\t %d  \t\t%d  \t\t%d  \t\t%d \t\t%.1f\n",
              nodeIndex, CharesPerPE, PEsPerNode, PEsPerNode * CharesPerPE, payload, 1000*1000*pingTimer/(iterations-WARM_UP));
          if(nodeIndex == CkNumNodes() -1)
              CkExit();
          else
          {
              niter = 0;
              for(int i=0; i<PEsPerNode * CharesPerPE; i++)
                  arr1[i].start(nodeIndex);
          }
          nodeIndex++;
      }else 
      {
          if(niter == WARM_UP)
              start_time = CkWallTimer();
          for(int i=0; i<PEsPerNode * CharesPerPE; i++)
              arr1[i].start(nodeIndex);
      }
  };
开发者ID:luyukunphy,项目名称:namd,代码行数:30,代码来源:ping.C

示例14: maindone

 void maindone(void)
 {
   static int count = 0;
   count ++;
   CkPrintf("All done\n");
   CkExit();
 };
开发者ID:davidheryanto,项目名称:sc14,代码行数:7,代码来源:hello.C

示例15: CkWallTimer

void Main::done() {
  numIterations++;
  if(numIterations == 1) {
    firstTime = CkWallTimer();
#if USE_CKDIRECT
    CkPrintf("FIRST ITER TIME %f secs\n", firstTime - setupTime);
#else
    CkPrintf("FIRST ITER TIME %f secs\n", firstTime - startTime);
#endif
    compute.resetArrays();
  } else {
    if(numIterations == NUM_ITER) {
      endTime[numIterations-2] = CkWallTimer() - firstTime;
      double sum = 0;
      for(int i=0; i<NUM_ITER-1; i++)
	sum += endTime[i];
#if USE_CKDIRECT
      CkPrintf("AVG TIME %f secs\n", sum/(NUM_ITER-1));
#else
      CkPrintf("AVG TIME %f secs\n", sum/(NUM_ITER-1));
#endif
      CkExit();
    } else {
      endTime[numIterations-2] = CkWallTimer() - firstTime;
      compute.resetArrays();
    }
  }
}
开发者ID:brog2610,项目名称:quinoa,代码行数:28,代码来源:matmul3d.C


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