Inheritance diagram for OptPmeMgr:

Public Member Functions | |
| OptPmeMgr () | |
| ~OptPmeMgr () | |
| void | initialize (CkQdMsg *) |
| void | initialize_pencils (CkQdMsg *) |
| void | activate_pencils (CkQdMsg *) |
| void | recvArrays (CProxy_OptPmeXPencil, CProxy_OptPmeYPencil, CProxy_OptPmeZPencil) |
| void | recvUngrid (OptPmeGridMsg *) |
| void | ungridCalc (OptPmeDummyMsg *) |
| void | recvEvir (CkReductionMsg *msg) |
| void | setCompute (OptPmeCompute *c) |
Friends | |
| class | OptPmeCompute |
|
|
Definition at line 209 of file OptPme.C. References fftw_plan_lock. 00209 : pmeProxy(thisgroup),
00210 pmeProxyDir(thisgroup), pmeCompute(0) {
00211
00212 CkpvAccess(BOCclass_group).computePmeMgr = thisgroup;
00213
00214 myKSpace = 0;
00215 ungrid_count = 0;
00216 usePencils = 0;
00217
00218 #ifdef NAMD_FFTW
00219 if ( CmiMyRank() == 0 ) {
00220 fftw_plan_lock = CmiCreateLock();
00221 }
00222 #endif
00223 }
|
|
|
Definition at line 424 of file OptPme.C. 00424 {
00425 delete myKSpace;
00426 }
|
|
|
Definition at line 418 of file OptPme.C. 00418 {
00419 if ( ! usePencils ) return;
00420 if ( CkMyPe() == 0 ) zPencil.dummyRecvGrid(CkMyPe(),1);
00421 }
|
|
|
Definition at line 230 of file OptPme.C. References SimParameters::berendsenPressureOn, OptPmePencilInitMsgData::cb_energy, OptPmePencilInitMsgData::constant_pressure, OptPmePencilInitMsgData::grid, iINFO(), initializePmeGrid(), iout, SimParameters::langevinPistonOn, many_to_many_start, NAMD_die(), PatchMap::numPatches(), ReductionMgr::Object(), PatchMap::Object(), Node::Object(), pencilPMEProcessors, SimParameters::PMEPencils, OptPmePencilInitMsgData::pmeProxy, REDUCTIONS_BASIC, Node::simParameters, simParams, SimParameters::useManyToMany, ReductionMgr::willSubmit(), OptPmePencilInitMsgData::xBlocks, PmeGrid::xBlocks, OptPmePencilInitMsgData::xPencil, OptPmePencilInitMsgData::yBlocks, PmeGrid::yBlocks, OptPmePencilInitMsgData::yPencil, OptPmePencilInitMsgData::zBlocks, PmeGrid::zBlocks, and OptPmePencilInitMsgData::zPencil. 00230 {
00231 delete msg;
00232
00233 _iter = 0;
00234
00235 #if CHARM_VERSION > 60000
00236 handle = CmiDirect_manytomany_allocate_handle ();
00237 #endif
00238
00239 SimParameters *simParams = Node::Object()->simParameters;
00240 PatchMap *patchMap = PatchMap::Object();
00241
00242 if (simParams->PMEPencils > 0)
00243 usePencils = 1;
00244 else return;
00245
00246 initializePmeGrid (simParams, myGrid);
00247
00248 if (simParams->langevinPistonOn || simParams->berendsenPressureOn)
00249 constant_pressure = true;
00250 else
00251 constant_pressure = false;
00252
00253 bool useManyToMany = simParams->useManyToMany;
00254 //Many-to-many requires that patches and pmepencils are all on different processors
00255 int npes = patchMap->numPatches() +
00256 myGrid.xBlocks * myGrid.yBlocks +
00257 myGrid.zBlocks * myGrid.xBlocks +
00258 myGrid.yBlocks * myGrid.zBlocks;
00259
00260 if (npes >= CkNumPes()) {
00261 if (CkMyPe() == 0)
00262 printf ("Warning : Not enough processors for the many-to-many optimization \n");
00263 useManyToMany = false;
00264 }
00265
00266 #if CHARM_VERSION > 60000
00267 if (useManyToMany) {
00268 if (CkMyPe() == 0)
00269 printf ("Enabling the Many-to-many optimization\n");
00270 //defaults to max integer
00271 many_to_many_start = MANY_TO_MANY_START;
00272 }
00273 #endif
00274
00275 if ( CkMyPe() == 0) {
00276 iout << iINFO << "PME using " << myGrid.xBlocks << " x " <<
00277 myGrid.yBlocks << " x " << myGrid.zBlocks <<
00278 " pencil grid for FFT and reciprocal sum.\n" << endi;
00279
00280 pencilPMEProcessors = new char [CkNumPes()];
00281 memset (pencilPMEProcessors, 0, sizeof(char) * CkNumPes());
00282
00283 CProxy_OptPmePencilMapZ mapz;
00284 CProxy_OptPmePencilMapY mapy;
00285 CProxy_OptPmePencilMapX mapx;
00286
00287 mapz = CProxy_OptPmePencilMapZ::ckNew(myGrid.xBlocks, myGrid.yBlocks, myGrid.zBlocks);
00288 mapy = CProxy_OptPmePencilMapY::ckNew(myGrid.xBlocks, myGrid.yBlocks, myGrid.zBlocks);
00289 mapx = CProxy_OptPmePencilMapX::ckNew(myGrid.xBlocks, myGrid.yBlocks, myGrid.zBlocks);
00290
00291 CkArrayOptions optsz;
00292 optsz.setMap (mapz);
00293 CkArrayOptions optsy;
00294 optsy.setMap (mapy);
00295 CkArrayOptions optsx;
00296 optsx.setMap (mapx);
00297
00298 zPencil = CProxy_OptPmeZPencil::ckNew(optsz);
00299 yPencil = CProxy_OptPmeYPencil::ckNew(optsy);
00300 xPencil = CProxy_OptPmeXPencil::ckNew(optsx);
00301
00302 int x,y,z;
00303 for (x = 0; x < myGrid.xBlocks; ++x)
00304 for (y = 0; y < myGrid.yBlocks; ++y ) {
00305 zPencil(x,y,0).insert();
00306 }
00307 zPencil.doneInserting();
00308
00309 for (z = 0; z < myGrid.zBlocks; ++z )
00310 for (x = 0; x < myGrid.xBlocks; ++x ) {
00311 yPencil(x,0,z).insert();
00312 }
00313 yPencil.doneInserting();
00314
00315 for (y = 0; y < myGrid.yBlocks; ++y )
00316 for (z = 0; z < myGrid.zBlocks; ++z ) {
00317 xPencil(0,y,z).insert();
00318 }
00319 xPencil.doneInserting();
00320
00321 pmeProxy.recvArrays(xPencil,yPencil,zPencil);
00322 OptPmePencilInitMsgData msgdata;
00323 msgdata.grid = myGrid;
00324 msgdata.xBlocks = myGrid.xBlocks;
00325 msgdata.yBlocks = myGrid.yBlocks;
00326 msgdata.zBlocks = myGrid.zBlocks;
00327 msgdata.xPencil = xPencil;
00328 msgdata.yPencil = yPencil;
00329 msgdata.zPencil = zPencil;
00330 msgdata.constant_pressure = constant_pressure;
00331
00332 CkCallback cb (CkIndex_OptPmeMgr::recvEvir(NULL), thisProxy[0]);
00333 msgdata.cb_energy = cb;
00334
00335 msgdata.pmeProxy = pmeProxyDir;
00336 xPencil.init(new OptPmePencilInitMsg(msgdata));
00337 yPencil.init(new OptPmePencilInitMsg(msgdata));
00338 zPencil.init(new OptPmePencilInitMsg(msgdata));
00339
00340 reduction = ReductionMgr::Object()->willSubmit(REDUCTIONS_BASIC);
00341
00342 #ifndef NAMD_FFTW
00343 NAMD_die("Sorry, FFTW must be compiled in to use PME.");
00344 #endif
00345 }
00346
00347 }
|
|
|
Definition at line 349 of file OptPme.C. References Lattice::a(), Lattice::a_r(), Lattice::b(), Lattice::b_r(), BigReal, PmeGrid::block1, PmeGrid::block2, SimParameters::cutoff, j, PmeGrid::K1, PmeGrid::K2, SimParameters::lattice, PatchMap::max_a(), PatchMap::max_b(), PatchMap::min_a(), PatchMap::min_b(), PatchMap::node(), PatchMap::numPatches(), PatchMap::numPatchesOnNode(), PatchMap::Object(), Node::Object(), PmeGrid::order, SimParameters::patchDimension, Node::simParameters, simParams, Vector::unit(), PmeGrid::xBlocks, and PmeGrid::yBlocks. 00349 {
00350 delete msg;
00351
00352 SimParameters *simParams = Node::Object()->simParameters;
00353
00354 PatchMap *patchMap = PatchMap::Object();
00355 Lattice lattice = simParams->lattice;
00356 BigReal sysdima = lattice.a_r().unit() * lattice.a();
00357 BigReal sysdimb = lattice.b_r().unit() * lattice.b();
00358 BigReal cutoff = simParams->cutoff;
00359 BigReal patchdim = simParams->patchDimension;
00360 int numPatches = patchMap->numPatches();
00361
00362 char *pencilActive = new char[myGrid.xBlocks*myGrid.yBlocks];
00363 for ( int i=0; i<myGrid.xBlocks; ++i ) {
00364 for ( int j=0; j<myGrid.yBlocks; ++j ) {
00365 pencilActive[i*myGrid.yBlocks+j] = 0;
00366 }
00367 }
00368
00369 //Right now we only support one patch per processor
00370 assert (patchMap->numPatchesOnNode(CkMyPe()) <= 1);
00371 for ( int pid=0; pid < numPatches; ++pid ) {
00372 int pnode = patchMap->node(pid);
00373 if ( pnode != CkMyPe() ) continue;
00374
00375 BigReal minx = patchMap->min_a(pid);
00376 BigReal maxx = patchMap->max_a(pid);
00377 BigReal margina = 0.5 * ( patchdim - cutoff ) / sysdima;
00378 // min1 (max1) is smallest (largest) grid line for this patch
00379 int min1 = ((int) floor(myGrid.K1 * (minx - margina))) - myGrid.order + 1;
00380 int max1 = ((int) floor(myGrid.K1 * (maxx + margina)));
00381
00382 BigReal miny = patchMap->min_b(pid);
00383 BigReal maxy = patchMap->max_b(pid);
00384 BigReal marginb = 0.5 * ( patchdim - cutoff ) / sysdimb;
00385 // min2 (max2) is smallest (largest) grid line for this patch
00386 int min2 = ((int) floor(myGrid.K2 * (miny - marginb))) - myGrid.order + 1;
00387 int max2 = ((int) floor(myGrid.K2 * (maxy + marginb)));
00388
00389 for ( int i=min1; i<=max1; ++i ) {
00390 int ix = i;
00391 while ( ix >= myGrid.K1 ) ix -= myGrid.K1;
00392 while ( ix < 0 ) ix += myGrid.K1;
00393 for ( int j=min2; j<=max2; ++j ) {
00394 int jy = j;
00395 while ( jy >= myGrid.K2 ) jy -= myGrid.K2;
00396 while ( jy < 0 ) jy += myGrid.K2;
00397 pencilActive[(ix / myGrid.block1)*myGrid.yBlocks + (jy / myGrid.block2)] = 1;
00398 }
00399 }
00400 }
00401
00402 numPencilsActive = 0;
00403 for ( int i=0; i<myGrid.xBlocks; ++i ) {
00404 for ( int j=0; j<myGrid.yBlocks; ++j ) {
00405 if ( pencilActive[i*myGrid.yBlocks+j] ) {
00406 ++numPencilsActive;
00407
00408 zPencil(i,j,0).dummyRecvGrid(CkMyPe(),0);
00409 }
00410 }
00411 }
00412
00413 ungrid_count = numPencilsActive;
00414 delete [] pencilActive;
00415 }
|
|
||||||||||||||||
|
Definition at line 226 of file OptPme.C. 00226 {
00227 xPencil = x; yPencil = y; zPencil = z;
00228 }
|
|
|
Definition at line 449 of file OptPme.C. References SimParameters::fullElectFrequency, SubmitReduction::item(), Node::Object(), REDUCTION_ELECT_ENERGY_SLOW, Node::simParameters, simParams, and SubmitReduction::submit(). 00449 {
00450
00451 assert (CkMyPe() == 0);
00452
00453 double *data = (double *) msg->getData();
00454 assert (msg->getSize() == 7 * sizeof(double));
00455
00456 //printf ("[%d]: Received Evir\n", CkMyPe());
00457
00458 double scale = 1.;
00459 reduction->item(REDUCTION_ELECT_ENERGY_SLOW) += data[0] * scale;
00460 reduction->item(REDUCTION_VIRIAL_SLOW_XX) += data[1] * scale;
00461 reduction->item(REDUCTION_VIRIAL_SLOW_XY) += data[2] * scale;
00462 reduction->item(REDUCTION_VIRIAL_SLOW_XZ) += data[3] * scale;
00463 reduction->item(REDUCTION_VIRIAL_SLOW_YX) += data[2] * scale;
00464 reduction->item(REDUCTION_VIRIAL_SLOW_YY) += data[4] * scale;
00465 reduction->item(REDUCTION_VIRIAL_SLOW_YZ) += data[5] * scale;
00466 reduction->item(REDUCTION_VIRIAL_SLOW_ZX) += data[3] * scale;
00467 reduction->item(REDUCTION_VIRIAL_SLOW_ZY) += data[5] * scale;
00468 reduction->item(REDUCTION_VIRIAL_SLOW_ZZ) += data[6] * scale;
00469
00470 delete msg;
00471
00472 SimParameters *simParams = Node::Object()->simParameters;
00473 int fef = simParams->fullElectFrequency;
00474 for (int i = 0; i < fef; i++)
00475 reduction->submit();
00476 }
|
|
|
Definition at line 428 of file OptPme.C. References OptPmeCompute::copyPencils(), NAMD_bug(), and ungridCalc(). 00428 {
00429 if ( ungrid_count == 0 ) {
00430 NAMD_bug("Message order failure in OptPmeMgr::recvUngrid\n");
00431 }
00432
00433 pmeCompute->copyPencils(msg);
00434 delete msg;
00435 --ungrid_count;
00436
00437 if ( ungrid_count == 0 ) {
00438 //CkPrintf("recvUngrid on Pe(%d)\n",CkMyPe());
00439 ungridCalc(NULL);
00440 }
00441 }
|
|
|
Definition at line 67 of file OptPme.C. References OptPmeCompute::setMgr(). 00067 { pmeCompute = c; c->setMgr(this); }
|
|
|
Definition at line 443 of file OptPme.C. References OptPmeCompute::ungridForces(). Referenced by recvUngrid(). 00443 {
00444 pmeCompute->ungridForces();
00445 ungrid_count = numPencilsActive;
00446 }
|
|
|
|
1.3.9.1