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

template<class ArithT>
static ArithT Impala::Core::Array::Pattern::PxBcastValueSBT ( ArithT  val,
int  root 
) [inline, static]

Definition at line 297 of file PxDistribution.h.

References _logCPUs, _maxCPUs, _nrCPUs, BCAST_TAG, and PxGetSBTorder().

Referenced by PxBcastValue(), and PxReduceValueToAllSBT().

00298 {
00299     /*** Determine ordering of CPUs in Spanning Binomial Tree ***/
00300 
00301     int *order = new int[_maxCPUs], myIndex;
00302     PxGetSBTorder(root, _maxCPUs, order, &myIndex);
00303 
00304     /*** Broadcast value using Spanning Binomial Tree ***/
00305 
00306     MPI_Datatype elem;
00307     MPI_Status stat;
00308     MPI_Type_contiguous(sizeof(ArithT), MPI_BYTE, &elem);
00309     MPI_Type_commit(&elem);
00310 
00311     int mask = 1 << _logCPUs-1;
00312     for (int i=0; i<_logCPUs; i++) {
00313         int partnerIndex = myIndex ^ mask;
00314         int partner = order[partnerIndex];
00315         if ((myIndex % mask == 0) && (partner < _nrCPUs)) {
00316             if (myIndex < partnerIndex) {
00317                 MPI_Send(&val, 1, elem,
00318                          partner, BCAST_TAG, MPI_COMM_WORLD);
00319             } else {
00320                 MPI_Recv(&val, 1, elem,
00321                          partner, BCAST_TAG, MPI_COMM_WORLD, &stat);
00322             }
00323         }
00324         mask >>= 1;
00325     }
00326     MPI_Type_free(&elem);
00327     delete order;
00328     return val;
00329 }

Here is the call graph for this function:


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