/*entry*/ void run() { startt = CkWallTimer(); uchare_set_proxy.run(CkCallbackResumeThread()); while(1){ //CkPrintf("Main: run resumed...\n"); uchare_set_proxy.flush(CkCallbackResumeThread()); sleep(0.1); } }
void start(CmiUInt8 root) { CkCallback startCb(CkIndex_BFSMultiVertex::foo(), g[root / (N / CmiNumPes())]); CkCallback endCb(CkIndex_TestDriver::startVerificationPhase(), driverProxy); aggregator.init(g.ckGetArrayID(), startCb, endCb, -1, true); CkStartQD(CkCallbackResumeThread()); g[root / (N / CmiNumPes())].make_root(root); }
void doPageRank() { PageRankGraph::Proxy & g = graph->getProxy(); double update_walltime = CkWallTimer() - starttime; CkPrintf("Initialization completed:\n"); CkPrintf("CPU time used = %.6f seconds\n", update_walltime); starttime = CkWallTimer(); for (int i = 0; i < iters; i++) { CkPrintf("PageRank step %d:\n", i); // do pagerank step initilization g.doPageRankStep_init(); // wait for current step to be done CkStartQD(CkCallbackResumeThread()); // do pagerank step g.doPageRankStep_update(); // wait for current step to be done CkStartQD(CkCallbackResumeThread()); } startVerificationPhase(); }
/// /// Feedback main method /// void Main::StellarFeedback(double dTime, double dDelta) { if(verbosity) CkPrintf("Stellar Feedback ... \n"); double startTime = CkWallTimer(); CkReductionMsg *msgFeedback; treeProxy.Feedback(*(param.feedback), dTime, dDelta, CkCallbackResumeThread((void*&)msgFeedback)); double *dFeedback = (double *)msgFeedback->getData(); if(verbosity) { CkPrintf("Feedback totals: mass, energy, metalicity\n"); for(int i = 0; i < NFEEDBACKS; i++){ CkPrintf("feedback %d: %g %g %g\n", i, dFeedback[i*3], dFeedback[i*3 + 1], dFeedback[i*3] != 0.0 ? dFeedback[i*3 + 2]/dFeedback[i*3] : 0.0); } } delete msgFeedback; CkReductionMsg *msgChk; treeProxy.massMetalsEnergyCheck(1, CkCallbackResumeThread((void*&)msgChk)); if(verbosity) CkPrintf("Distribute Stellar Feedback ... "); // Need to build tree since we just did addDelParticle. // treeProxy.buildTree(bucketSize, CkCallbackResumeThread()); DistStellarFeedbackSmoothParams pDSFB(TYPE_GAS, 0, param.csm, dTime, param.dConstGamma, param.feedback); double dfBall2OverSoft2 = 4.0*param.dhMinOverSoft*param.dhMinOverSoft; treeProxy.startSmooth(&pDSFB, 0, param.feedback->nSmoothFeedback, dfBall2OverSoft2, CkCallbackResumeThread()); treeProxy.finishNodeCache(CkCallbackResumeThread()); CkPrintf("Stellar Feedback Calculated, Wallclock %f secs\n", CkWallTimer() - startTime); CkReductionMsg *msgChk2; treeProxy.massMetalsEnergyCheck(0, CkCallbackResumeThread((void*&)msgChk2)); double *dTotals = (double *)msgChk->getData(); double *dTotals2 = (double *)msgChk2->getData(); int i; for(i = 0; i < 5; i++) { std::string labels[5] = {"Mass", "Metals", "Oxygen", "Iron", "Energy"}; if(verbosity > 1) CkPrintf("Total %s: %g\n", labels[i].c_str(), dTotals[i]); if(fabs(dTotals[i] - dTotals2[i]) > 1e-12*(dTotals[i])) { CkError("ERROR: %s not conserved: %.15e != %.15e!\n", labels[i].c_str(), dTotals[i], dTotals2[i]); } } delete msgChk; delete msgChk2; }
void threadedTest(void) { #if 1 //Reflect a value off each processor: for (int pe=0;pe<CkNumPes();pe+=2) { CkCallback cb(CkCallback::resumeThread); int expectedVal=237+13*pe; gp[pe].reflect(cb,expectedVal); callbackMsg *m=(callbackMsg *)(cb.thread_delay()); int gotVal=msg2val(m); if (gotVal!=expectedVal) CkAbort("Threaded callback returned wrong value"); } #else //Reflect a value off each processor: for (int pe=0;pe<CkNumPes();pe+=2) { callbackMsg *m; int expectedVal=237+13*pe; gp[pe].reflect(CkCallbackResumeThread((void*&)m),expectedVal); int gotVal=msg2val(m); if (gotVal!=expectedVal) CkAbort("Threaded callback returned wrong value"); } #endif megatest_finish(); }
void do_sssp(long root) { vertex_proxy.init(); CkStartQD(CkCallbackResumeThread()); vertex_proxy[root].make_root(); CkStartQD(done_callback); }