version 1.225 | version 1.226 |
---|
| |
| |
void ComputePmeMgr::gridCalc2R(void) { | void ComputePmeMgr::gridCalc2R(void) { |
| |
| int useCkLoop = 0; |
| #if CMK_SMP && USE_CKLOOP |
| if ( Node::Object()->simParameters->useCkLoop >= CKLOOP_CTRL_PME_KSPACE |
| && CkNumPes() >= 2 * numTransNodes ) { |
| useCkLoop = 1; |
| } |
| #endif |
| |
int zdim = myGrid.dim3; | int zdim = myGrid.dim3; |
// int y_start = localInfo[myTransPe].y_start_after_transpose; | // int y_start = localInfo[myTransPe].y_start_after_transpose; |
int ny = localInfo[myTransPe].ny_after_transpose; | int ny = localInfo[myTransPe].ny_after_transpose; |
| |
// reciprocal space portion of PME | // reciprocal space portion of PME |
BigReal ewaldcof = ComputeNonbondedUtil::ewaldcof; | BigReal ewaldcof = ComputeNonbondedUtil::ewaldcof; |
recip_evir2[g][0] = myKSpace->compute_energy(kgrid+qgrid_size*g, | recip_evir2[g][0] = myKSpace->compute_energy(kgrid+qgrid_size*g, |
lattice, ewaldcof, &(recip_evir2[g][1])); | lattice, ewaldcof, &(recip_evir2[g][1]), useCkLoop); |
// CkPrintf("Ewald reciprocal energy = %f\n", recip_evir2[g][0]); | // CkPrintf("Ewald reciprocal energy = %f\n", recip_evir2[g][0]); |
| |
// start backward FFT (x dimension) | // start backward FFT (x dimension) |
| |
#ifdef NAMD_FFTW_3 | #ifdef NAMD_FFTW_3 |
#if CMK_SMP && USE_CKLOOP | #if CMK_SMP && USE_CKLOOP |
int useCkLoop = Node::Object()->simParameters->useCkLoop; | int useCkLoop = Node::Object()->simParameters->useCkLoop; |
if(useCkLoop>=CKLOOP_CTRL_PME_FORWARDFFT) { | if(useCkLoop>=CKLOOP_CTRL_PME_FORWARDFFT |
| && CkNumPes() >= 2 * initdata.xBlocks * initdata.yBlocks) { |
//for(int i=0; i<numPlans; i++) fftwf_execute(forward_plans[i]); | //for(int i=0; i<numPlans; i++) fftwf_execute(forward_plans[i]); |
//transform the above loop | //transform the above loop |
CkLoop_Parallelize(PmeXZPencilFFT, 1, (void *)forward_plans, CkMyNodeSize(), 0, numPlans-1); //sync | CkLoop_Parallelize(PmeXZPencilFFT, 1, (void *)forward_plans, CkMyNodeSize(), 0, numPlans-1); //sync |
| |
#endif | #endif |
#if CMK_SMP && USE_CKLOOP | #if CMK_SMP && USE_CKLOOP |
Bool useCkLoop = Node::Object()->simParameters->useCkLoop; | Bool useCkLoop = Node::Object()->simParameters->useCkLoop; |
if(useCkLoop>=CKLOOP_CTRL_PME_SENDTRANS) { | if(useCkLoop>=CKLOOP_CTRL_PME_SENDTRANS |
| && CkNumPes() >= 2 * initdata.xBlocks * initdata.yBlocks) { |
/** | /** |
* Basically, this function call could be converted into | * Basically, this function call could be converted into |
* a for-loop of: | * a for-loop of: |
| |
#ifdef NAMD_FFTW_3 | #ifdef NAMD_FFTW_3 |
#if CMK_SMP && USE_CKLOOP | #if CMK_SMP && USE_CKLOOP |
int useCkLoop = Node::Object()->simParameters->useCkLoop; | int useCkLoop = Node::Object()->simParameters->useCkLoop; |
if(useCkLoop>=CKLOOP_CTRL_PME_FORWARDFFT) { | if(useCkLoop>=CKLOOP_CTRL_PME_FORWARDFFT |
| && CkNumPes() >= 2 * initdata.xBlocks * initdata.zBlocks) { |
CkLoop_Parallelize(PmeYPencilForwardFFT, 1, (void *)this, CkMyNodeSize(), 0, nx-1); //sync | CkLoop_Parallelize(PmeYPencilForwardFFT, 1, (void *)this, CkMyNodeSize(), 0, nx-1); //sync |
return; | return; |
} | } |
| |
#endif | #endif |
#if CMK_SMP && USE_CKLOOP | #if CMK_SMP && USE_CKLOOP |
Bool useCkLoop = Node::Object()->simParameters->useCkLoop; | Bool useCkLoop = Node::Object()->simParameters->useCkLoop; |
if(useCkLoop>=CKLOOP_CTRL_PME_SENDTRANS) { | if(useCkLoop>=CKLOOP_CTRL_PME_SENDTRANS |
| && CkNumPes() >= 2 * initdata.xBlocks * initdata.zBlocks) { |
/** | /** |
* Basically, this function call could be converted into | * Basically, this function call could be converted into |
* a for-loop of: | * a for-loop of: |
| |
#ifdef NAMD_FFTW_3 | #ifdef NAMD_FFTW_3 |
#if CMK_SMP && USE_CKLOOP | #if CMK_SMP && USE_CKLOOP |
int useCkLoop = Node::Object()->simParameters->useCkLoop; | int useCkLoop = Node::Object()->simParameters->useCkLoop; |
if(useCkLoop>=CKLOOP_CTRL_PME_FORWARDFFT) { | if(useCkLoop>=CKLOOP_CTRL_PME_FORWARDFFT |
| && CkNumPes() >= 2 * initdata.yBlocks * initdata.zBlocks) { |
//for(int i=0; i<numPlans; i++) fftwf_execute(forward_plans[i]); | //for(int i=0; i<numPlans; i++) fftwf_execute(forward_plans[i]); |
//transform the above loop | //transform the above loop |
CkLoop_Parallelize(PmeXZPencilFFT, 1, (void *)forward_plans, CkMyNodeSize(), 0, numPlans-1); //sync | CkLoop_Parallelize(PmeXZPencilFFT, 1, (void *)forward_plans, CkMyNodeSize(), 0, numPlans-1); //sync |
| |
| |
BigReal ewaldcof = ComputeNonbondedUtil::ewaldcof; | BigReal ewaldcof = ComputeNonbondedUtil::ewaldcof; |
| |
| int useCkLoop = 0; |
| #if CMK_SMP && USE_CKLOOP |
| if ( Node::Object()->simParameters->useCkLoop >= CKLOOP_CTRL_PME_KSPACE |
| && CkNumPes() >= 2 * initdata.yBlocks * initdata.zBlocks ) { |
| useCkLoop = 1; |
| } |
| #endif |
| |
int numGrids = 1; | int numGrids = 1; |
for ( int g=0; g<numGrids; ++g ) { | for ( int g=0; g<numGrids; ++g ) { |
evir[0] = myKSpace->compute_energy(data+0*g, | evir[0] = myKSpace->compute_energy(data+0*g, |
lattice, ewaldcof, &(evir[1])); | lattice, ewaldcof, &(evir[1]), useCkLoop); |
} | } |
| |
#if USE_NODE_PAR_RECEIVE | #if USE_NODE_PAR_RECEIVE |
| |
#ifdef NAMD_FFTW_3 | #ifdef NAMD_FFTW_3 |
#if CMK_SMP && USE_CKLOOP | #if CMK_SMP && USE_CKLOOP |
int useCkLoop = Node::Object()->simParameters->useCkLoop; | int useCkLoop = Node::Object()->simParameters->useCkLoop; |
if(useCkLoop>=CKLOOP_CTRL_PME_BACKWARDFFT) { | if(useCkLoop>=CKLOOP_CTRL_PME_BACKWARDFFT |
| && CkNumPes() >= 2 * initdata.yBlocks * initdata.zBlocks) { |
//for(int i=0; i<numPlans; i++) fftwf_execute(backward_plans[i]); | //for(int i=0; i<numPlans; i++) fftwf_execute(backward_plans[i]); |
//transform the above loop | //transform the above loop |
CkLoop_Parallelize(PmeXZPencilFFT, 1, (void *)backward_plans, CkMyNodeSize(), 0, numPlans-1); //sync | CkLoop_Parallelize(PmeXZPencilFFT, 1, (void *)backward_plans, CkMyNodeSize(), 0, numPlans-1); //sync |
| |
#endif | #endif |
#if CMK_SMP && USE_CKLOOP | #if CMK_SMP && USE_CKLOOP |
Bool useCkLoop = Node::Object()->simParameters->useCkLoop; | Bool useCkLoop = Node::Object()->simParameters->useCkLoop; |
if(useCkLoop>=CKLOOP_CTRL_PME_SENDUNTRANS) { | if(useCkLoop>=CKLOOP_CTRL_PME_SENDUNTRANS |
| && CkNumPes() >= 2 * initdata.yBlocks * initdata.zBlocks) { |
int xBlocks = initdata.xBlocks; | int xBlocks = initdata.xBlocks; |
int evirIdx = 0; | int evirIdx = 0; |
for ( int isend=0; isend<xBlocks; ++isend ) { | for ( int isend=0; isend<xBlocks; ++isend ) { |
| |
#ifdef NAMD_FFTW_3 | #ifdef NAMD_FFTW_3 |
#if CMK_SMP && USE_CKLOOP | #if CMK_SMP && USE_CKLOOP |
int useCkLoop = Node::Object()->simParameters->useCkLoop; | int useCkLoop = Node::Object()->simParameters->useCkLoop; |
if(useCkLoop>=CKLOOP_CTRL_PME_BACKWARDFFT) { | if(useCkLoop>=CKLOOP_CTRL_PME_BACKWARDFFT |
| && CkNumPes() >= 2 * initdata.xBlocks * initdata.zBlocks) { |
CkLoop_Parallelize(PmeYPencilBackwardFFT, 1, (void *)this, CkMyNodeSize(), 0, nx-1); //sync | CkLoop_Parallelize(PmeYPencilBackwardFFT, 1, (void *)this, CkMyNodeSize(), 0, nx-1); //sync |
return; | return; |
} | } |
| |
#endif | #endif |
#if CMK_SMP && USE_CKLOOP | #if CMK_SMP && USE_CKLOOP |
Bool useCkLoop = Node::Object()->simParameters->useCkLoop; | Bool useCkLoop = Node::Object()->simParameters->useCkLoop; |
if(useCkLoop>=CKLOOP_CTRL_PME_SENDUNTRANS) { | if(useCkLoop>=CKLOOP_CTRL_PME_SENDUNTRANS |
| && CkNumPes() >= 2 * initdata.xBlocks * initdata.zBlocks) { |
int yBlocks = initdata.yBlocks; | int yBlocks = initdata.yBlocks; |
int evirIdx = 0; | int evirIdx = 0; |
for ( int isend=0; isend<yBlocks; ++isend ) { | for ( int isend=0; isend<yBlocks; ++isend ) { |
| |
#ifdef NAMD_FFTW_3 | #ifdef NAMD_FFTW_3 |
#if CMK_SMP && USE_CKLOOP | #if CMK_SMP && USE_CKLOOP |
int useCkLoop = Node::Object()->simParameters->useCkLoop; | int useCkLoop = Node::Object()->simParameters->useCkLoop; |
if(useCkLoop>=CKLOOP_CTRL_PME_BACKWARDFFT) { | if(useCkLoop>=CKLOOP_CTRL_PME_BACKWARDFFT |
| && CkNumPes() >= 2 * initdata.xBlocks * initdata.yBlocks) { |
//for(int i=0; i<numPlans; i++) fftwf_execute(backward_plans[i]); | //for(int i=0; i<numPlans; i++) fftwf_execute(backward_plans[i]); |
//transform the above loop | //transform the above loop |
CkLoop_Parallelize(PmeXZPencilFFT, 1, (void *)backward_plans, CkMyNodeSize(), 0, numPlans-1); //sync | CkLoop_Parallelize(PmeXZPencilFFT, 1, (void *)backward_plans, CkMyNodeSize(), 0, numPlans-1); //sync |
| |
| |
#if CMK_SMP && USE_CKLOOP | #if CMK_SMP && USE_CKLOOP |
Bool useCkLoop = Node::Object()->simParameters->useCkLoop; | Bool useCkLoop = Node::Object()->simParameters->useCkLoop; |
if(useCkLoop>=CKLOOP_CTRL_PME_SENDUNTRANS) { | if(useCkLoop>=CKLOOP_CTRL_PME_SENDUNTRANS |
| && CkNumPes() >= 2 * initdata.xBlocks * initdata.yBlocks) { |
//????What's the best value for numChunks????? | //????What's the best value for numChunks????? |
#if USE_NODE_PAR_RECEIVE | #if USE_NODE_PAR_RECEIVE |
//CkLoop_Parallelize(PmeZPencilSendUngrid, evirIdx, (void *)this, CkMyNodeSize(), 0, grid_msgs.size()-1, 1); //has to sync | //CkLoop_Parallelize(PmeZPencilSendUngrid, evirIdx, (void *)this, CkMyNodeSize(), 0, grid_msgs.size()-1, 1); //has to sync |