本文整理汇总了C++中CkPrintf函数的典型用法代码示例。如果您正苦于以下问题:C++ CkPrintf函数的具体用法?C++ CkPrintf怎么用?C++ CkPrintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CkPrintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _printStats
static inline void _printStats(void)
{
DEBUGF(("[%d] _printStats\n", CkMyPe()));
int i;
if(_printSS || _printCS) {
Stats *total = new Stats();
_MEMCHECK(total);
for(i=0;i<CkNumPes();i++)
total->combine(_allStats[i]);
CkPrintf("Charm Kernel Summary Statistics:\n");
for(i=0;i<CkNumPes();i++) {
CkPrintf("Proc %d: [%d created, %d processed]\n", i,
_allStats[i]->getCharesCreated(),
_allStats[i]->getCharesProcessed());
}
CkPrintf("Total Chares: [%d created, %d processed]\n",
total->getCharesCreated(), total->getCharesProcessed());
}
if(_printCS) {
CkPrintf("Charm Kernel Detailed Statistics (R=requested P=processed):\n\n");
CkPrintf(" Create Mesgs Create Mesgs Create Mesgs\n");
CkPrintf(" Chare for Group for Nodegroup for\n");
CkPrintf("PE R/P Mesgs Chares Mesgs Groups Mesgs Nodegroups\n");
CkPrintf("---- --- --------- --------- --------- --------- --------- ----------\n");
for(i=0;i<CkNumPes();i++) {
CkPrintf("%4d R %9d %9d %9d %9d %9d %9d\n P %9d %9d %9d %9d %9d %9d\n",i,
_allStats[i]->getCharesCreated(),
_allStats[i]->getForCharesCreated(),
_allStats[i]->getGroupsCreated(),
_allStats[i]->getGroupMsgsCreated(),
_allStats[i]->getNodeGroupsCreated(),
_allStats[i]->getNodeGroupMsgsCreated(),
_allStats[i]->getCharesProcessed(),
_allStats[i]->getForCharesProcessed(),
_allStats[i]->getGroupsProcessed(),
_allStats[i]->getGroupMsgsProcessed(),
_allStats[i]->getNodeGroupsProcessed(),
_allStats[i]->getNodeGroupMsgsProcessed());
}
}
}
示例2: CkPrintf
/** Extract elements adjacent to edge [n1,n2] along with element-local node
numberings and nodes opposite input edge **/
int FEM_Adapt::findAdjData(int n1, int n2, int *e1, int *e2, int *e1n1,
int *e1n2, int *e1n3, int *e2n1, int *e2n2,
int *e2n3, int *n3, int *n4)
{
// Set some default values in case e1 is not there
(*e1n1) = (*e1n2) = (*e1n3) = (*n3) = -1;
//if n1,n2 is not an edge return
if(n1<0 || n2<0) return -1;
if(theMesh->node.is_valid(n1)==0 || theMesh->node.is_valid(n2)==0) return -1;
if(theMesh->n2n_exists(n1,n2)!=1 || theMesh->n2n_exists(n2,n1)!=1) return -1;
(*e1) = theMesh->getElementOnEdge(n1, n2); // assumed to return local element
if ((*e1) == -1) {
CkPrintf("[%d]Warning: No Element on edge %d->%d\n",theMod->idx,n1,n2);
return -1;
}
(*e1n1) = find_local_node_index((*e1), n1);
(*e1n2) = find_local_node_index((*e1), n2);
(*e1n3) = 3 - (*e1n1) - (*e1n2);
(*n3) = theMesh->e2n_getNode((*e1), (*e1n3));
(*e2) = theMesh->e2e_getNbr((*e1), get_edge_index((*e1n1), (*e1n2)));
// Set some default values in case e2 is not there
(*e2n1) = (*e2n2) = (*e2n3) = (*n4) = -1;
if ((*e2) != -1) { // e2 exists
(*e2n1) = find_local_node_index((*e2), n1);
(*e2n2) = find_local_node_index((*e2), n2);
(*e2n3) = 3 - (*e2n1) - (*e2n2);
//if ((*e2) > -1) { // if e2 is a ghost, there is no e2n data
(*n4) = theMesh->e2n_getNode((*e2), (*e2n3));
//}
}
if(*n3 == *n4) {
CkPrintf("[%d]Warning: Identical elements %d:(%d,%d,%d) & %d:(%d,%d,%d)\n",theMod->idx,*e1,n1,n2,*n3,*e2,n1,n2,*n4);
return -1;
}
return 1;
}
示例3: TestDriver
TestDriver(CkArgMsg *m) {
delete m;
CProxy_Destination destinationChare =
CProxy_Destination::ckNew(CkNumPes() - 1);
CkPrintf("Size of Converse envelope: %d bytes\n", CmiReservedHeaderSize);
CkPrintf("Size of Charm++ envelope: %d bytes\n", sizeof(envelope));
CkPrintf("Default alignment: %d bytes\n", ALIGN_BYTES);
int msgSizes[] = {varSize1, varSize2};
std::vector<TestMessage *> allMsgs;
int prio = 1234;
for (int i = 0; i < nCheck; i++) {
TestMessage *msg = new (msgSizes, prio) TestMessage();
allMsgs.push_back(msg);
}
alignmentTest(allMsgs, "source");
for (int i = 0; i < allMsgs.size(); i++) {
destinationChare.receiveMessage(allMsgs[i]);
}
}
示例4: BFSGraph
BFSGraph(CmiUInt8 nVertex, bool directed = true) :
directed(directed),
GraphLib::Graph<
BFSMultiVertex,
BFSEdge,
CProxy_BFSMultiVertex,
GraphLib::TransportType::Charm >(CmiNumPes()) {
int dims[2] = {CkNumNodes(), CkNumPes() / CkNumNodes()};
CkPrintf("Aggregation topology: %d %d\n", dims[0], dims[1]);
aggregator =
CProxy_ArrayMeshStreamer<dtype, long long, BFSMultiVertex, SimpleMeshRouter>
::ckNew(numMsgsBuffered, 2, dims, g, 1);
}
示例5: double
void Main::ready() {
int i;
readyCount += 1;
int BLOCK_SIZE = matrix_size*matrix_size/CkNumPes();
double (*split_y)[BLOCK_SIZE] = (double (*)[BLOCK_SIZE]) split_bycol;
if (readyCount == CkNumPes()) {
// calculate
CkPrintf("Start calculation\n");
for (i = 0; i < CkNumPes(); i++) {
object_array[i].multiply(matrix_size * matrix_size/CkNumPes(), split_y[i],i);
}
}
}
示例6: allDone
void allDone() {
double elapsedTime = CkWallTimer() - startTime;
CkPrintf("Elapsed time for all-to-all of %8d bytes sent in %6d %10s"
" of %2d bytes each (%3s using TRAM): %.6f seconds\n",
iters * DATA_ITEM_SIZE, iters,
iters == 1 ? "iteration" : "iterations", DATA_ITEM_SIZE,
testType == directSends ? "not" : "", elapsedTime);
if (iters == dataSizeMax / DATA_ITEM_SIZE) {
++testType;
if (testType == finishedTests) {
CkExit();
}
else {
CkPrintf("\nTEST 2: Using point to point sends\n");
iters = dataSizeMin / DATA_ITEM_SIZE;
prepare();
}
}
else {
iters *= 2;
prepare();
}
}
示例7: Main
Main(CkArgMsg *m) {
CkPrintf("running SDAG migration test\n");
CProxy_Test testProxy = CProxy_Test::ckNew(NUM_ELEMS);
testProxy.wrapper(100, 200);
for (int i = 0; i < NUM_ELEMS; i++) {
char str[100];
sprintf(str, "test %d", i);
Msg* m = new (strlen(str) + 1) Msg(i, str);
testProxy[i].method2(i * 2, i * 2 + 1);
testProxy[i].method3(m);
testProxy[i].methodA();
}
CkStartQD(CkCallback(CkIndex_Main::finished(), thisProxy));
}
示例8: SayHi
void SayHi(int hiNo)
{
if(hiNo <2 )
startTimer = CkWallTimer();
else if(hiNo >= numIterations)
{
double time = CkWallTimer() - startTimer;
CkPrintf(" migration cost total : %f sec single migration cost: %f us\n", time, time/(hiNo-1)*1000000);
CkExit();
}
//CkPrintf("executing %d %d\n", CkMyPe(), hiNo);
thisProxy[thisIndex].SayHi(hiNo+1);
migrateMe(1-CkMyPe());
}
示例9: CkAssert
int FEM_Adapt::get_edge_index(int local_node1, int local_node2)
{
int sum = local_node1 + local_node2;
CkAssert(local_node1 != local_node2);
if (sum == 1) return 0;
else if (sum == 3) return 1;
else if (sum == 2) return 2;
else {
CkPrintf("ERROR: local node pair is strange: [%d,%d]\n", local_node1,
local_node2);
CkAbort("ERROR: local node pair is strange\n");
return -1;
}
}
示例10: Pingping
Pingping(std::size_t index, uChareSet<Pingping, CProxy_Pingping, CBase_Pingping> *uchareset) :
uChare<Pingping, CProxy_Pingping, CBase_Pingping>(index, uchareset) {
CkPrintf("[uchare=%d, chare=%d,pe=%d]: created \n",
getId(), getuChareSet()->getId(), getuChareSet()->getPe());
pingDone = pongDone = false;
pingCounters.resize(N_uChares);
pingCounters.assign(N_uChares, -1);
pongCounters.resize(N_uChares);
pongCounters.assign(N_uChares, 999);
contribute(CkCallback(CkReductionTarget(Main, start), mainProxy));
}
示例11: CkPrintf
main::main(CkArgMsg* m)
{
//Process command-line arguments
//Start the computation
mainProxy = thishandle;
if(m->argc<2)
{
CkPrintf("Needs number of array elements and allreduce data size\n");
CkExit();
}
units=atoi(m->argv[1]);
allredSize=atoi(m->argv[2]);
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();
}
示例12: report
// One worker reports back to here when it completes the workload
void report(double result) {
double totalTime, flops, diff;
double ref_norm = (COEFX+COEFY)*(maxiterations+1);
result /= (n-2.0*RADIUS)*(n-2.0*RADIUS);
totalTime = endTime - startTime;
flops = (double) (2*(4*RADIUS+1)+1) * (n-2*RADIUS)*(double)(n-2*RADIUS)*maxiterations;
diff = ABS(result-ref_norm);
if (diff < EPSILON) {
CkPrintf("Solution validates\n");
#if VERBOSE
printf("Reference L1 norm = "FSTR", L1 norm = "FSTR"\n",
ref_norm, result);
#endif
CkPrintf("Rate (MFlops): %lf Avg time (s) %lf\n", flops/totalTime/1.e6,
totalTime/maxiterations);
}
else {
CkPrintf("Solution does not validate\n");
CkPrintf("Reference norm: %lf, norm: %lf, |diff|: %e\n", ref_norm, result, diff);
}
CkExit();
}
示例13: CkPrintf
/** Allocate both the FEM_ELEM_ELEM_ADJACENCY and FEM_ELEM_ELEM_ADJ_TYPES attributes
The values in these two attributes will be generated by
*/
void FEM_Elem::allocateElemAdjacency(){
if(elemAdjacency){
CkPrintf("FEM> WARNING: Deleting previously allocated(?) elemAdjacency array. allocateElemAdjacency() should probably only be called once.\n");
delete elemAdjacency;
}
if(elemAdjacencyTypes){
CkPrintf("FEM> WARNING: Deleting previously allocated(?) elemAdjacencyTypes array. allocateElemAdjacency() should probably only be called once.\n");
delete elemAdjacencyTypes;
}
elemAdjacency = new FEM_IndexAttribute(this,FEM_ELEM_ELEM_ADJACENCY);
elemAdjacencyTypes = new FEM_IndexAttribute(this,FEM_ELEM_ELEM_ADJ_TYPES);
elemAdjacency->setLength(size());
elemAdjacency->setWidth(conn->getWidth());
elemAdjacencyTypes->setLength(size());
elemAdjacencyTypes->setWidth(conn->getWidth());
add(elemAdjacency);
add(elemAdjacencyTypes);
}
示例14: Main
Main(CkArgMsg* msg) {
int n = atoi(msg->argv[1]);
mainProxy = thisProxy;
CkPrintf("n = %d\n",n);
BProxy = CProxy_B::ckNew(n);
AProxy = CProxy_A::ckNew(2);
AProxy.F();
CkCallback cb = CkCallback(CkReductionTarget(Main, done), thisProxy);
CkStartQD(cb);
}
示例15: mcastPing
void mcastPing(pingMsg *msg)
{
// Say hello world
CkPrintf("Array %d, Element %d received ping number %d\n", aNum, thisIndex, msg->hiNo);
// Save the section cookie, the first time you get it
if (! isCookieSet)
{
sectionCookie = msg->_cookie;
isCookieSet = true;
}
// Contribute to the section reduction
mcastMgr->contribute(sizeof(int), &(msg->hiNo), CkReduction::sum_int, sectionCookie);
delete msg;
}