本文整理匯總了C++中CkpvAccess函數的典型用法代碼示例。如果您正苦於以下問題:C++ CkpvAccess函數的具體用法?C++ CkpvAccess怎麽用?C++ CkpvAccess使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CkpvAccess函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: EmergencyExit
void EmergencyExit(void) {
#ifndef __BIGSIM__
/* Delete _coreState to force any CkMessageWatcher to close down. */
if (CkpvAccess(_coreState) != NULL) {
delete CkpvAccess(_coreState);
CkpvAccess(_coreState) = NULL;
}
#endif
}
示例2: _createTracecounter
// this is called by the Charm++ runtime system
void _createTracecounter(char **argv)
{
DEBUGF(("%d/%d DEBUG: createTraceCounter\n", CmiMyPe(), CmiNumPes()));
CkpvInitialize(Trace*, _trace);
TraceCounter* tc = new TraceCounter(); _MEMCHECK(tc);
tc->traceInit(argv);
CkpvAccess(_trace) = tc;
CkpvAccess(_traces)->addTrace(CkpvAccess(_trace));
}
示例3: master
CollectionMgr::CollectionMgr(SlaveInitMsg *msg) : master(msg->master)
{
delete msg;
if (CkpvAccess(CollectionMgr_instance) == 0) {
CkpvAccess(CollectionMgr_instance) = this;
} else {
DebugM(1, "CollectionMgr::CollectionMgr() - another instance of CollectionMgr exists!\n");
}
}
示例4: ComlibPrintf
void ConvComlibManager::doneCreating() {
ComlibPrintf("Called doneCreating\n");
if (busy) {
// we have to delay the table broadcast because we are in the middle of another one
doneCreatingScheduled = CmiTrue;
return;
}
// if we reach here it means we are not busy and we can proceed
busy = CmiTrue;
acksReceived = CmiNumPes() - 1;
int count = 0;
for (int i=1; i<=nstrats; ++i) {
if (strategyTable[i].isNew) {
count++;
}
}
if (count > 0) {
// create the wrapper and link the strategies there
StrategyWrapper sw(count);
count = 0;
for (int i=1; i<=nstrats; ++i) {
if (strategyTable[i].isNew) {
sw.position[count] = i;
sw.replace[count] = CmiFalse;
sw.strategy[count] = strategyTable[i].strategy;
count++;
CkpvAccess(conv_com_object).inSync(i);
}
}
// pup the wrapper into a message
PUP::sizer ps;
ps|sw;
char *msg = (char*)CmiAlloc(ps.size() + CmiReservedHeaderSize);
PUP::toMem pm(msg+CmiReservedHeaderSize);
//int size = ps.size();
//pm|size;
pm|sw;
//for (int i=CmiReservedHeaderSize; i<CmiReservedHeaderSize+size; ++i) {
// CmiPrintf("%x",((char*)msg)[i]);
//}
//CmiPrintf("\n");
CmiSetHandler(msg, CkpvAccess(comlib_receive_table));
CmiSyncBroadcastAndFree(ps.size()+CmiReservedHeaderSize, msg);
/* NOT USED NOW!
// call the finalizeCreation after the strategies has been packed
for (int i=0; i<strategyTable.size(); ++i) {
if (strategyTable[i].isNew) strategyTable[i].strategy->finalizeCreation();
}
*/
} else {
busy = CmiFalse;
}
}
示例5: 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
}
示例6: _createTraceFoo
/**
For each TraceFoo module, _createTraceFoo() must be defined.
This function is called in _createTraces() generated in moduleInit.C
*/
void _createTracememory(char **argv)
{
DEBUGF(("%d createTraceMemory\n", CkMyPe()));
CkpvInitialize(TraceMemory*, _trace);
CkpvAccess(_trace) = new TraceMemory(argv);
CkpvAccess(_traces)->addTrace(CkpvAccess(_trace));
/* Since we started after the beginning of the program, we missed a bunch of
* allocations. We cannot record what was allocated and then deleted, but we
* can still record all the memory that is still allocated.
*/
}
示例7: CkpvInitialize
Communicate::Communicate(void)
{
CkpvInitialize(CmmTable, CsmMessages);
CsmHandlerIndex = CmiRegisterHandler((CmiHandler) CsmHandler);
CsmAckHandlerIndex = CmiRegisterHandler((CmiHandler) CsmAckHandler);
CkpvAccess(CsmMessages) = CmmNew();
if ( CmiMyNode() * 2 + 2 < CmiNumNodes() ) nchildren = 2;
else if ( CmiMyNode() * 2 + 1 < CmiNumNodes() ) nchildren = 1;
else nchildren = 0;
CkpvInitialize(int, CsmAcks);
CkpvAccess(CsmAcks) = nchildren;
}
示例8: iterate
/** Call add for every in-range array element on this processor */
void iterate(void)
{ /* Walk the groupTable for arrays (FIXME: get rid of _groupIDTable) */
int numGroups=CkpvAccess(_groupIDTable)->size();
for(int i=0;i<numGroups;i++) {
IrrGroup *obj = CkpvAccess(_groupTable)->find((*CkpvAccess(_groupIDTable))[i]).getObj();
if (obj->isArrMgr())
{ /* This is an array manager: examine its array elements */
mgr=(CkArray *)obj;
mgr->getLocMgr()->iterate(*this);
}
}
}
示例9: ComlibPrintf
void PipeBroadcastConverse::insertMessage(MessageHolder *cmsg){
ComlibPrintf("[%d] PipeBroadcastConverse::insertMessage %d\n",CkMyPe(),topology);
char *msg = cmsg->getMessage();
int size = cmsg->getSize();
if (size < pipeSize) {
// sending message in a single chunk
CmiSetHandler(msg, CkpvAccess(pipeline_handler));
CmiFragmentHeader *frag = getFragmentHeader(msg);
frag->senderPe = CkMyPe();
frag->msgSize = size;
propagate(msg, false);
} else {
// sending message in multiple chunk: message doesn't fit into the pipe:
// split it into chunks and propagate them individually
++seqNumber;
ComlibPrintf("[%d] Propagating message in multiple chunks (totalsize=%d)\n",CkMyPe(),size);
char *sendingMsg;
char *nextChunk = msg+CmiReservedHeaderSize;
int remaining = size-CmiReservedHeaderSize;
int reducedPipe = pipeSize-CmiReservedHeaderSize-sizeof(PipeBcastInfo);
int sendingMsgSize;
CmiSetHandler(msg, CkpvAccess(pipeline_frag_handler));
// send all the chunks one after the other
for (int i=0; i<(int)ceil(((double)size-CmiReservedHeaderSize)/reducedPipe); ++i) {
sendingMsgSize = reducedPipe<remaining? pipeSize : remaining+CmiReservedHeaderSize+sizeof(PipeBcastInfo);
sendingMsg = (char*)CmiAlloc(sendingMsgSize);
memcpy (sendingMsg, msg, CmiReservedHeaderSize);
PipeBcastInfo *info = (PipeBcastInfo*)(sendingMsg+CmiReservedHeaderSize);
info->srcPe = CkMyPe();
info->bcastPe = CkMyPe();
info->seqNumber = seqNumber;
info->chunkNumber = i;
info->chunkSize = reducedPipe<remaining ? reducedPipe : remaining;
info->messageSize = size;
memcpy (sendingMsg+CmiReservedHeaderSize+sizeof(PipeBcastInfo), nextChunk, info->chunkSize);
remaining -= info->chunkSize;
nextChunk += info->chunkSize;
propagate(sendingMsg, true);
}
}
//CmiSetHandler(msg, CsvAccess(pipeBcastPropagateHandle_frag));
//conversePipeBcast(msg, cmsg->getSize());
delete cmsg;
}
示例10: Tcl_SetResult
// move all atoms by a given vector
int ScriptTcl::Tcl_moveallby(ClientData clientData,
Tcl_Interp *interp, int argc, char *argv[]) {
ScriptTcl *script = (ScriptTcl *)clientData;
script->initcheck();
if (argc != 2) {
Tcl_SetResult(interp, "wrong # args", TCL_VOLATILE);
return TCL_ERROR;
}
char **fstring;
int fnum;
double x, y, z;
if (Tcl_SplitList(interp, argv[1], &fnum, &fstring) != TCL_OK)
return TCL_ERROR;
if ( (fnum != 3) ||
(Tcl_GetDouble(interp, fstring[0],&x) != TCL_OK) ||
(Tcl_GetDouble(interp, fstring[1],&y) != TCL_OK) ||
(Tcl_GetDouble(interp, fstring[2],&z) != TCL_OK) ) {
Tcl_SetResult(interp,"argument not a vector",TCL_VOLATILE);
Tcl_Free((char*)fstring);
return TCL_ERROR;
}
Tcl_Free((char*)fstring);
MoveAllByMsg *msg = new MoveAllByMsg;
msg->offset = Vector(x,y,z);
(CProxy_PatchMgr(CkpvAccess(BOCclass_group).patchMgr)).moveAllBy(msg);
script->barrier();
return TCL_OK;
}
示例11: DEBUGF
void TraceBluegene::traceClose() {
DEBUGF(("%d TraceBluegene::traceClose\n", CkMyPe()));
bgUpdateProj(2);
if(pfp != 0) fclose(pfp);
pfp = NULL;
CkpvAccess(_traces)->removeTrace(this);
}
示例12: CkpvAccess
ComputeMgr::ComputeMgr()
{
CkpvAccess(BOCclass_group).computeMgr = thisgroup;
computeGlobalObject = 0;
computeGlobalResultsMsgSeq = -1;
computeGlobalResultsMsgMasterSeq = -1;
computeDPMEObject = 0;
computeEwaldObject = 0;
computeNonbondedCUDAObject = 0;
computeNonbondedMICObject = 0;
computeNonbondedWorkArrays = new ComputeNonbondedWorkArrays;
skipSplitting = 0;
#if defined(NAMD_MIC)
// Create the micPEData flag array (1 bit per PE) and initially set each PE as "not driving
// a MIC card" (unset). PEs that are driving MIC card will identify themselves during startup.
int numPEs = CkNumPes();
int numInts = ((numPEs + (sizeof(int)*8-1)) & (~(sizeof(int)*8-1))) / (sizeof(int)*8); // Round up to sizeof(int) then divide by the size of an int
micPEData = new int[numInts];
if (micPEData == NULL) { NAMD_die("Unable to allocate memory for micPEData"); }
memset(micPEData, 0, sizeof(int) * numInts);
#else
micPEData = NULL;
#endif
}
示例13: pm
void
ComputeMgr::updateLocalComputes3()
{
ComputeMap *computeMap = ComputeMap::Object();
CProxy_ProxyMgr pm(CkpvAccess(BOCclass_group).proxyMgr);
ProxyMgr *proxyMgr = pm.ckLocalBranch();
ProxyMgr::nodecount = 0;
const int nc = computeMap->numComputes();
if ( ! CkMyRank() ) {
for (int i=0; i<nc; i++) {
computeMap->setNewNumPartitions(i,0);
if (computeMap->newNode(i) != -1) {
computeMap->setNode(i,computeMap->newNode(i));
computeMap->setNewNode(i,-1);
}
}
}
for(int i=0; i<computeFlag.size(); i++) createCompute(computeFlag[i], computeMap);
computeFlag.clear();
proxyMgr->removeUnusedProxies();
if (!CkMyPe())
{
CkStartQD(CkIndex_ComputeMgr::updateLocalComputes4((CkQdMsg*)0), &thishandle);
}
}
示例14: cm
void ComputeMgr::sendCreateNonbondedMICSlave(int pe, int index) {
NonbondedMICSlaveMsg *msg = new NonbondedMICSlaveMsg;
msg->master = computeNonbondedMICObject;
msg->index = index;
CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
cm[pe].recvCreateNonbondedMICSlave(msg);
}
示例15: msmProxy
ComputeMsmSerialMgr::ComputeMsmSerialMgr() :
msmProxy(thisgroup), msmCompute(0), numSources(0), numArrived(0),
coordMsgs(0), coord(0), force(0), oldmsg(0), numAtoms(0),
msmsolver(0), msmcoord(0), msmforce(0)
{
CkpvAccess(BOCclass_group).computeMsmSerialMgr = thisgroup;
}