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

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

Definition at line 572 of file PxDistribution.h.

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

Referenced by PxScatterArray().

00573 {
00574     /*** Scatter array data using One-level Flat Tree ***/
00575 
00576     int eSize = ArrayT::ElemSize();
00577     int sSize = eSize*sizeof(typename ArrayT::StorType);
00578     MPI_Datatype elem, blk2d, blk3d;
00579     MPI_Status stat;
00580     MPI_Type_contiguous(sSize, MPI_BYTE, &elem);
00581 
00582     if (_myCPU == root) {           // send array data to all other CPUs
00583         for (int partner=0; partner<_nrCPUs; partner++) {
00584             if (partner != _myCPU) {
00585                 int xSize  = PxLclWidth(partner);
00586                 int ySize  = PxLclHeight(partner);
00587                 int zSize  = PxLclDepth(partner);
00588                 int offset = PxLclStart(partner, ArrayBW(glob),
00589                              ArrayBH(glob), ArrayBD(glob));
00590                 if (bdata) {
00591                     xSize += 2*ArrayBW(glob);
00592                     ySize += 2*ArrayBH(glob);
00593                     zSize += 2*ArrayBD(glob);
00594                     offset -=
00595                     (ArrayW(glob)*ArrayH(glob)*ArrayBD(glob) +
00596                      ArrayW(glob)*ArrayBH(glob) + ArrayBW(glob));
00597                 }
00598                 if (xSize != 0 && ySize != 0 && zSize != 0) {
00599                     MPI_Type_vector(ySize, xSize,
00600                                     ArrayW(glob), elem, &blk2d);
00601                     MPI_Type_hvector(zSize, 1,
00602                                     ArrayW(glob)*ArrayH(glob)*sSize,
00603                                     blk2d, &blk3d);
00604                     MPI_Type_commit(&blk3d);
00605                     MPI_Send(ArrayPB(glob) + offset*eSize, 1, blk3d,
00606                                     partner, SCAT_TAG, MPI_COMM_WORLD);
00607                     MPI_Type_free(&blk3d);
00608                     MPI_Type_free(&blk2d);
00609                 }
00610             }
00611         }
00612         PxLclArrayCopy(loc, FROM, glob, root, bdata);
00613 
00614     } else {                        // receive array data from root
00615         int xSize = PxLclWidth(_myCPU);
00616         int ySize = PxLclHeight(_myCPU);
00617         int zSize = PxLclDepth(_myCPU);
00618         if (bdata) {
00619             xSize += 2*ArrayBW(glob);
00620             ySize += 2*ArrayBH(glob);
00621             zSize += 2*ArrayBD(glob);
00622         }
00623         if (xSize != 0 && ySize != 0 && zSize != 0) {
00624             MPI_Type_vector(ySize, xSize, ArrayW(loc), elem, &blk2d);
00625             MPI_Type_hvector(zSize, 1,
00626                     ArrayW(loc)*ArrayH(loc)*sSize, blk2d, &blk3d);
00627             MPI_Type_commit(&blk3d);
00628             MPI_Recv((bdata) ? ArrayPB(loc) : ArrayCPB(loc), 1,
00629                     blk3d, root, SCAT_TAG, MPI_COMM_WORLD, &stat);
00630             MPI_Type_free(&blk3d);
00631             MPI_Type_free(&blk2d);
00632         }
00633     }
00634     MPI_Type_free(&elem);
00635 }

Here is the call graph for this function:


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