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

template<class ArrayT>
static void Impala::Core::Array::Pattern::PxGatherArrayOFT ( ArrayT *  glob,
ArrayT *  loc,
int  root,
bool  bdata 
) [inline, static]

Definition at line 833 of file PxDistribution.h.

References _myCPU, _nrCPUs, ArrayBD(), ArrayBH(), ArrayBW(), ArrayCPB(), ArrayH(), ArrayPB(), ArrayW(), GATH_TAG, PxLclArrayCopy(), PxLclDepth(), PxLclHeight(), PxLclStart(), PxLclWidth(), and TO.

Referenced by PxGatherArray().

00834 {
00835     /*** Gather array data using One-level Flat Tree ***/
00836 
00837     int eSize = ArrayT::ElemSize();
00838     int sSize = eSize*sizeof(typename ArrayT::StorType);
00839     MPI_Datatype elem, blk2d, blk3d;
00840     MPI_Status stat;
00841     MPI_Type_contiguous(sSize, MPI_BYTE, &elem);
00842 
00843     if (_myCPU == root) {   // receive array data from all other CPUs
00844         PxLclArrayCopy(loc, TO, glob, root, bdata);
00845         for (int partner=0; partner<_nrCPUs; partner++) {
00846             if (partner != _myCPU) {
00847                 int xSize  = PxLclWidth(partner);
00848                 int ySize  = PxLclHeight(partner);
00849                 int zSize  = PxLclDepth(partner);
00850                 int offset = PxLclStart(partner,ArrayBW(glob),
00851                              ArrayBH(glob), ArrayBD(glob));
00852                 if (bdata) {
00853                     xSize += 2*ArrayBW(glob);
00854                     ySize += 2*ArrayBH(glob);
00855                     zSize += 2*ArrayBD(glob);
00856                     offset -=
00857                     (ArrayW(glob)*ArrayH(glob)*ArrayBD(glob) +
00858                      ArrayW(glob)*ArrayBH(glob) + ArrayBW(glob));
00859                 }
00860                 if (xSize != 0 && ySize != 0 && zSize != 0) {
00861                     MPI_Type_vector(ySize, xSize,
00862                                     ArrayW(glob), elem, &blk2d);
00863                     MPI_Type_hvector(zSize, 1,
00864                                     ArrayW(glob)*ArrayH(glob)*sSize,
00865                                     blk2d, &blk3d);
00866                     MPI_Type_commit(&blk3d);
00867                     MPI_Recv(ArrayPB(glob) + offset*eSize, 1, blk3d,
00868                              partner, GATH_TAG, MPI_COMM_WORLD, &stat);
00869                     MPI_Type_free(&blk3d);
00870                     MPI_Type_free(&blk2d);
00871                 }
00872             }
00873         }
00874     } else {                // send array data to root
00875         int xSize = PxLclWidth(_myCPU);
00876         int ySize = PxLclHeight(_myCPU);
00877         int zSize = PxLclDepth(_myCPU);
00878         if (bdata) {
00879             xSize += 2*ArrayBW(glob);
00880             ySize += 2*ArrayBH(glob);
00881             zSize += 2*ArrayBD(glob);
00882         }
00883         if (xSize != 0 && ySize != 0 && zSize != 0) {
00884             MPI_Type_vector(ySize, xSize, ArrayW(loc), elem, &blk2d);
00885             MPI_Type_hvector(zSize, 1,
00886                     ArrayW(loc)*ArrayH(loc)*sSize, blk2d, &blk3d);
00887             MPI_Type_commit(&blk3d);
00888             MPI_Send((bdata) ? ArrayPB(loc) : ArrayCPB(loc),
00889                      1, blk3d, root, GATH_TAG, MPI_COMM_WORLD);
00890             MPI_Type_free(&blk3d);
00891             MPI_Type_free(&blk2d);
00892         }
00893     }
00894     MPI_Type_free(&elem);
00895 }

Here is the call graph for this function:


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