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.

Macros

#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)
 

Macro Definition Documentation

◆ DISTRIBUTION_TYPE

#define DISTRIBUTION_TYPE   16

Definition at line 8 of file BasicBC.cc.

Referenced by BasicBC::setBlocSize().

◆ DST_TOPOLOGY

#define DST_TOPOLOGY   2

Definition at line 5 of file BasicBC.cc.

Referenced by BasicBC::setDestTopology().

◆ ELEMENT_SIZE

#define ELEMENT_SIZE   4

Definition at line 6 of file BasicBC.cc.

Referenced by BasicBC::setEltSize().

◆ SRC_TOPOLOGY

#define SRC_TOPOLOGY   1

Definition at line 4 of file BasicBC.cc.

Referenced by BasicBC::setSourceTopology().

◆ TOTAL_SIZE

#define TOTAL_SIZE   8

Definition at line 7 of file BasicBC.cc.

Referenced by BasicBC::setTotalNbElt().

Function Documentation

◆ BlocNumberOfElementProc()

static unsigned BlocNumberOfElementProc ( const unsigned  glen,
const unsigned  rank,
const unsigned  nbprocs,
const unsigned  bsz,
const unsigned  pos 
)
inlinestatic

Definition at line 45 of file BasicBC.cc.

Referenced by BasicBC::computePiecesToSend().

47  {
48 
49  unsigned long low = ( pos * nbprocs + rank ) * bsz;
50  unsigned long end = low + bsz;
51  unsigned long high = (glen < end ? glen : end);
52 
53  return ( high - low );
54 
55 }

◆ blocSize()

static unsigned blocSize ( const unsigned  glen,
const unsigned  nbprocs,
const BasicBC_param_t param 
)
inlinestatic

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().

99  {
100  switch(param.type)
101  {
102  case BASICBC_BLOC:
103  {
104  unsigned nbbloc = (glen + param.unitsize - 1) / param.unitsize;
105  return ((nbbloc + nbprocs - 1 ) / nbprocs) * param.unitsize;
106  }
107  case BASICBC_CYCLIC: return param.unitsize; break;
108  case BASICBC_BLOCCYCLIC: return param.blocsize*param.unitsize; break;
109  }
110  return 0;
111 }
unsigned long blocsize
Definition: BasicBC.h:28
unsigned long unitsize
Definition: BasicBC.h:27
BasicBC_distri_type_t type
Definition: BasicBC.h:26

◆ computeBlocBoundInf()

static unsigned computeBlocBoundInf ( const unsigned  bsz,
const unsigned  rank,
const unsigned  nbprocs,
const unsigned  pos 
)
inlinestatic

Definition at line 60 of file BasicBC.cc.

61  {
62  return ( pos * nbprocs + rank) * bsz;
63 }

◆ computeBlocBounds()

static void computeBlocBounds ( unsigned long *  low,
unsigned long *  high,
const unsigned  glen,
const unsigned  rank,
const unsigned  nbprocs,
const unsigned  bsz,
const unsigned  pos 
)
inlinestatic

Definition at line 69 of file BasicBC.cc.

Referenced by BasicBC::computePiecesToSend().

72  {
73  unsigned long start = (pos * nbprocs + rank) * bsz;
74  unsigned long end = start + bsz;
75  *low = start;
76  *high = ((glen <= end)?glen:end); // min
77 }

◆ getProcRangeInf()

static unsigned getProcRangeInf ( unsigned  low,
unsigned  bsz 
)
inlinestatic

Definition at line 23 of file BasicBC.cc.

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

23  {
24  return low / bsz; // first remote node
25 }

◆ getProcRangeSup()

static unsigned getProcRangeSup ( unsigned  high,
unsigned  bsz 
)
inlinestatic

Definition at line 28 of file BasicBC.cc.

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

28  {
29  return (high-1) / bsz; // last remote node
30 }

◆ NumberOfBlocProc()

static unsigned NumberOfBlocProc ( const unsigned  glen,
const unsigned  nbprocs,
const unsigned  bsz,
const unsigned  rank 
)
inlinestatic

Definition at line 35 of file BasicBC.cc.

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

36  {
37  unsigned nbbloc = (glen + bsz - 1 ) / bsz;
38  return (nbbloc / nbprocs) + (rank < (nbbloc % nbprocs ) ) ;
39 }

◆ OwnerBloc()

static unsigned OwnerBloc ( const unsigned  bid,
const unsigned  nbprocs 
)
inlinestatic

Definition at line 16 of file BasicBC.cc.

Referenced by BasicBC::computePiecesToSend().

16  {
17  return bid % nbprocs;
18 }

◆ TotalNumberOfElementProc()

static unsigned TotalNumberOfElementProc ( const unsigned  glen,
const unsigned  rank,
const unsigned  nbprocs,
const unsigned  bsz 
)
inlinestatic

Definition at line 82 of file BasicBC.cc.

References NumberOfBlocProc().

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

83  {
84 
85  unsigned nbblocfull = NumberOfBlocProc(glen, nbprocs, bsz, rank) - 1;
86  // Is the last full ?
87  unsigned long low = ( nbblocfull * nbprocs + rank ) * bsz;
88  unsigned long end = low + bsz;
89  unsigned long high = (glen < end ? glen : end);
90 
91  return nbblocfull * bsz + ( high - low );
92 }
static unsigned NumberOfBlocProc(const unsigned glen, const unsigned nbprocs, const unsigned bsz, const unsigned rank)
Definition: BasicBC.cc:35
Here is the call graph for this function: