本文整理汇总了C++中CkMyPe函数的典型用法代码示例。如果您正苦于以下问题:C++ CkMyPe函数的具体用法?C++ CkMyPe怎么用?C++ CkMyPe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CkMyPe函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _exitHandler
static void _exitHandler(envelope *env)
{
DEBUGF(("exitHandler called on %d msgtype: %d\n", CkMyPe(), env->getMsgtype()));
switch(env->getMsgtype()) {
case StartExitMsg:
CkAssert(CkMyPe()==0);
if (!_CkExitFnVec.isEmpty()) {
CkExitFn fn = _CkExitFnVec.deq();
fn();
break;
}
// else goto next
case ExitMsg:
CkAssert(CkMyPe()==0);
if(_exitStarted) {
CmiFree(env);
return;
}
_exitStarted = 1;
CkNumberHandler(_charmHandlerIdx,(CmiHandler)_discardHandler);
CkNumberHandler(_bocHandlerIdx, (CmiHandler)_discardHandler);
env->setMsgtype(ReqStatMsg);
env->setSrcPe(CkMyPe());
// if exit in ring, instead of broadcasting, send in ring
if (_ringexit){
DEBUGF(("[%d] Ring Exit \n",CkMyPe()));
const int stride = CkNumPes()/_ringtoken;
int pe = 0;
while (pe<CkNumPes()) {
CmiSyncSend(pe, env->getTotalsize(), (char *)env);
pe += stride;
}
CmiFree(env);
}else{
CmiSyncBroadcastAllAndFree(env->getTotalsize(), (char *)env);
}
break;
case ReqStatMsg:
#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))
_messageLoggingExit();
#endif
DEBUGF(("ReqStatMsg on %d\n", CkMyPe()));
CkNumberHandler(_charmHandlerIdx,(CmiHandler)_discardHandler);
CkNumberHandler(_bocHandlerIdx, (CmiHandler)_discardHandler);
/*FAULT_EVAC*/
if(CmiNodeAlive(CkMyPe())){
#if CMK_WITH_STATS
_sendStats();
#endif
_mainDone = 1; // This is needed because the destructors for
// readonly variables will be called when the program
// exits. If the destructor is called while _mainDone
// is 0, it will assume that the readonly variable was
// declared locally. On all processors other than 0,
// _mainDone is never set to 1 before the program exits.
#if CMK_TRACE_ENABLED
if (_ringexit) traceClose();
#endif
}
if (_ringexit) {
int stride = CkNumPes()/_ringtoken;
int pe = CkMyPe()+1;
if (pe < CkNumPes() && pe % stride != 0)
CmiSyncSendAndFree(pe, env->getTotalsize(), (char *)env);
else
CmiFree(env);
}
else
CmiFree(env);
//everyone exits here - there may be issues with leftover messages in the queue
#if CMK_WITH_STATS
if(CkMyPe())
#endif
{
DEBUGF(("[%d] Calling converse exit \n",CkMyPe()));
ConverseExit();
if(CharmLibInterOperate)
CpvAccess(interopExitFlag) = 1;
}
break;
#if CMK_WITH_STATS
case StatMsg:
CkAssert(CkMyPe()==0);
_allStats[env->getSrcPe()] = (Stats*) EnvToUsr(env);
_numStatsRecd++;
DEBUGF(("StatMsg on %d with %d\n", CkMyPe(), _numStatsRecd));
/*FAULT_EVAC*/
if(_numStatsRecd==CkNumValidPes()) {
_printStats();
DEBUGF(("[%d] Calling converse exit \n",CkMyPe()));
ConverseExit();
if(CharmLibInterOperate)
CpvAccess(interopExitFlag) = 1;
}
break;
#endif
default:
CmiAbort("Internal Error(_exitHandler): Unknown-msg-type. Contact Developers.\n");
}
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:100,代码来源:init.C
示例2: Hello
Hello(const CollideHandle &collide_) :collide(collide_)
{
CkPrintf("Creating element %d on PE %d\n",thisIndex,CkMyPe());
nTimes=0;
CollideRegister(collide,thisIndex);
}
开发者ID:brog2610,项目名称:quinoa,代码行数:6,代码来源:hello.C
示例3: CkpvAccess
LdbCoordinator::LdbCoordinator()
{
if (CkpvAccess(LdbCoordinator_instance) == NULL) {
CkpvAccess(LdbCoordinator_instance) = this;
} else {
iout << iFILE << iERROR << iPE
<< "LdbCoordinator instanced twice on same node!" << endi;
CkExit();
}
#if 0
// Create a load balancer
if (CkMyPe() == 0) {
// CreateCentralLB();
CreateNamdCentLB();
// CreateNamdNborLB();
}
#endif
ldbCycleNum = 1;
takingLdbData = 1;
totalStepsDone = 0;
nLocalComputes = nLocalPatches = 0;
patchNAtoms = (int *) NULL;
sequencerThreads = (Sequencer **) NULL;
ldbStatsFP = NULL;
computeArray = NULL;
patchArray = NULL;
processorArray = NULL;
// Register self as an object manager for new charm++ balancer framework
theLbdb = LBDatabase::Object();
// Set the load balancing period (in seconds). Without this the
// load balancing framework will hang until 1 second has passed
// since the last load balancing, causing hiccups in very fast runs.
// Unfortunately, the clock is already set for the first load
// balancing, but only +LBPeriod 1.0e-5 can fix that in older charm.
// For newer versions this is handled in initproc above.
theLbdb->SetLBPeriod(1.0e-5);
myOMid.id.idx = 1;
LDCallbacks cb = { (LDMigrateFn)staticMigrateFn,
(LDStatsFn)staticStatsFn,
(LDQueryEstLoadFn)staticQueryEstLoadFn
};
myHandle = theLbdb->RegisterOM(myOMid,(void*)this,cb);
// Add myself as a local barrier receiver, so I know when I might
// be registering objects.
theLbdb->AddLocalBarrierReceiver((LDBarrierFn)staticReceiveAtSync,
(void*)this);;
// Also, add a local barrier client, to trigger load balancing
ldBarrierHandle = theLbdb->
AddLocalBarrierClient((LDResumeFn)staticResumeFromSync,
(void*)this);
migrateMsgs = 0; // linked list
numComputes = 0;
reg_all_objs = 1;
}
开发者ID:sun51,项目名称:ece598HK,代码行数:62,代码来源:LdbCoordinator.C
示例4: CmiPrintf
//.........这里部分代码省略.........
top_partition.origin[XDIR] = minx;
top_partition.origin[YDIR] = miny;
top_partition.origin[ZDIR] = minz;
top_partition.corner[XDIR] = maxx;
top_partition.corner[YDIR] = maxy;
top_partition.corner[ZDIR] = maxz;
top_partition.refno = 0;
top_partition.load = 0.0;
top_partition.count = nObjs;
// if we take background load into account
if (!_lb_args.ignoreBgLoad()) {
top_partition.bkpes.resize(0);
double total = totalLoad;
for (i=0; i<P; i++) {
if (!stats->procs[i].available) continue;
double bkload = stats->procs[i].bg_walltime;
total += bkload;
}
double averageLoad = total / npartition;
for (i=0; i<P; i++) {
if (!stats->procs[i].available) continue;
double bkload = stats->procs[i].bg_walltime;
if (bkload < averageLoad) top_partition.bkpes.push_back(i);
else CkPrintf("OrbLB Info> PE %d with %f background load will have 0 object.\n", i, bkload);
}
npartition = top_partition.bkpes.size();
// formally add these bg load to total load
for (i=0; i<npartition; i++)
totalLoad += stats->procs[top_partition.bkpes[i]].bg_walltime;
if (_lb_args.debug()>=2) {
CkPrintf("BG load: ");
for (i=0; i<P; i++) CkPrintf(" %f", stats->procs[i].bg_walltime);
CkPrintf("\n");
CkPrintf("Partition BG load: ");
for (i=0; i<npartition; i++) CkPrintf(" %f", stats->procs[top_partition.bkpes[i]].bg_walltime);
CkPrintf("\n");
}
}
top_partition.load = totalLoad;
currentp = 0;
refno = 0;
// recursively divide
rec_divide(npartition, top_partition);
// mapping partitions to nodes
mapPartitionsToNodes();
// this is for sanity check
int *num = new int[P];
for (i=0; i<P; i++) num[i] = 0;
for (i=0; i<nObjs; i++)
{
for (j=0; j<npartition; j++)
if (computeLoad[i].refno == partitions[j].refno) {
computeLoad[i].partition = partitions+j;
num[j] ++;
}
CmiAssert(computeLoad[i].partition != NULL);
}
for (i=0; i<npartition; i++)
if (num[i] != partitions[i].count)
CmiAbort("OrbLB: Compute counts don't agree!\n");
delete [] num;
// Save output
objIdx = 0;
for(int obj=0;obj<stats->n_objs;obj++) {
stats->to_proc[obj] = stats->from_proc[obj];
LDObjData &odata = stats->objData[obj];
if (odata.migratable == 0) { continue; }
int frompe = stats->from_proc[obj];
int tope = computeLoad[objIdx].partition->node;
if (frompe != tope) {
if (_lb_args.debug() >= 3) {
CkPrintf("[%d] Obj %d migrating from %d to %d\n",
CkMyPe(),obj,frompe,tope);
}
stats->to_proc[obj] = tope;
}
objIdx ++;
}
// free memory
delete [] computeLoad;
for (i=0; i<3; i++) delete [] vArray[i];
delete [] partitions;
if (_lb_args.debug() >= 1)
CkPrintf("OrbLB finished time: %fs\n", CkWallTimer() - t);
#endif
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:101,代码来源:OrbLB.C
示例5: DebugM
void ComputeDPME::doWork()
{
DebugM(4,"Entering ComputeDPME::doWork().\n");
Pme2Particle *localData;
ResizeArrayIter<PatchElem> ap(patchList);
// Skip computations if nothing to do.
if ( ! patchList[0].p->flags.doFullElectrostatics )
{
for (ap = ap.begin(); ap != ap.end(); ap++) {
CompAtom *x = (*ap).positionBox->open();
Results *r = (*ap).forceBox->open();
(*ap).positionBox->close(&x);
(*ap).forceBox->close(&r);
}
if ( master ) {
master->reduction->submit();
}
return;
}
// allocate storage
numLocalAtoms = 0;
for (ap = ap.begin(); ap != ap.end(); ap++) {
numLocalAtoms += (*ap).p->getNumAtoms();
}
Lattice lattice = patchList[0].p->flags.lattice;
localData = new Pme2Particle[numLocalAtoms]; // given to message
// get positions and charges
Pme2Particle * data_ptr = localData;
const BigReal coulomb_sqrt = sqrt( COULOMB * ComputeNonbondedUtil::scaling
* ComputeNonbondedUtil::dielectric_1 );
for (ap = ap.begin(); ap != ap.end(); ap++) {
CompAtom *x = (*ap).positionBox->open();
if ( patchList[0].p->flags.doMolly ) {
(*ap).positionBox->close(&x);
x = (*ap).avgPositionBox->open();
}
int numAtoms = (*ap).p->getNumAtoms();
for(int i=0; i<numAtoms; ++i)
{
Vector tmp = lattice.delta(x[i].position);
data_ptr->x = tmp.x;
data_ptr->y = tmp.y;
data_ptr->z = tmp.z;
data_ptr->cg = coulomb_sqrt * x[i].charge;
data_ptr->id = x[i].id;
++data_ptr;
}
if ( patchList[0].p->flags.doMolly ) { (*ap).avgPositionBox->close(&x); }
else { (*ap).positionBox->close(&x); }
}
// send data to master
ComputeDPMEDataMsg *msg = new ComputeDPMEDataMsg;
msg->node = CkMyPe();
msg->numParticles = numLocalAtoms;
msg->particles = localData;
comm->sendComputeDPMEData(msg);
}
开发者ID:aar2163,项目名称:NAMD-energy,代码行数:67,代码来源:ComputeDPME.C
示例6: work
//.........这里部分代码省略.........
for (j=0; j<nobjs; j++) {
int recverID = stats->getHash(objs[j]);
if((senderID == -1)||(recverID == -1))
if (_lb_args.migObjOnly()) continue;
else CkAbort("Error in search\n");
if(newmap[senderID]==newmap[recverID])
continue;
if(partgraph->edges[newmap[senderID]][newmap[recverID]] == 0){
partgraph->nodes[newmap[senderID]].degree++;
partgraph->nodes[newmap[recverID]].degree++;
}
//Communication added only once for a message sent to many objects on a single processor
if(!addedComm[newmap[recverID]]){
partgraph->edges[newmap[senderID]][newmap[recverID]] += cdata.bytes;
partgraph->edges[newmap[recverID]][newmap[senderID]] += cdata.bytes;
partgraph->nodes[newmap[senderID]].comm += cdata.bytes;
partgraph->nodes[newmap[recverID]].comm += cdata.bytes;
if(partgraph->nodes[newmap[senderID]].comm > max_comm){
max_comm = partgraph->nodes[newmap[senderID]].comm;
max_comm_part = newmap[senderID];
}
if(partgraph->nodes[newmap[recverID]].comm > max_comm){
max_comm = partgraph->nodes[newmap[recverID]].comm;
max_comm_part = newmap[recverID];
}
//bytesComm[newmap[senderID]][newmap[recverID]] += cdata.bytes;
//bytesComm[newmap[recverID]][newmap[senderID]] += cdata.bytes;
addedComm[newmap[recverID]]=1;
}
}
}
}
#endif
int *proc_mapping = new int[n_pes];
delete [] addedComm;
LBtopoFn topofn;
//Parsing the command line input for getting the processor topology
char *lbcopy = strdup(_lbtopo);
char *ptr = strchr(lbcopy, ':');
if (ptr!=NULL)
ptr = strtok(lbcopy, ":");
else
ptr=lbcopy;
topofn = LBTopoLookup(ptr);
if (topofn == NULL) {
char str[1024];
CmiPrintf("TopoCentLB> Fatal error: Unknown topology: %s. Choose from:\n", ptr);
printoutTopo();
sprintf(str, "TopoCentLB> Fatal error: Unknown topology: %s", ptr);
CmiAbort(str);
}
topo = topofn(n_pes);
//Call the core routine to produce the partition processor mapping
calculateMST(partgraph,topo,proc_mapping,max_comm_part);
//Returned partition graph is a Maximum Spanning Tree -- converted in above function itself
//Debugging code: Result of mapping partition graph onto processor graph
if (_lb_args.debug()>1) {
CkPrintf("Resultant mapping..(partition,processor)\n");
for(i = 0; i < n_pes; i++)
CkPrintf("%d,%d\n",i,proc_mapping[i]);
}
//Store the result in the load balancing database
int pe;
PartGraph::Node* n;
for(i = 0; i < n_pes; i++){
pe = proc_mapping[i];
n = &partgraph->nodes[i];
for(j=0;j<n->num_objs;j++){
stats->to_proc[n->obj_list[j]] = pe;
if (_lb_args.debug()>1)
CkPrintf("[%d] Obj %d migrating from %d to %d\n", CkMyPe(),n->obj_list[j],stats->from_proc[n->obj_list[j]],pe);
}
}
delete[] newmap;
delete[] proc_mapping;
//Delete hopCount
for(i = 0; i < n_pes; i++)
delete[] hopCount[i];
delete[] hopCount;
delete[] heapMapping;
delete partgraph;
}
开发者ID:quinoacomputing,项目名称:quinoa,代码行数:101,代码来源:TopoCentLB.C
示例7: CpvInitialize
//! process command line arguments!
void TraceCounter::traceInit(char **argv)
{
CpvInitialize(CountLogPool*, _logPool);
CpvInitialize(char*, _logName);
CpvInitialize(double, version);
CpvInitialize(char**, _counterNames);
CpvInitialize(char**, _counterDesc);
CpvInitialize(int, _numCounters);
CpvInitialize(int, _reductionID);
CpvAccess(_logName) = (char *) malloc(strlen(argv[0])+1);
_MEMCHECK(CpvAccess(_logName));
strcpy(CpvAccess(_logName), argv[0]);
CpvAccess(version) = VER;
int i;
// parse command line args
char* counters = NULL;
commandLine_ = NULL;
bool badArg = false;
int numCounters = 0;
if (CmiGetArgStringDesc(argv, "+counters", &counters, "Measure these performance counters")) {
if (CmiMyPe()==0) { CmiPrintf("Counters: %s\n", counters); }
int offset = 0;
int limit = strlen(counters);
char* ptr = counters;
while (offset < limit &&
(ptr = strtok(&counters[offset], ",")) != NULL)
{
offset += strlen(ptr)+1;
ptr = &ptr[strlen(ptr)+1];
numCounters++;
}
if (CmiMyPe()==0) {
CmiPrintf("There are %d counters\n", numCounters);
}
commandLine_ = new CounterArg[numCounters];
ptr = counters;
for (i=0; i<numCounters; i++) {
commandLine_[i].arg = ptr;
if (!matchArg(&commandLine_[i])) {
if (CmiMyPe()==0) { CmiPrintf("Bad arg: [%s]\n", ptr); }
badArg = true;
}
ptr = &ptr[strlen(ptr)+1];
}
}
commandLineSz_ = numCounters;
// check to see if args are valid, output if not
if (badArg || CmiGetArgFlagDesc(argv, "+count-help", "List available performance counters")) {
if (CmiMyPe() == 0) { printHelp(); }
ConverseExit(); return;
}
else if (counters == NULL) {
if (CmiMyPe() == 0) { usage(); }
ConverseExit(); return;
}
// get optional command line args
overview_ = CmiGetArgFlag(argv, "+count-overview");
switchRandom_ = CmiGetArgFlag(argv, "+count-switchrandom");
switchByPhase_ = CmiGetArgFlag(argv, "+count-switchbyphase");
noLog_ = CmiGetArgFlag(argv, "+count-nolog");
writeByPhase_ = CmiGetArgFlag(argv, "+count-writebyphase");
char* logName = NULL;
if (CmiGetArgString(argv, "+count-logname", &logName)) {
CpvAccess(_logName) = logName;
if (noLog_) {
if (CkMyPe()==0) {
CmiPrintf("+count-logname and +count-nolog are MUTUALLY EXCLUSIVE\n");
usage();
CmiAbort("");
}
}
}
if (switchByPhase_ && overview_) {
if (CkMyPe()==0) {
CmiPrintf(
"+count-switchbyphase and +count-overview are MUTUALLY EXCLUSIVE\n"
"+count-overview automatically switches by phase.\n");
usage();
CmiAbort("");
}
}
if (writeByPhase_ && noLog_) {
if (CkMyPe()==0) {
CmiPrintf("+count-writebyphase and +count-nolog are MUTUALLY EXCLUSIVE\n");
usage();
CmiAbort("");
}
}
// parse through commandLine_, figure out which belongs on which list (1 vs 2)
CounterArg* last1 = NULL;
CounterArg* last2 = NULL;
CounterArg* tmp = NULL;
counter1Sz_ = counter2Sz_ = 0;
for (i=0; i<commandLineSz_; i++) {
//.........这里部分代码省略.........
开发者ID:quinoacomputing,项目名称:quinoa,代码行数:101,代码来源:trace-counter.C
示例8: p
/// ENTRY: Gathers PVT reports; calculates and broadcasts GVT to PVTs
void GVT::computeGVT(UpdateMsg *m)
{
#ifndef CMK_OPTIMIZE
if(pose_config.stats)
localStats->TimerStart(GVT_TIMER);
#endif
CProxy_PVT p(ThePVT);
CProxy_GVT g(TheGVT);
GVTMsg *gmsg = new GVTMsg;
POSE_TimeType lastGVT = 0, earliestMsg = POSE_UnsetTS,
earlyAny = POSE_UnsetTS;
SRentry *tmpSRs = SRs;
if (CkMyPe() != 0) startOffset = 1;
if (m->runGVTflag == 1) done++;
else {
// see if message provides new min optGVT or conGVT
if ((optGVT < 0) || ((m->optPVT > POSE_UnsetTS) && (m->optPVT < optGVT)))
optGVT = m->optPVT;
if ((conGVT < 0) || ((m->conPVT > POSE_UnsetTS) && (m->conPVT < conGVT)))
conGVT = m->conPVT;
if (m->maxSR > earlyAny)
earlyAny = m->maxSR;
// add send/recv info to SRs
/* if (m->numEntries > 0)
CkPrintf("GVT recv'd %d SRs from a PE, earliest=%d\n", m->numEntries,
m->SRs[0].timestamp);*/
addSR(&SRs, m->SRs, optGVT, m->numEntries);
done++;
}
CkFreeMsg(m);
if (done == reportsExpected+startOffset) { // all PVT reports are in
#ifndef CMK_OPTIMIZE
if(pose_config.stats)
localStats->GvtInc();
#endif
gvtIterationCount++;
done = 0;
startOffset = 1;
lastGVT = estGVT; // store previous estimate
if (lastGVT < 0) lastGVT = 0;
estGVT = POSE_UnsetTS;
// derive GVT estimate from min optimistic & conservative GVTs
estGVT = optGVT;
if ((conGVT > POSE_UnsetTS) && (estGVT > POSE_UnsetTS) && (conGVT < estGVT)) estGVT = conGVT;
// Check if send/recv activity provides lower possible estimate
/* if (SRs) SRs->dump();
else CkPrintf("No SRs reported to GVT!\n");*/
SRentry *tmp = SRs;
POSE_TimeType lastSR = POSE_UnsetTS;
while (tmp && ((tmp->timestamp <= estGVT) || (estGVT == POSE_UnsetTS))) {
lastSR = tmp->timestamp;
if (tmp->sends != tmp->recvs) {
earliestMsg = tmp->timestamp;
break;
}
tmp = tmp->next;
}
/* if ((earliestMsg > POSE_UnsetTS) || (earlyAny > POSE_UnsetTS))
CkPrintf("GVT: earlyDiff=%d earlyAny=%d estGVT was %d.\n", earliestMsg, earlyAny, estGVT);*/
if (((earliestMsg < estGVT) && (earliestMsg != POSE_UnsetTS)) ||
(estGVT == POSE_UnsetTS))
estGVT = earliestMsg;
if ((lastSR != POSE_UnsetTS) && (estGVT == POSE_UnsetTS) &&
(lastSR > lastGVT))
estGVT = lastSR;
// check for inactivity
if ((optGVT == POSE_UnsetTS) && (earliestMsg == POSE_UnsetTS)) {
inactive++;
/*
if (inactive == 1) {
CkPrintf("[%d] Inactive... calling CkWaitQD...\n", CkMyPe());
CkWaitQD();
CkPrintf("[%d] Back from CkWaitQD...\n", CkMyPe());
}
*/
estGVT = lastGVT;
if (inactive == 1) inactiveTime = lastGVT;
}
else if (estGVT < 0) {
estGVT = lastGVT;
inactive = 0;
}
else inactive = 0;
// check the estimate
//CkPrintf("opt=%d con=%d lastGVT=%d early=%d lastSR=%d et=%d\n", optGVT, conGVT, lastGVT, earliestMsg, lastSR, POSE_endtime);
CmiAssert(estGVT >= lastGVT);
//if (estGVT % 1000 == 0)
//CkPrintf("[%d] New GVT = %d\n", CkMyPe(), estGVT);
//CkPrintf("[%d] New GVT = %lld\n", CkMyPe(), estGVT);
// check for termination conditions
int term = 0;
if ((estGVT >= POSE_endtime) && (POSE_endtime > POSE_UnsetTS)) {
//.........这里部分代码省略.........
开发者ID:davidheryanto,项目名称:sc14,代码行数:101,代码来源:gvt.C
示例9: CmiAssert
void CentralLB::ReceiveStats(CkMarshalledCLBStatsMessage &msg)
{
#if CMK_LBDB_ON
if (statsMsgsList == NULL) {
statsMsgsList = new CLBStatsMsg*[CkNumPes()];
CmiAssert(statsMsgsList != NULL);
for(int i=0; i < CkNumPes(); i++)
statsMsgsList[i] = 0;
}
if (statsData == NULL) statsData = new LDStats;
// loop through all CLBStatsMsg in the incoming msg
int count = msg.getCount();
for (int num = 0; num < count; num++)
{
CLBStatsMsg *m = msg.getMessage(num);
CmiAssert(m!=NULL);
const int pe = m->from_pe;
DEBUGF(("Stats msg received, %d %d %d %p step %d\n", pe,stats_msg_count,m->n_objs,m,step()));
#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))
/*
* if(m->step < step()){
* //TODO: if a processor is redoing an old load balance step..
* //tell it that the step is done and that it should not perform any migrations
* thisProxy[pe].ReceiveDummyMigration();
* }*/
#endif
if(!CmiNodeAlive(pe)){
DEBUGF(("[%d] ReceiveStats called from invalidProcessor %d\n",CkMyPe(),pe));
continue;
}
if (m->avail_vector!=NULL) {
LBDatabaseObj()->set_avail_vector(m->avail_vector, m->next_lb);
}
if (statsMsgsList[pe] != 0) {
CkPrintf("*** Unexpected CLBStatsMsg in ReceiveStats from PE %d ***\n",
pe);
} else {
statsMsgsList[pe] = m;
#if USE_REDUCTION
depositData(m);
#else
// store per processor data right away
struct ProcStats &procStat = statsData->procs[pe];
procStat.pe = pe;
procStat.total_walltime = m->total_walltime;
procStat.idletime = m->idletime;
procStat.bg_walltime = m->bg_walltime;
#if CMK_LB_CPUTIMER
procStat.total_cputime = m->total_cputime;
procStat.bg_cputime = m->bg_cputime;
#endif
procStat.pe_speed = m->pe_speed;
//procStat.utilization = 1.0;
procStat.available = CmiTrue;
procStat.n_objs = m->n_objs;
statsData->n_objs += m->n_objs;
statsData->n_comm += m->n_comm;
#endif
#if defined(TEMP_LDB)
procStat.pe_temp=m->pe_temp;
procStat.pe_speed=m->pe_speed;
#endif
stats_msg_count++;
}
} // end of for
const int clients = CkNumValidPes();
DEBUGF(("THIS POINT count = %d, clients = %d\n",stats_msg_count,clients));
if (stats_msg_count == clients) {
DEBUGF(("[%d] All stats messages received \n",CmiMyPe()));
statsData->nprocs() = stats_msg_count;
thisProxy[CkMyPe()].LoadBalance();
}
#endif
}
开发者ID:luyukunphy,项目名称:namd,代码行数:82,代码来源:CentralLB.C
示例10: return
/// Register poser with PVT
int PVT::objRegister(int arrIdx, POSE_TimeType safeTime, int sync, sim *myPtr)
{
int i = objs.Insert(arrIdx, POSE_UnsetTS, sync, myPtr); // add to object list
return(i*1000 + CkMyPe()); // return unique PVT idx
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:6,代码来源:gvt.C
示例11: objRemove
// Unregister poser from PVT
void PVT::objRemove(int pvtIdx)
{
int idx = (pvtIdx-CkMyPe())/1000; // calculate local index from unique index
objs.Delete(idx); // delete the object
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:6,代码来源:gvt.C
示例12: CkPrintf
/// Basic Constructor
PVT::PVT()
{
#ifdef VERBOSE_DEBUG
CkPrintf("[%d] constructing PVT\n",CkMyPe());
#endif
CpvInitialize(int, stateRecovery);
CpvAccess(stateRecovery) = 0;
CpvInitialize(eventID, theEventID);
CpvAccess(theEventID)=eventID();
// CpvAccess(theEventID).dump();
//LBTurnInstrumentOff();
optGVT = POSE_UnsetTS; conGVT = POSE_UnsetTS;
rdone=0;
SRs=NULL;
#ifdef POSE_COMM_ON
//com_debug = 1;
#endif
#ifndef CMK_OPTIMIZE
localStats = (localStat *)CkLocalBranch(theLocalStats);
if (pose_config.stats) {
localStats->TimerStart(GVT_TIMER);
}
#endif
#ifdef MEM_TEMPORAL
localTimePool = (TimePool *)CkLocalBranch(TempMemID);
CkPrintf("NOTE: Temporal memory manager is ON!\n");
#endif
optPVT = conPVT = estGVT = POSE_UnsetTS;
startPhaseActive = gvtTurn = simdone = 0;
SendsAndRecvs = new SRtable();
SendsAndRecvs->Initialize();
specEventCount = eventCount = waitForFirst = 0;
iterMin = POSE_UnsetTS;
int P=CkNumPes(), N=CkMyPe();
reportReduceTo = -1;
if ((N < P-2) && (N%2 == 1)) { //odd
reportTo = N-1;
reportsExpected = reportEnd = 0;
}
else if (N < P-2) { //even
reportTo = N;
reportsExpected = 2;
if (N == P-3)
reportsExpected = 1;
reportEnd = 0;
if (N < (P-2)/2)
reportReduceTo = P-2;
else reportReduceTo = P-1;
}
if (N == P-2) {
reportTo = N;
reportEnd = 1;
reportsExpected = 1 + (P-2)/4 + ((P-2)%4)/2;
}
else if (N == P-1) {
reportTo = N;
reportEnd = 1;
if (P==1) reportsExpected = 1;
else reportsExpected = 1 + (P-2)/4 + (P-2)%2;
}
// CkPrintf("PE %d reports to %d, receives %d reports, reduces and sends to %d, and reports directly to GVT if %d = 1!\n", CkMyPe(), reportTo, reportsExpected, reportReduceTo, reportEnd);
parCheckpointInProgress = 0;
parLastCheckpointGVT = 0;
parLastCheckpointTime = parStartTime = 0.0;
parLBInProgress = 0;
parLastLBGVT = 0;
// debugBufferLoc = debugBufferWrapped = debugBufferDumped = 0;
#ifndef CMK_OPTIMIZE
if(pose_config.stats)
localStats->TimerStop();
#endif
LBDatabase::Object()->AddMigrationDoneFn(staticDoneLB, this);
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:76,代码来源:gvt.C
示例13: _initCharm
//.........这里部分代码省略.........
memCriticalEntries[memcnt++] = i;
}
}
}
#endif
#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))
_messageLoggingInit();
#endif
#ifndef __BIGSIM__
/*
FAULT_EVAC
*/
CpvAccess(_validProcessors) = new char[CkNumPes()];
for(int vProc=0;vProc<CkNumPes();vProc++){
CpvAccess(_validProcessors)[vProc]=1;
}
_ckEvacBcastIdx = CkRegisterHandler((CmiHandler)_ckEvacBcast);
_ckAckEvacIdx = CkRegisterHandler((CmiHandler)_ckAckEvac);
#endif
CkpvAccess(startedEvac) = 0;
CpvAccess(serializer) = 0;
evacuate = 0;
CcdCallOnCondition(CcdSIGUSR1,(CcdVoidFn)CkDecideEvacPe,0);
#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))
CcdCallOnCondition(CcdSIGUSR2,(CcdVoidFn)CkMlogRestart,0);
#endif
if(_raiseEvac){
processRaiseEvacFile(_raiseEvacFile);
/*
if(CkMyPe() == 2){
// CcdCallOnConditionKeep(CcdPERIODIC_10s,(CcdVoidFn)CkDecideEvacPe,0);
CcdCallFnAfter((CcdVoidFn)CkDecideEvacPe, 0, 10000);
}
if(CkMyPe() == 3){
CcdCallFnAfter((CcdVoidFn)CkDecideEvacPe, 0, 10000);
}*/
}
if (CkMyRank() == 0) {
TopoManager_init();
}
CmiNodeAllBarrier();
if (!_replaySystem) {
CkFtFn faultFunc_restart = CkRestartMain;
if (faultFunc == NULL || faultFunc == faultFunc_restart) { // this is not restart from memory
// these two are blocking calls for non-bigsim
#if ! CMK_BIGSIM_CHARM
CmiInitCPUAffinity(argv);
CmiInitMemAffinity(argv);
#endif
}
CmiInitCPUTopology(argv);
#if CMK_SHARED_VARS_POSIX_THREADS_SMP
if (CmiCpuTopologyEnabled()) {
int *pelist;
int num;
CmiGetPesOnPhysicalNode(0, &pelist, &num);
#if !CMK_MULTICORE && !CMK_SMP_NO_COMMTHD
// Count communication threads, if present
// XXX: Assuming uniformity of node size here
num += num/CmiMyNodeSize();
开发者ID:gitter-badger,项目名称:quinoa,代码行数:67,代码来源:init.C
示例14: simple
simple(double pi)
{
ckout<<"I am a simple chare running from processor:"<<CkMyPe()<<endl;
y = pi;
};
开发者ID:ChinmaySKulkarni,项目名称:Charm-Practice-Programs,代码行数:5,代码来源:async.C
示例15: CkNumPes
void CentralLB::LoadBalance()
{
#if CMK_LBDB_ON
int proc;
const int clients = CkNumPes();
#if ! USE_REDUCTION
// build data
buildStats();
#else
for (proc = 0; proc < clients; proc++) statsMsgsList[proc] = NULL;
#endif
theLbdb->ResetAdaptive();
if (!_lb_args.samePeSpeed()) statsData->normalize_speed();
if (_lb_args.debug())
CmiPrintf("\nCharmLB> %s: PE [%d] step %d starting at %f Memory: %f MB\n",
lbname, cur_ld_balancer, step(), start_lb_time,
CmiMemoryUsage()/(1024.0*1024.0));
// if we are in simulation mode read data
if (LBSimulation::doSimulation) simulationRead();
char *availVector = LBDatabaseObj()->availVector();
for(proc = 0; proc < clients; proc++)
statsData->procs[proc].available = (CmiBool)availVector[proc];
preprocess(statsData);
// CkPrintf("Before Calling Strategy\n");
if (_lb_args.printSummary()) {
LBInfo info(clients);
// not take comm data
info.getInfo(statsData, clients, 0);
LBRealType mLoad, mCpuLoad, totalLoad;
info.getSummary(mLoad, mCpuLoad, totalLoad);
int nmsgs, nbytes;
statsData->computeNonlocalComm(nmsgs, nbytes);
CkPrintf("[%d] Load Summary (before LB): max (with bg load): %f max (obj only): %f average: %f at step %d nonlocal: %d msgs %.2fKB.\n", CkMyPe(), mLoad, mCpuLoad, totalLoad/clients, step(), nmsgs, 1.0*nbytes/1024);
// if (_lb_args.debug() > 1) {
// for (int i=0; i<statsData->n_objs; i++)
// CmiPrintf("[%d] %.10f %.10f\n", i, statsData->objData[i].minWall, statsData->objData[i].maxWall);
// }
}
#if CMK_REPLAYSYSTEM
LDHandle *loadBalancer_pointers;
if (_replaySystem) {
loadBalancer_pointers = (LDHandle*)malloc(CkNumPes()*sizeof(LDHandle));
for (int i=0; i<statsData->n_objs; ++i) loadBalancer_pointers[statsData->from_proc[i]] = statsData->objData[i].handle.omhandle.ldb;
}
#endif
LBMigrateMsg* migrateMsg = Strategy(statsData);
#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))
migrateMsg->step = step();
#endif
#if CMK_REPLAYSYSTEM
CpdHandleLBMessage(&migrateMsg);
if (_replaySystem) {
for (int i=0; i<migrateMsg->n_moves; ++i) migrateMsg->moves[i].obj.omhandle.ldb = loadBalancer_pointers[migrateMsg->moves[i].from_pe];
free(loadBalancer_pointers);
}
#endif
LBDatabaseObj()->get_avail_vector(migrateMsg->avail_vector);
migrateMsg->next_lb = LBDatabaseObj()->new_lbbalancer();
// if this is the step at which we need to dump the database
simulationWrite();
// calculate predicted load
// very time consuming though, so only happen when debugging is on
if (_lb_args.printSummary()) {
LBInfo info(clients);
// not take comm data
getPredictedLoadWithMsg(statsData, clients, migrateMsg, info, 0);
LBRealType mLoad, mCpuLoad, totalLoad;
info.getSummary(mLoad, mCpuLoad, totalLoad);
int nmsgs, nbytes;
statsData->computeNonlocalComm(nmsgs, nbytes);
CkPrintf("[%d] Load Summary (after LB): max (with bg load): %f max (obj only): %f average: %f at step %d nonlocal: %d msgs %.2fKB useMem: %.2fKB.\n", CkMyPe(), mLoad, mCpuLoad, totalLoad/clients, step(), nmsgs, 1.0*nbytes/1024, (1.0*useMem())/1024);
for (int i=0; i<clients; i++)
migrateMsg->expectedLoad[i] = info.peLoads[i];
}
DEBUGF(("[%d]calling recv migration\n",CkMyPe()));
#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))
lbDecisionCount++;
migrateMsg->lbDecisionCount = lbDecisionCount;
#endif
envelope *env = UsrToEnv(migrateMsg);
if (1) {
// broadcast
thisProxy.ReceiveMigration(migrateMsg);
}
//.........这里部分代码省略.........
开发者ID:luyukunphy,项目名称:namd,代码行数:101,代码来源:CentralLB.C
示例16: FEM_master_parallel_part
//.........这里部分代码省略.........
printf("Creating mapping of node to partition took %.6lf\n",CkWallTimer()-dataArrangeStartTime);
dataArrangeStartTime = CkWallTimer();
MSA1DINTLIST::Read nodepartRead = nodepartAcc.syncToRead();
/*
Set up a msa to store the nodes that belong to a partition
*/
MSA1DNODELIST part2node(numChunks,numChunks);
MPI_Bcast_pup(part2node,masterRank,(MPI_Comm)comm_context);
part2node.enroll(numChunks);
MSA1DNODELIST::Accum part2nodeAcc = part2node.getInitialAccum();
FEM_write_part2node(nodepartRead, part2nodeAcc, partdata, (MPI_Comm)comm_context);
/*
Get the list of elements and nodes that belong to this partition
*/
MSA1DNODELIST::Read rPart2node = part2nodeAcc.syncToRead();
NodeList lnodes = rPart2node.get(masterRank);
lnodes.uniquify();
// IntList lelems = part2elem.get(masterRank);
printf("Creating mapping of partition to node took %.6lf\n",CkWallTimer()-dataArrangeStartTime);
printf("Time spent doing +=ElemList %.6lf \n",elemlistaccTime);
dataArrangeStartTime = CkWallTimer();
/*
Build an MSA of FEM_Mesh, with each index containing the mesh for that chunk
*/
MSA1DFEMMESH part2mesh(numChunks,numChunks);
MPI_Bcast_pup(part2mesh,masterRank,(MPI_Comm)comm_context);
part2mesh.enroll(numChunks);
MSA1DFEMMESH::Accum aPart2mesh = part2mesh.getInitialAccum();
FEM_write_part2mesh(aPart2mesh,partdata, &data,nodepartRead,numChunks,masterRank,&mypiece);
/*
Get your mesh consisting of elements and nodes out of the mesh MSA
*/
MSA1DFEMMESH::Read rPart2mesh = aPart2mesh.syncToRead();
MeshElem me = rPart2mesh.get(masterRank);
//printf("[%d] Number of elements in my partitioned mesh %d number of nodes %d \n",masterRank,me.m->nElems(),me.m->node.size());
DEBUG(printf("[%d] Memory usage on vp 0 close to max %d \n",CkMyPe(),CmiMemoryUsage()));
//Free up the eptr and eind MSA arrays stored in data
delete &rPtr;
delete &rInd;
data.arr1.FreeMem();
data.arr2.FreeMem();
nodepart.FreeMem();
DEBUG(printf("[%d] Memory usage on vp 0 after FreeMem %d \n",CkMyPe(),CmiMemoryUsage()));
addIDXLists(me.m,lnodes,masterRank);
part2node.FreeMem();
DEBUG(printf("[%d] Memory usage on vp 0 after addIDXL %d \n",CkMyPe(),CmiMemoryUsage()));
/*
Broadcast the user data to all the meshes
*/
DEBUG(printf("[%d] Length of udata vector in master %d \n",masterRank,m->udata.size()));
MPI_Bcast_pup(m->udata,masterRank,(MPI_Comm)comm_context);
me.m->udata = m->udata;
delete partdata;
printf("[%d] Data Arrangement took %.6lf \n",masterRank,CkWallTimer()-dataArrangeStartTime);
/*
collect the ghost data and send it to all the chunks.
*/
struct ghostdata *gdata = gatherGhosts();
DEBUG(printf("[%d] number of ghost layers %d \n",masterRank,gdata->numLayers));
MPI_Bcast_pup(*gdata,masterRank,(MPI_Comm)comm_context);
/*
make ghosts for this mesh
*/
printf("[%d] Starting to generate number of ghost layers %d \n",masterRank,gdata->numLayers);
double _startTime = CkWallTimer();
makeGhosts(me.m,(MPI_Comm)comm_context,masterRank,gdata->numLayers,gdata->layers);
delete gdata;
printf("[%d] Ghost generation took %.6lf \n",masterRank,CkWallTimer()-_startTime);
me.m->becomeGetting();
FEM_chunk *chunk = FEM_chunk::get("FEM_Mesh_Parallel_broadcast");
int tempMeshNo = chunk->meshes.put(me.m);
int new_mesh = FEM_Mesh_copy(tempMeshNo);
FEM_Mesh *nmesh = c->lookup(new_mesh,"master_parallel_broadcast");
DEBUG(printf("[%d] Length of udata vector in master new_mesh %d \n",masterRank,nmesh->udata.size()));
part2mesh.FreeMem();
printf("[%d] Max Memory usage on vp 0 at end of parallel partition %d \n",CkMyPe(),CmiMaxMemoryUsage());
return new_mesh;
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:101,代码来源:parallel_part.C
示例17: Hello
Hello(int _aNum, CkGroupID mcastMgrGID): aNum(_aNum), mcastMgr(NULL), isCookieSet(false)
{
CkPrintf("Array %d, Element %d created on PE %d\n", aNum, thisIndex, CkMyPe());
mcastMgr = CProxy_CkMulticastMgr(mcastMgrGID).ckLocalBranch();
}
开发者ID:brog2610,项目名称:quinoa,代码行数:5,代码来源:hello.C
示例18: CkPrintf
void GridCommLB::Map_NonMigratable_Objects_To_PEs ()
{
int i;
for (i = 0; i < Num_Objects; i++) {
if (!((&Object_Data[i])->migratable)) {
if (_lb_args.debug() > 1) {
CkPrintf ("[%d] GridCommLB identifies object %d as non-migratable.\n", CkMyPe(), i);
}
Assign_Object_To_PE (i, (&Object_Data[i])->from_pe);
}
}
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:15,代码来源:GridCommLB.C
示例19: CentralLB
OrbLB::OrbLB(const CkLBOptions &opt): CentralLB(opt)
{
lbname = "OrbLB";
if (CkMyPe() == 0)
CkPrintf("[%d] OrbLB created\n",CkMyPe());
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:6,代码来源:OrbLB.C
示例20: if
//.........这里部分代码省略.........
int min_objs;
int i;
min_index = -1;
min_objs = MAXINT;
|
请发表评论