您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CkAbort函数代码示例

51自学网 2021-06-01 20:10:56
  C++
这篇教程C++ CkAbort函数代码示例写得很实用,希望能帮到您。

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

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

示例1: getEdgeID

int getEdgeID(int node1, int node2, int nodesPerElem, int dim) {  switch(dim){  case 2: {    switch(nodesPerElem){    case 3:      {	static int edgeFromNode[3][3]={{-1,0,2},{0,-1,1},{2,1,-1}};	return edgeFromNode[node1][node2];      }      break;    default:      CkAbort("This shape is not yet implemented");    };    break;  }  case 3: {    switch(nodesPerElem){    case 4:      {	static int edgeFromNode[4][4]={{-1,0,1,2},{0,-1,3,4},{1,3,-1,5},{2,4,5,-1}};	return edgeFromNode[node1][node2];      }      break;    default:      CkAbort("This shape is not yet implemented");    };    break;  }  default:    CkAbort("This dimension not yet implemented");  };  return -1;}
开发者ID:davidheryanto,项目名称:sc14,代码行数:33,


示例2: IDXL_Get_source

CDECL int IDXL_Get_source(IDXL_t l_t,int localNo) {	const char *caller="IDXL_Get_source"; IDXLAPI(caller); 	IDXL &l=IDXL_Chunk::get(caller)->lookup(l_t,caller);	const IDXL_Rec *rec=l.getRecv().getRec(localNo);	if (rec==NULL) CkAbort("IDXL_Get_source called on non-ghost entity!");	if (rec->getShared()>1) CkAbort("IDXL_Get_source called on multiply-shared entity!");	return rec->getChk(0);}
开发者ID:davidheryanto,项目名称:sc14,代码行数:8,


