PaCO++  0.05
DistributionBloc.h File Reference
#include "Type.h"
Include dependency graph for DistributionBloc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static unsigned BlockNumberOfElementProc (const unsigned glen, const unsigned rank, const unsigned nbprocs, const unsigned bsz, const unsigned pos)
static unsigned blockSize (const unsigned glen, const unsigned nbprocs, const ParisBlock_param_t *param)
static unsigned computeBlockBoundInf (const unsigned bsz, const unsigned rank, const unsigned nbprocs, const unsigned pos)
static void computeBlockBounds (unsigned long *low, unsigned long *high, const unsigned glen, const unsigned rank, const unsigned nbprocs, const unsigned bsz, const unsigned pos)
static unsigned computeBlockBoundSup (const unsigned glen, const unsigned bsz, const unsigned rank, const unsigned nbprocs, const unsigned pos)
static unsigned MaxNumberOfBlock (const unsigned glen, const unsigned nbprocs, const unsigned bsz)
static unsigned NumberOfBlockProc (const unsigned glen, const unsigned nbprocs, const unsigned bsz, const unsigned rank)
static unsigned OwnerBlock (const unsigned bid, const unsigned nbprocs)
static unsigned TotalNumberOfElementProc (const unsigned glen, const unsigned rank, const unsigned nbprocs, const unsigned bsz)

Function Documentation

static unsigned BlockNumberOfElementProc ( const unsigned  glen,
const unsigned  rank,
const unsigned  nbprocs,
const unsigned  bsz,
const unsigned  pos 
) [inline, static]

Definition at line 62 of file DistributionBloc.h.

Referenced by computeReceiveBlock1D(), and computeSendBlock1D().

                                        {

    unsigned long low = ( pos * nbprocs + rank ) * bsz;
    unsigned long end = low + bsz;
    unsigned long high = (glen < end ? glen : end);

    return ( high - low );

  }
static unsigned blockSize ( const unsigned  glen,
const unsigned  nbprocs,
const ParisBlock_param_t param 
) [inline, static]

Definition at line 34 of file DistributionBloc.h.

References ParisBlock_param_t::blocksize, PARISBLOCK_BLOCK, PARISBLOCK_BLOCKCYCLIC, PARISBLOCK_CYCLIC, ParisBlock_param_t::type, and ParisBlock_param_t::unitblocksize.

Referenced by computeReceiveBlock1D(), computeReceiveDataBlock1DServer(), computeSendBlock1D(), and computeSendDataBlock1DClient().

                                                                                                                 {
    switch(param->type)
      {
      case PARISBLOCK_BLOCK:
   {
     unsigned nbbloc = (glen + param->unitblocksize - 1) / param->unitblocksize;
     return ((nbbloc + nbprocs - 1 ) / nbprocs) * param->unitblocksize;
   }
      case PARISBLOCK_CYCLIC: return 1; break;
      case PARISBLOCK_BLOCKCYCLIC: return param->blocksize; break;
      }
    return 0;
  }
static unsigned computeBlockBoundInf ( const unsigned  bsz,
const unsigned  rank,
const unsigned  nbprocs,
const unsigned  pos 
) [inline, static]

Definition at line 84 of file DistributionBloc.h.

Referenced by computeSendDataBlock1DClient().

                                                                                                                                   {
    return  ( pos * nbprocs + rank) * bsz;
  }
static void computeBlockBounds ( unsigned long *  low,
unsigned long *  high,
const unsigned  glen,
const unsigned  rank,
const unsigned  nbprocs,
const unsigned  bsz,
const unsigned  pos 
) [inline, static]

Definition at line 74 of file DistributionBloc.h.

Referenced by computeSendBlock1D().

                                                                                                    {

    unsigned long start = (pos * nbprocs + rank) * bsz;
    unsigned long end = start + bsz;
    *low =  start;
    *high = ((glen <= end)?glen:end); // min
  }
static unsigned computeBlockBoundSup ( const unsigned  glen,
const unsigned  bsz,
const unsigned  rank,
const unsigned  nbprocs,
const unsigned  pos 
) [inline, static]

Definition at line 88 of file DistributionBloc.h.

                                                                 {
    unsigned tmp = ( pos * nbprocs + rank + 1) * bsz;
    return ((glen <= tmp)?glen:tmp); // min
  }
static unsigned MaxNumberOfBlock ( const unsigned  glen,
const unsigned  nbprocs,
const unsigned  bsz 
) [inline, static]

Definition at line 18 of file DistributionBloc.h.

                                                                                                           {
    unsigned nbbloc = (glen + bsz - 1) / bsz;
    return ((nbbloc + nbprocs - 1 ) / nbprocs);
  }
static unsigned NumberOfBlockProc ( const unsigned  glen,
const unsigned  nbprocs,
const unsigned  bsz,
const unsigned  rank 
) [inline, static]

Definition at line 23 of file DistributionBloc.h.

Referenced by computeReceiveBlock1D(), computeSendBlock1D(), and TotalNumberOfElementProc().

                                                                                                                                 {
    unsigned nbbloc = (glen + bsz - 1 ) / bsz;
    return (nbbloc / nbprocs) + (rank < (nbbloc % nbprocs ) ) ;
  }
static unsigned OwnerBlock ( const unsigned  bid,
const unsigned  nbprocs 
) [inline, static]

Definition at line 29 of file DistributionBloc.h.

Referenced by computeReceiveBlock1D(), and computeSendBlock1D().

                                                                                {
    return bid % nbprocs;
  }
static unsigned TotalNumberOfElementProc ( const unsigned  glen,
const unsigned  rank,
const unsigned  nbprocs,
const unsigned  bsz 
) [inline, static]

Definition at line 49 of file DistributionBloc.h.

References NumberOfBlockProc().

                                                                                                                                        {

    unsigned nbblocfull = NumberOfBlockProc(glen, nbprocs, bsz, rank) - 1;
    // Is the last full ?
    unsigned long low = ( nbblocfull * nbprocs + rank ) * bsz;
    unsigned long end = low + bsz;
    unsigned long high = (glen < end ? glen : end);

    return nbblocfull * bsz + ( high - low );

  }

Here is the call graph for this function: