PaCO++  0.05
BasicBC.cc File Reference
#include "BasicBC.h"
#include <iostream>
Include dependency graph for BasicBC.cc:

Go to the source code of this file.

Defines

#define DISTRIBUTION_TYPE   16
#define DST_TOPOLOGY   2
#define ELEMENT_SIZE   4
#define SRC_TOPOLOGY   1
#define TOTAL_SIZE   8

Functions

static unsigned BlocNumberOfElementProc (const unsigned glen, const unsigned rank, const unsigned nbprocs, const unsigned bsz, const unsigned pos)
static unsigned blocSize (const unsigned glen, const unsigned nbprocs, const BasicBC_param_t &param)
static unsigned computeBlocBoundInf (const unsigned bsz, const unsigned rank, const unsigned nbprocs, const unsigned pos)
static void computeBlocBounds (unsigned long *low, unsigned long *high, const unsigned glen, const unsigned rank, const unsigned nbprocs, const unsigned bsz, const unsigned pos)
static unsigned getProcRangeInf (unsigned low, unsigned bsz)
static unsigned getProcRangeSup (unsigned high, unsigned bsz)
static unsigned NumberOfBlocProc (const unsigned glen, const unsigned nbprocs, const unsigned bsz, const unsigned rank)
static unsigned OwnerBloc (const unsigned bid, const unsigned nbprocs)
static unsigned TotalNumberOfElementProc (const unsigned glen, const unsigned rank, const unsigned nbprocs, const unsigned bsz)

Define Documentation

#define DISTRIBUTION_TYPE   16

Definition at line 8 of file BasicBC.cc.

Referenced by BasicBC::setBlocSize().

#define DST_TOPOLOGY   2

Definition at line 5 of file BasicBC.cc.

Referenced by BasicBC::setDestTopology().

#define ELEMENT_SIZE   4

Definition at line 6 of file BasicBC.cc.

Referenced by BasicBC::setEltSize().

#define SRC_TOPOLOGY   1

Definition at line 4 of file BasicBC.cc.

Referenced by BasicBC::setSourceTopology().

#define TOTAL_SIZE   8

Definition at line 7 of file BasicBC.cc.

Referenced by BasicBC::setTotalNbElt().


Function Documentation

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

Definition at line 45 of file BasicBC.cc.

Referenced by BasicBC::computePiecesToSend().

                                      {
  
  unsigned long low = ( pos * nbprocs + rank ) * bsz;
  unsigned long end = low + bsz;
  unsigned long high = (glen < end ? glen : end);
  
  return ( high - low );
  
}
static unsigned blocSize ( const unsigned  glen,
const unsigned  nbprocs,
const BasicBC_param_t param 
) [inline, static]

Definition at line 98 of file BasicBC.cc.

References BASICBC_BLOC, BASICBC_BLOCCYCLIC, BASICBC_CYCLIC, BasicBC_param_t::blocsize, BasicBC_param_t::type, and BasicBC_param_t::unitsize.

Referenced by BasicBC::computePiecesToSend(), and BasicBC::setDescr().

                                           {
  switch(param.type)
    {
    case BASICBC_BLOC:
      {
   unsigned nbbloc = (glen + param.unitsize - 1) / param.unitsize;
   return ((nbbloc + nbprocs - 1 ) / nbprocs) * param.unitsize;
      }
    case BASICBC_CYCLIC: return param.unitsize; break;
    case BASICBC_BLOCCYCLIC: return param.blocsize*param.unitsize; break;
    }
  return 0;
}
static unsigned computeBlocBoundInf ( const unsigned  bsz,
const unsigned  rank,
const unsigned  nbprocs,
const unsigned  pos 
) [inline, static]

Definition at line 60 of file BasicBC.cc.

                                                               {
  return  ( pos * nbprocs + rank) * bsz;
}
static void computeBlocBounds ( 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 69 of file BasicBC.cc.

Referenced by BasicBC::computePiecesToSend().

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

Definition at line 23 of file BasicBC.cc.

Referenced by BasicBC::computePiecesToSend(), computeReceiveBlock1D(), and computeSendBlock1D().

                                                                   {
  return low / bsz;      // first remote node
}
static unsigned getProcRangeSup ( unsigned  high,
unsigned  bsz 
) [inline, static]

Definition at line 28 of file BasicBC.cc.

Referenced by BasicBC::computePiecesToSend(), computeReceiveBlock1D(), and computeSendBlock1D().

                                                                    {
  return (high-1) / bsz; //  last remote node
}
static unsigned NumberOfBlocProc ( const unsigned  glen,
const unsigned  nbprocs,
const unsigned  bsz,
const unsigned  rank 
) [inline, static]

Definition at line 35 of file BasicBC.cc.

Referenced by BasicBC::computePiecesToSend(), and TotalNumberOfElementProc().

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

Definition at line 16 of file BasicBC.cc.

Referenced by BasicBC::computePiecesToSend().

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

Definition at line 82 of file BasicBC.cc.

References NumberOfBlocProc().

Referenced by BasicBC::computePiecesToSend(), computeReceiveDataBlock1DServer(), computeSendDataBlock1DClient(), and BasicBC::setDescr().

                                                              {

  unsigned nbblocfull = NumberOfBlocProc(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: