本文整理汇总了C++中CkAbort函数的典型用法代码示例。如果您正苦于以下问题:C++ CkAbort函数的具体用法?C++ CkAbort怎么用?C++ CkAbort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CkAbort函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:bulk_adapt_ops.C
示例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,代码来源:idxl_api.C
示例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,代码来源:jacobi3d.C
示例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,代码来源:alignmentCheck.C
示例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,代码来源:marshall.C
示例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,代码来源:jacobi2d.C
示例7: fopen
void
FEMchunk::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,代码来源:fem.C
示例8: checkTriangle
// Check the quality of triangle i
void 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,代码来源:pgm-remesh.C
示例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,代码来源:inlineem.C
示例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 object
int 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,代码来源:ampiOneSided.C
示例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,代码来源:fem.C
示例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,代码来源:charm_randomAccess.C
示例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,代码来源:symmetries.C
示例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,代码来源:msgalloc.C
示例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,代码来源:bulk_adapt_ops.C
示例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,代码来源:pgm.C
示例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,代码来源:symmetries.C
示例18: processExceptionCharm
void
processExceptionCharm()
//******************************************************************************
// 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,代码来源:ProcessException.C
示例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,代码来源:megatest.C
示例20: IdMsg
void
tempotest_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,代码来源:tempotest.C
注:本文中的CkAbort函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论