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

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

Definition at line 753 of file PxDistribution.h.

References _myCPU, _nrCPUs, ArrayBD(), ArrayBH(), ArrayBW(), ArrayD(), ArrayH(), ArrayPB(), ArrayW(), PxLclDepth(), PxLclHeight(), and PxLclWidth().

Referenced by PxScatterArray().

00754 {
00755     /*** MPI-Scatter. May be faster than OFT/SBT scatter provided   ***/
00756     /*** above as specific communication subsystem capabilities may ***/
00757     /*** be incorporated in the implementation.                     ***/
00758     /***                                                            ***/
00759     /*** NOTE: This function can only be used if:                   ***/
00760     /***                                                            ***/
00761     /*** Borders must be sent as well OR all border sizes are 0 AND ***/
00762     /*** xcpus>=1 AND ArrayH(glob)=1 AND ArrayD(glob)=1, OR     ***/
00763     /*** xcpus=1 AND ycpus>=1 AND ArrayD(glob)=1, OR              ***/
00764     /*** xcpus=1 AND ycpus=1 AND zcpus>=1.                          ***/
00765     /***                                                            ***/
00766     /*** This is due to the lack of possibility to define an array  ***/
00767     /*** of derived datatypes at the root. In principle, we could   ***/
00768     /*** temporarily re-arrange the layout of the array to still be ***/
00769     /*** able to use the standard MPI functionality. However, this  ***/
00770     /*** requires a costly copy operation which is not implemented. ***/
00771 
00772     int *counts, *disps;
00773 
00774     /*** Determine size and position of each local array ***/
00775 
00776     if (_myCPU == root) {
00777         counts = new int[_nrCPUs];
00778         disps  = new int[_nrCPUs];
00779         int slice = 2*((ArrayW(glob)*ArrayH(glob)*ArrayBD(glob)) +
00780                        (ArrayW(glob)*ArrayBH(glob)));
00781         for (int i=0; i<_nrCPUs; i++) {
00782             counts[i] = (PxLclWidth(i)  + 2*ArrayBW(glob)) *
00783                         (PxLclHeight(i) + 2*ArrayBH(glob)) *
00784                         (PxLclDepth(i)  + 2*ArrayBD(glob));
00785             disps[i] = (i==0) ? 0 : disps[i-1] + counts[i-1] - slice; 
00786         }
00787     }
00788 
00789     /*** Scatter array data ***/
00790 
00791     int sSize = ArrayT::ElemSize()*sizeof(typename ArrayT::StorType);
00792     MPI_Datatype elem;
00793     MPI_Type_contiguous(sSize, MPI_BYTE, &elem);
00794     MPI_Type_commit(&elem);
00795     MPI_Scatterv(ArrayPB(glob), counts, disps, elem, ArrayPB(loc),
00796                  ArrayW(loc)*ArrayH(loc)*ArrayD(loc), elem, root,
00797                  MPI_COMM_WORLD);
00798     MPI_Type_free(&elem);
00799 
00800     if (_myCPU == root) {
00801         delete counts;
00802         delete disps;
00803     }
00804 }

Here is the call graph for this function:


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