示例3: Main

  Main(CkArgMsg* m) {    if ( (m->argc<3) || (m->argc>8) ) {      CkPrintf("%s [array_size] [block_size]/n", m->argv[0]);      CkPrintf("OR %s [array_size] [block_size] maxiterations/n", m->argv[0]);      CkPrintf("OR %s [array_size_X] [array_size_Y] [array_size_Z] [block_size_X] [block_size_Y] [block_size_Z]/n", m->argv[0]);      CkPrintf("OR %s [array_size_X] [array_size_Y] [array_size_Z] [block_size_X] [block_size_Y] [block_size_Z] maxiterations/n", m->argv[0]);      CkAbort("Abort");    }    iterations = 0;    // store the main proxy    mainProxy = thisProxy;    if(m->argc <=4 ) {      arrayDimX = arrayDimY = arrayDimZ = atoi(m->argv[1]);      blockDimX = blockDimY = blockDimZ = atoi(m->argv[2]);     }    else if (m->argc <=8) {      arrayDimX = atoi(m->argv[1]);      arrayDimY = atoi(m->argv[2]);      arrayDimZ = atoi(m->argv[3]);      blockDimX = atoi(m->argv[4]);       blockDimY = atoi(m->argv[5]);       blockDimZ = atoi(m->argv[6]);    }    maxiterations = MAX_ITER;    if(m->argc==4)      maxiterations = atoi(m->argv[3]);     if(m->argc==8)      maxiterations = atoi(m->argv[7]);     if (arrayDimX < blockDimX || arrayDimX % blockDimX != 0)      CkAbort("array_size_X % block_size_X != 0!");    if (arrayDimY < blockDimY || arrayDimY % blockDimY != 0)      CkAbort("array_size_Y % block_size_Y != 0!");    if (arrayDimZ < blockDimZ || arrayDimZ % blockDimZ != 0)      CkAbort("array_size_Z % block_size_Z != 0!");    numChareX = arrayDimX / blockDimX;    numChareY = arrayDimY / blockDimY;    numChareZ = arrayDimZ / blockDimZ;    // print info    CkPrintf("/nSTENCIL COMPUTATION WITH NO BARRIERS/n");    CkPrintf("Running Jacobi on %d processors with (%d, %d, %d) chares/n", CkNumPes(), numChareX, numChareY, numChareZ);    CkPrintf("Array Dimensions: %d %d %d/n", arrayDimX, arrayDimY, arrayDimZ);    CkPrintf("Block Dimensions: %d %d %d/n", blockDimX, blockDimY, blockDimZ);    // Create new array of worker chares    array = CProxy_Jacobi::ckNew(numChareX, numChareY, numChareZ);    //Start the computation    array.run();    startTime = CkWallTimer();  }
开发者ID:brog2610,项目名称:quinoa,代码行数:56,


示例4: alignmentTest

void alignmentTest(std::vector<TestMessage*> &allMsgs, const std::string &identifier) {  int alignHdr = std::numeric_limits<int>::max();  int alignEnv = std::numeric_limits<int>::max();  int alignUsr = std::numeric_limits<int>::max();  int alignVar1 = std::numeric_limits<int>::max();  int alignVar2 = std::numeric_limits<int>::max();  int alignPrio = std::numeric_limits<int>::max();  for (int i = 0; i < allMsgs.size(); i++) {    TestMessage *msg = allMsgs[i];    envelope *env = UsrToEnv(msg);#if CMK_USE_IBVERBS | CMK_USE_IBUD    intptr_t startHdr = (intptr_t) &(((infiCmiChunkHeader *) env)[-1]);#else    intptr_t startHdr = (intptr_t) BLKSTART(env);#endif    intptr_t startEnv = (intptr_t) env;    intptr_t startUsr = (intptr_t) msg;    intptr_t startVar1 = (intptr_t) msg->varArray1;    intptr_t startVar2 = (intptr_t) msg->varArray2;    intptr_t startPrio = (intptr_t) env->getPrioPtr();    if (! (startHdr < startEnv && startEnv < startUsr &&           startUsr <= startVar1 && startVar1 < startVar2 &&           startVar2 < startPrio)) {      CkAbort("Charm++ fatal error. Pointers to component fields "              "of a message do not follow an increasing order./n");    }    alignHdr = std::min(alignCheck(startHdr), alignHdr);    alignEnv = std::min(alignCheck(startEnv), alignEnv);    alignUsr = std::min(alignCheck(startUsr), alignUsr);    alignVar1 = std::min(alignCheck(startVar1), alignVar1);    alignVar2 = std::min(alignCheck(startVar2), alignVar2);    alignPrio = std::min(alignCheck(startPrio), alignPrio);  }  CkPrintf("Alignment information at the %s:/n", identifier.c_str());  CkPrintf("Chunk header aligned to %d bytes/n", alignHdr);  CkPrintf("Envelope aligned to %d bytes/n", alignEnv);  CkPrintf("Start of user data aligned to %d bytes/n", alignUsr);  CkPrintf("First varsize array aligned to %d bytes/n", alignVar1);  CkPrintf("Second varsize array aligned to %d bytes/n", alignVar2);  CkPrintf("Priority field aligned to %d bytes/n", alignPrio);  if (alignEnv >= ALIGN_BYTES && alignUsr >= ALIGN_BYTES &&      alignVar1 >= ALIGN_BYTES && alignVar2 >= ALIGN_BYTES &&      alignHdr >= ALIGN_BYTES && alignPrio >= ALIGN_BYTES) {    CkPrintf("All passed./n");  }  else {    CkAbort("Alignment requirements failed./n");  }}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:56,


示例5: marshall_init

void marshall_init(void){  if (marshallInitVal!=0x1234567)	CkAbort("initcall marshallInit never got called!/n");  if (eltInitVal!=0x54321)	CkAbort("initcall marshallElt::eltInit never got called!/n");  reflector++;  for (int i=0;i<numElements;i++)  	arrayProxy[(i+reflector)%numElements].reflectMarshall(i);  arrayProxy[0].done();}
开发者ID:davidheryanto,项目名称:sc14,代码行数:11,


示例6: Main

    Main(CkArgMsg* m) {	totalTime = new float[CkNumPes()];	totalObjs = new int[CkNumPes()];	for(int i=0;i<CkNumPes();i++) 	{		totalTime[i] = 0.0;		totalObjs[i] = 0;	}        if (m->argc < 3) {          CkPrintf("%s [array_size] [block_size]/n", m->argv[0]);          CkAbort("Abort");        }        totalIterTime = 0.0;        lbdOverhead = 0.0;        // set iteration counter to zero        iterations=0;        // store the main proxy        mainProxy = thisProxy;        array_height = atoi(m->argv[1]);	      array_width = atoi(m->argv[2]);        block_height = atoi(m->argv[3]);	block_width = atoi(m->argv[4]);        if (array_width < block_width || array_width % block_width != 0)          CkAbort("array_size % block_size != 0!");        num_chare_rows = array_height / block_height;        num_chare_cols = array_width / block_width;        // print info        //CkPrintf("Running Jacobi on %d processors with (%d,%d) elements/n", CkNumPes(), num_chare_rows, num_chare_cols);	total_iterations = 200;	if (m->argc > 5) {	  total_iterations = atoi(m->argv[5]);	}        // Create new array of worker chares        array = CProxy_Jacobi::ckNew(num_chare_cols, num_chare_rows);        // save the total number of worker chares we have in this simulation        num_chares = num_chare_rows*num_chare_cols;        //Start the computation        perIterStartTime = CkWallTimer();        progStartTime = CkWallTimer();        recieve_count = 0;        array.begin_iteration();    }
开发者ID:sdasgup3,项目名称:heterogeneity-aware-load-balancing,代码行数:53,


示例7: fopen

voidFEMchunk::readField(int fid, void *nodes, const char *fname){  const IDXL_Layout &dt = IDXL_Layout_List::get().get(fid,"FEM_Read_field");  int type = dt.type;  int width = dt.width;  int offset = dt.offset;  int distance = dt.distance;  int skew = dt.skew;  FILE *fp = fopen(fname, "r");  if(fp==0) {    CkError("Cannot open file %s for reading./n", fname);    CkAbort("Exiting");  }  char str[80];  char* pos;  const char* fmt;  int i, j, curline;#if FEM_FORTRAN  curline = 1;#else  curline = 0;#endif  switch(type) {    case FEM_INT: fmt = "%d%n"; break;    case FEM_REAL: fmt = "%f%n"; break;    case FEM_DOUBLE: fmt = "%lf%n"; break;    default: CkAbort("FEM_Read_field doesn't support that data type");  }  FEM_Mesh *cur_mesh=getMesh("FEM_Read_field");  int nNodes=cur_mesh->node.size();  for(i=0;i<nNodes;i++) {    // skip lines to the next local node     // (FIXME: assumes nodes are in ascending global order, which they ain't)    int target=cur_mesh->node.getGlobalno(i);    for(j=curline;j<target;j++)      fgets(str,80,fp);    curline = target+1;    fgets(str,80,fp);    int curnode, numchars;    sscanf(str,"%d%n",&curnode,&numchars);    pos = str + numchars;    if(curnode != target) {      CkError("Expecting info for node %d, got %d/n", target, curnode);      CkAbort("Exiting");    }    for(j=0;j<width;j++) {      sscanf(pos, fmt, &IDXL_LAYOUT_DEREF(unsigned char,nodes,i,j), &numchars);      pos += numchars;    }  }  fclose(fp);}
开发者ID:davidheryanto,项目名称:sc14,代码行数:53,


示例8: checkTriangle

// Check the quality of triangle ivoid checkTriangle(myGlobals &g, int i){  double area=calcArea(g,i);  if (area<0) {    CkError("Triangle %d of chunk %d is inverted! (area=%g)/n",	    i,FEM_My_partition(),area);    CkAbort("Inverted triangle");  }  if (area<1.0e-15) {    CkError("Triangle %d of chunk %d is a sliver!/n",i,FEM_My_partition());    CkAbort("Sliver triangle");  }}
开发者ID:davidheryanto,项目名称:sc14,代码行数:14,


示例9: start_test

    void start_test()    {        inline_group *gl = g.ckLocalBranch();        if (gl->called)            CkAbort("Inline test was called already?/n");        g[CkMyPe()].try_inline();        if (!gl->called)            CkAbort("Inline test should have been called by now!/n");        gl->called = false;        megatest_finish();    }
开发者ID:luyukunphy,项目名称:namd,代码行数:14,


示例10: CkAbort

// This is a local function.// AMPI_Win_put will act as a wrapper: pack the input parameters, copy the//   remote data to local, and call this function of the involved WIN objectint win_obj::put(void *orgaddr, int orgcnt, int orgunit,                 MPI_Aint targdisp, int targcnt, int targunit) {    if(initflag == 0) {        CkAbort("Put to non-existing MPI_Win/n");        return WIN_ERROR;    }    int totalsize = targdisp+targcnt*targunit;    if(totalsize > (winSize)) {        CkAbort("Put size exceeds MPI_Win size/n");        return WIN_ERROR;    }    return WIN_SUCCESS;}
开发者ID:quinoacomputing,项目名称:quinoa,代码行数:17,


示例11: n

/** Create a stencil with this number of elements,   and these adjacent elements.  In C, userEnds[i] is the 0-based one-past-last element; in F90, userEnds[i] is the 1-based last element, which amounts to the same thing!   In C, userAdj is 0-based; in F90, the even elType fields are 0-based, and the odd elemNum fields are 1-based.*/FEM_Ghost_Stencil::FEM_Ghost_Stencil(int elType_, int n_,bool addNodes_,	const int *userEnds,	const int *userAdj,	int idxBase)	:elType(elType_), n(n_), addNodes(addNodes_),  	 ends(new int[n]), adj(new int[2*userEnds[n-1]]){	int i;	int lastEnd=0;	for (i=0;i<n;i++) {		ends[i]=userEnds[i];		if (ends[i]<lastEnd) {			CkError("FEM_Ghost_Stencil> ends array not monotonic!/n"				"   ends[%d]=%d < previous value %d/n",				i,ends[i],lastEnd);			CkAbort("FEM_Ghost_Stencil> ends array not monotonic");		}		lastEnd=ends[i];	}	int m=ends[n-1];	for (i=0;i<m;i++) {		adj[2*i+0]=userAdj[2*i+0];		adj[2*i+1]=userAdj[2*i+1]-idxBase;	}}
开发者ID:davidheryanto,项目名称:sc14,代码行数:36,


示例12: TestDriver

  TestDriver(CkArgMsg* args) {    N = atoi(args->argv[1]);    numElementsPerPe = atoll(args->argv[2]);    localTableSize = (1l << N) / numElementsPerPe;		if (!localTableSize)			CkAbort("Table size is too small, or number of chares is too large/n");    tableSize = localTableSize * CkNumPes() * numElementsPerPe;    CkPrintf("Global table size   = 2^%d * %d = %lld words/n",             N, CkNumPes(), tableSize);    CkPrintf("Number of processors = %d/nNumber of updates = %lld/n",             CkNumPes(), 4 * tableSize);    driverProxy = thishandle;    // Create the chares storing and updating the global table    updater_array   = CProxy_Updater::ckNew(CkNumPes() * numElementsPerPe);    int dims[2] = {CkNumNodes(), CkNumPes() / CkNumNodes()};    CkPrintf("Aggregation topology: %d %d/n", dims[0], dims[1]);    // Instantiate communication library group with a handle to the client    //aggregator =    //  CProxy_ArrayMeshStreamer<dtype, int, Updater, SimpleMeshRouter>    //  ::ckNew(numMsgsBuffered, 2, dims, updater_array, 1);    delete args;  }
开发者ID:DISLab,项目名称:xcharm,代码行数:26,


示例13: getLocFace

	//Compute the face closest to this location	// FIXME: this uses an O(nFaces) algorithm; using boxes it could be made O(1)	int getLocFace(const CkVector3d &loc,double minTol) const {		double minTolSq=minTol*minTol;		int min=-1;		for (int f=0;f<nFaces;f++) {			double distSq=loc.distSqr(faceCen[f]);			if (distSq<minTolSq) {				//return f;				if (min!=-1) 					CkAbort("FEM_Linear_Periodicity> Several 'closest' faces found!");				min=f;			}		}		if (min==-1)			CkAbort("FEM_Linear_Periodicity> No matching face found!");		return min;	}
开发者ID:davidheryanto,项目名称:sc14,代码行数:18,


示例14: CkPriorityPtr

void* CkPriorityPtr(void *msg){#if CMK_ERROR_CHECKING  if (UsrToEnv(msg)->getPriobits() == 0) CkAbort("Trying to access priority bits, but none was allocated");#endif  return UsrToEnv(msg)->getPrioPtr();}
开发者ID:luyukunphy,项目名称:namd,代码行数:7,


示例15: startElem

int BulkAdapt::lock_3D_region(int elemID, int elemType, int edgeID, double prio, RegionID *lockRegionID){ // Lock region defined by all elements surrounding edgeID, i.e. the "star"  int numElemsToLock=0, success=-1;  adaptAdj *elemsToLock;  adaptAdj startElem(partitionID, elemID, elemType);  BULK_DEBUG(CkPrintf("[%d] BulkAdapt::lock_3D_region acquiring list of elements to build locked region./n",		      partitionID));  get_elemsToLock(startElem, &elemsToLock, edgeID, &numElemsToLock);  success = localShadow->lockRegion(numElemsToLock, elemsToLock, lockRegionID, prio);  free(elemsToLock);  if (success==2) { // got the lock free and clear; refine the element    BULK_DEBUG(CkPrintf("[%d] BulkAdapt::lock_3D_region: Lock (%d,%d,%6.4f) obtained./n", partitionID,			lockRegionID->chunkID, lockRegionID->localID, lockRegionID->prio));  }  else if (success==1) { // lock is pending    BULK_DEBUG(CkPrintf("[%d] BulkAdapt::lock_3D_region: Lock (%d,%d,%6.4f) pending./n", partitionID,			lockRegionID->chunkID, lockRegionID->localID, lockRegionID->prio));  }  else if (success==0) { // lock failed    BULK_DEBUG(CkPrintf("[%d] BulkAdapt::edge_bisect_3D: Lock (%d,%d,%6.4f) not obtained./n", partitionID,			lockRegionID->chunkID, lockRegionID->localID, lockRegionID->prio));  }  else {    CkPrintf("Lock status=%d/n", success);    CkAbort("Invalid lock return status!/n");  }  return success;}
开发者ID:davidheryanto,项目名称:sc14,代码行数:30,


示例16: CkPrintf

main::main(CkArgMsg * m){   if(m->argc != 3)  {    CkPrintf("Usage: pgm <nsamples> <nchares>/n");    CkAbort("");  }  ns = atoi(m->argv[1]);  nc = atoi(m->argv[2]);  delete m;  starttime = CkWallTimer();  //FIXME  //CkGroupID gid = CkCreatePropMap();  //CProxy_piPart  arr = CProxy_piPart::ckNew(nc, gid);  CProxy_piPart  arr = CProxy_piPart::ckNew(nc);  CkPrintf("At time %lf, array created./n", (CkWallTimer()-starttime));#if USE_REDUCTION  arr.setReductionClient(reductionHandler,(void *)NULL);#endif  arr.compute(ns);  responders = nc;  count = 0;  mainhandle = thishandle; // readonly initialization  CkPrintf("At time %lf, main exits./n", (CkWallTimer()-starttime));}
开发者ID:brog2610,项目名称:quinoa,代码行数:30,


示例17: getLocNode

	//Compute the node on this face closest to this location	// This is O(nPer), but nPer is tiny (<10) so it's quite fast enough.	int getLocNode(int faceNo,const CkVector3d &loc,double minTol) const {		double minTolSq=minTol*minTol;		int min=-1;		for (int n=0;n<nPer;n++) {			double distSq=loc.distSqr(getNodeLoc(getNode(faceNo,n)));			if (distSq<minTolSq) {				//return n;				if (min!=-1) 					CkAbort("FEM_Linear_Periodicity> Several 'closest' nodes found!");				min=n;			}		}		if (min==-1)			CkAbort("FEM_Linear_Periodicity> No matching node found!");		return getNode(faceNo,min);	}
开发者ID:davidheryanto,项目名称:sc14,代码行数:18,


示例18: processExceptionCharm

voidprocessExceptionCharm()//******************************************************************************//  Process an exception from the Charm++ runtime system//! /details See Josuttis, The C++ Standard Library - A Tutorial and Reference,//!    2nd Edition, 2012.//! /author J. Bakosi//******************************************************************************{    try {        throw;      // rethrow exception to deal with it here    }    // Catch tk::Exception    catch ( tk::Exception& qe ) {        if (!CkMyPe()) qe.handleException();    }    // Catch std::exception and transform it into tk::Exception without    // file:line:func information    catch ( std::exception& se ) {        tk::Exception qe( se.what() );        if (!CkMyPe()) qe.handleException();    }    // Catch uncaught exception    catch (...) {        tk::Exception qe( "Non-standard exception" );        if (!CkMyPe()) qe.handleException();    }    // Tell the runtime system to exit with a message    CkAbort( "Exception caught" );}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:31,


示例19: CmiPrintf

main::main(CkArgMsg *msg){  CmiPrintf("Megatest is running on %d nodes %d processors. /n", CkNumNodes(), CkNumPes());  int argc = msg->argc;  char **argv = msg->argv;  int numtests, i;  delete msg;  mainhandle = thishandle;  if (nTests<=0)    CkAbort("Megatest: No tests registered-- is MEGATEST_REGISTER_TEST malfunctioning?");  for (i=0; i<nTests; i++)    (tests[i].initializer)();  test_bank_size = nTests;  next_test_index = 0;  next_test_number = 0;  test_negate_skip=0;  test_repeat = 0;  for (i=1; i<argc; i++) {    if (strcmp(argv[i],"-only")==0)      test_negate_skip = 1;    if (strcmp(argv[i],"-repeat")==0)      test_repeat = 1;  }  num_tests_to_skip = argc;  tests_to_skip = argv;  CProxy_main(thishandle).start();}
开发者ID:davidheryanto,项目名称:sc14,代码行数:27,


示例20: IdMsg

voidtempotest_UserClass::doSendRecv(void){  CkChareID otherid;  char inbuf[11], outbuf[11];    IdMsg *idmsg = new IdMsg(thishandle);  CProxy_tempotest_main mainproxy(mainid);  mainproxy.getid(idmsg);  ckTempoRecv(1, &otherid, sizeof(CkChareID));    for (int i=0; i<10; i++) {    sprintf(outbuf, "UserClass!");    sprintf(inbuf, "");    ckTempoSend(i+2, outbuf, strlen(outbuf)+1, otherid);    ckTempoRecv(i+2, inbuf, 11);    if(strcmp(inbuf, "UserClass!")) {      CkAbort("tempotest: Message corrupted!/n");      mainproxy.Finish();      return;    }  }  mainproxy.Finish();  delete this;}
开发者ID:davidheryanto,项目名称:sc14,代码行数:26,


示例21: nodeElementFnPtr

/** A node is added inside a volume; interpolate from nodes of element; this   uses n, nodes[4] or more, and coord */void FEM_Interpolate::FEM_InterpolateNodeInElement(NodalArgs args){  if (nodeElementFnPtr) { // default is overridden    nodeElementFnPtr(args, theMesh);    return;  }  // do default interpolation  // DEFAULT BEHAVIOR: Interpolate whatever user data is available, positioning  // new point at coordinate average of surrounding element nodes  CkVec<FEM_Attribute *>*attrs = (theMesh->node).getAttrVec();  for (int i=0; i<attrs->size(); i++) {    FEM_Attribute *a = (FEM_Attribute *)(*attrs)[i];    if (a->getAttr() < FEM_ATTRIB_TAG_MAX) {      FEM_DataAttribute *d = (FEM_DataAttribute *)a;      if ((args.nNbrs >= 4) && (args.nNbrs <= 8)) {	d->interpolate(args.nodes, args.n, args.nNbrs);      }      else {	CkPrintf("ERROR: %d node elements not supported for node data interpolation./n", args.nNbrs);	CkAbort("ERROR: FEM_InterpolateNodeInElement/n");      }    }  }  return;}
开发者ID:davidheryanto,项目名称:sc14,代码行数:29,


示例22: RECORD_RECV_STATS

void RectMulticastStrategy::handleMessageForward(void *msg){      envelope *env = (envelope *)msg;    RECORD_RECV_STATS(getInstance(), env->getTotalsize(), env->getSrcPe());    //Section multicast base message    CkMcastBaseMsg *cbmsg = (CkMcastBaseMsg *)EnvToUsr(env);        int status = cbmsg->_cookie.sInfo.cInfo.status;    ComlibPrintf("[%d] In handleMessageForward %d/n", CkMyPe(), status);        if(status == COMLIB_MULTICAST_NEW_SECTION)        handleNewMulticastMessage(env);    else {        //status == COMLIB_MULTICAST_OLD_SECTION, use the cached section id        ComlibSectionHashKey key(cbmsg->_cookie.pe,                                  cbmsg->_cookie.sInfo.cInfo.id);                    ComlibRectSectionHashObject *obj;        obj = sec_ht.get(key);                if(obj == NULL)            CkAbort("Destination indices is NULL/n");#ifndef LOCAL_MULTI_OFF                        localMulticast(env, obj);#endif        remoteMulticast(env, obj);    }}
开发者ID:davidheryanto,项目名称:sc14,代码行数:29,


示例23: CkAbort

void edge::sanityCheck(chunk *c,edgeRef shouldRef){  if (myRef!=shouldRef)    CkAbort("REFINE2D edge has wrong ref");    int nonNullElements=0;  for (int i=0;i<2;i++) {    // nodes[i].sanityCheck(c);    if (!elements[i].isNull()) {      elements[i].sanityCheck(c);      nonNullElements++;    }  }  if (!(nonNullElements==1 || nonNullElements==2))    CkAbort("REFINE2D edge has unexpected number of neighbors!");}
开发者ID:davidheryanto,项目名称:sc14,代码行数:16,


示例24: CkPrintf

void chunk::updateNodeCoords(int nNode, double *coord, int nEl){  int i;#if 1  // do some error checking  if (nEl != numElements || nNode != numNodes) {    CkPrintf("ERROR: inconsistency in REFINE2D's updateNodeCoords on chunk %d:/n"       "  your nEl (%d); my numElements (%d)/n"       "  your nNode (%d); my numNodes (%d)/n",       cid, nEl, numElements, nNode,numNodes);    CkAbort("User code/library numbering inconsistency in REFINE2D");  }#endif      // update node coordinates from coord  for (i=0; i<numNodes; i++){    theNodes[i].init(coord[2*i], coord[2*i + 1]);    CkPrintf("[tmr] Chunk %d Node %d %.8lf %.8lf /n",cid,i,theNodes[i].X(),theNodes[i].Y());  }        // recalculate and cache new areas for each element  for (i=0; i<numElements; i++){    theElements[i].calculateArea();    CkPrintf("[tmr] Chunk %d Element %d area = %.8lf /n",cid,i, theElements[i].getArea());  }	  sanityCheck();}
开发者ID:davidheryanto,项目名称:sc14,代码行数:28,


示例25: CkAbort

void rotest_group::start(void){  if(rotest_check())    CkAbort("rotest failed");  CProxy_rotest_group rog(rotest_groupid);  rog[0].done();}
开发者ID:davidheryanto,项目名称:sc14,代码行数:7,


示例26: bytes

/**  Return a binary string containing the JPEG-compressed data of   this raster image, which is wid x ht pixels, and   each pixel bpp bytes (must be either 1, for greyscale; or 3, for RGB).    quality controls the compression rate, from  	quality == 0, tiny compressed image, very low quality	quality == 100, huge compressed image, very high quality    This code derived from the "example.c" that ships with libjpeg;   see that file for comments.*/std::string JPEGcompressImage(int wid,int ht,int bpp, const byte *image_data, int quality) {  struct jpeg_compress_struct cinfo;  JSAMPROW row_pointer[1];	/* pointer to JSAMPLE row[s] */  int row_stride;		/* physical row width in image buffer */  struct jpeg_error_mgr jerr;  cinfo.err = jpeg_std_error(&jerr);  /* Now we can initialize the JPEG compression object. */  jpeg_create_compress(&cinfo);    std::string ret;  jpeg_stl_dest(&cinfo,&ret);  cinfo.image_width = wid; 	/* image width and height, in pixels */  cinfo.image_height = ht;    while (cinfo.image_height>65000) {  /* FUNKY HACK:   	JPEG library can't support images over 64K pixels.	But we want tall-skinny images for 3D volume impostors.	So we just *lie* to the JPEG library, and it'll interpret	the image data as several side-by-side interleaved scanlines.	The decompressor doesn't (necessarily!) need to change either...  */  	if (cinfo.image_height&1) {		CkError("liveViz0 JPEGlib WARNING: cannot shrink odd image height %d/n",cinfo.image_height);	}  	cinfo.image_height/=2;	cinfo.image_width*=2;  }      switch (bpp) {  case 1:  	cinfo.input_components = 1;		/* # of color components per pixel */  	cinfo.in_color_space = JCS_GRAYSCALE; 	/* colorspace of input image */	break;  case 3:  	cinfo.input_components = 3;		/* # of color components per pixel */  	cinfo.in_color_space = JCS_RGB; 	/* colorspace of input image */	break;  default:  	CkError("liveViz0's JPEGcompressImage: JPEGlib can only handle 1 or 3 bytes per pixel, not %d bpp/n",bpp);	CkAbort("liveViz0's JPEGcompressImage: JPEGlib can only handle 1 or 3 bytes per pixel");	break;  }    jpeg_set_defaults(&cinfo);  jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);  jpeg_start_compress(&cinfo, TRUE);  row_stride = cinfo.image_width * bpp;	/* JSAMPLEs per row in image_buffer */  while (cinfo.next_scanline < cinfo.image_height) {    row_pointer[0] = (JSAMPLE *)(& image_data[cinfo.next_scanline * row_stride]);    (void) jpeg_write_scanlines(&cinfo, row_pointer, 1);  }  jpeg_finish_compress(&cinfo);  jpeg_destroy_compress(&cinfo);  return ret;}
开发者ID:davidheryanto,项目名称:sc14,代码行数:71,


示例27: CkPupGroupData

// handle GroupTable and datavoid CkPupGroupData(PUP::er &p, CmiBool create){	int numGroups, i;	if (!p.isUnpacking()) {	  numGroups = CkpvAccess(_groupIDTable)->size();	}	p|numGroups;	if (p.isUnpacking()) {	  if(CkMyPe()==0)              CkpvAccess(_numGroups) = numGroups+1;           else 	    CkpvAccess(_numGroups) = 1;	}	DEBCHK("[%d] CkPupGroupData %s: numGroups = %d/n", CkMyPe(),p.typeString(),numGroups);	GroupInfo *tmpInfo = new GroupInfo [numGroups];	if (!p.isUnpacking()) {	  for(i=0;i<numGroups;i++) {		tmpInfo[i].gID = (*CkpvAccess(_groupIDTable))[i];		TableEntry ent = CkpvAccess(_groupTable)->find(tmpInfo[i].gID);		tmpInfo[i].MigCtor = _chareTable[ent.getcIdx()]->migCtor;		tmpInfo[i].DefCtor = _chareTable[ent.getcIdx()]->defCtor;		strncpy(tmpInfo[i].name,_chareTable[ent.getcIdx()]->name,255);		//CkPrintf("[%d] CkPupGroupData: %s group %s /n", CkMyPe(), p.typeString(), tmpInfo[i].name);		if(tmpInfo[i].MigCtor==-1) {			char buf[512];			sprintf(buf,"Group %s needs a migration constructor and PUP'er routine for restart./n", tmpInfo[i].name);			CkAbort(buf);		}	  }  	}	for (i=0; i<numGroups; i++) p|tmpInfo[i];	for(i=0;i<numGroups;i++) 	{	  CkGroupID gID = tmpInfo[i].gID;	  if (p.isUnpacking()) {	    //CkpvAccess(_groupIDTable)->push_back(gID);	    int eIdx = tmpInfo[i].MigCtor;	    // error checking	    if (eIdx == -1) {	      CkPrintf("[%d] ERROR> Group %s's migration constructor is not defined!/n", CkMyPe(), tmpInfo[i].name); CkAbort("Abort");	    }	    void *m = CkAllocSysMsg();	    envelope* env = UsrToEnv((CkMessage *)m);		if(create)		    CkCreateLocalGroup(gID, eIdx, env);	  }   // end of unPacking	  IrrGroup *gobj = CkpvAccess(_groupTable)->find(gID).getObj();	  // if using migration constructor, you'd better have a pup	  	if(!create)			gobj->mlogData->teamRecoveryFlag = 1;          gobj->pup(p);         // CkPrintf("Group PUP'ed: gid = %d, name = %s/n",gobj->ckGetGroupID().idx, tmpInfo[i].name);	}	delete [] tmpInfo;}
开发者ID:davidheryanto,项目名称:sc14,代码行数:60,


示例28: CkAbort

void varsizetest_main::exit(varsizetest_Msg *m){  if(!m->check())    CkAbort("varsizetest failed!/n");  delete m;  delete this;  megatest_finish();}
开发者ID:davidheryanto,项目名称:sc14,代码行数:8,



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


C++ CkAssert函数代码示例
C++ ChrPtr函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。