Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

static int Impala::Core::Array::Pattern::PxLineRange ( int  dimension,
int  firstIndex,
int *  order 
) [inline, static]

Definition at line 127 of file PxDistribution.h.

References _nrCPUs, PxFullDepth(), PxFullHeight(), PxFullWidth(), PxGridIndexX(), PxGridIndexY(), PxGridIndexZ(), PxLogPartXcpus(), PxLogPartYcpus(), PxLogPartZcpus(), PxMinLclDepth(), PxMinLclHeight(), PxMinLclWidth(), PxOverflowX(), PxOverflowY(), PxOverflowZ(), and PxResponsibilityRange().

Referenced by PxGatherArraySBT(), and PxScatterArraySBT().

00128 {
00129     /*** Calculate number of 'lines' that will be send/received in ***/
00130     /*** SBT collective communication. The CPU at 'firstIndex' in  ***/
00131     /*** the SBTarray 'order' is responsible for a range of CPUs,  ***/
00132     /*** and will send and receive data for that range.            ***/
00133 
00134     int minNrLines = 0;
00135     int overflow = 0;
00136 
00137     switch (dimension) {
00138         case 1: if (PxLogPartXcpus() == 1) {    // get nr of 'columns'
00139                     return PxFullWidth();
00140                 }
00141                 minNrLines = PxMinLclWidth();
00142                 overflow = PxOverflowX();
00143                 break;
00144         case 2: if (PxLogPartYcpus() == 1) {    // get nr of 'rows'
00145                     return PxFullHeight();
00146                 }
00147                 minNrLines = PxMinLclHeight();
00148                 overflow = PxOverflowY();
00149                 break;
00150         case 3: if (PxLogPartZcpus() == 1) {    // get nr of 'pages'
00151                     return PxFullDepth();
00152                 }
00153                 minNrLines = PxMinLclDepth();
00154                 overflow = PxOverflowZ();
00155                 break;
00156         default:
00157                 return 0;
00158     }
00159 
00160     int lastIndex = firstIndex + PxResponsibilityRange(firstIndex) - 1;
00161     int nrIndexes = lastIndex - firstIndex + 1;
00162     int firstCPU = order[firstIndex];
00163     if (firstIndex == 0) {
00164         firstCPU = (firstCPU / 4) * 4;
00165     }
00166     int lastCPU = firstCPU + nrIndexes - 1;
00167     if (lastCPU >= _nrCPUs) {
00168         lastCPU = _nrCPUs - 1;
00169     }
00170 
00171     /*** Normalize CPU numbers to grid indices in correct dimension ***/
00172 
00173     switch (dimension) {
00174         case 1: firstCPU = PxGridIndexX(firstCPU);
00175                 lastCPU  = PxGridIndexX(lastCPU);
00176                 break;
00177         case 2: firstCPU = PxGridIndexY(firstCPU);
00178                 lastCPU  = PxGridIndexY(lastCPU);
00179                 break;
00180         case 3: firstCPU = PxGridIndexZ(firstCPU);
00181                 lastCPU  = PxGridIndexZ(lastCPU);
00182                 break;
00183     }
00184     int nrBufCPUs = lastCPU - firstCPU + 1;
00185     if (firstCPU >= overflow) {
00186         return (minNrLines * nrBufCPUs);
00187     } else if (lastCPU < overflow) {
00188         return ((minNrLines + 1) * nrBufCPUs);
00189     } else {
00190         return (minNrLines * nrBufCPUs + overflow - firstCPU);
00191     }
00192 }

Here is the call graph for this function:


Generated on Fri Mar 19 11:02:34 2010 for ImpalaSrc by  doxygen 1.5.1