1 #ifndef DISTRIBUTION_BLOC_1D_IS_DEFINED 2 #define DISTRIBUTION_BLOC_1D_IS_DEFINED 6 #if defined(__cplusplus) 18 static inline unsigned MaxNumberOfBlock(
const unsigned glen,
const unsigned nbprocs,
const unsigned bsz) {
19 unsigned nbbloc = (glen + bsz - 1) / bsz;
20 return ((nbbloc + nbprocs - 1 ) / nbprocs);
23 static inline unsigned NumberOfBlockProc(
const unsigned glen,
const unsigned nbprocs,
const unsigned bsz,
const unsigned rank) {
24 unsigned nbbloc = (glen + bsz - 1 ) / bsz;
25 return (nbbloc / nbprocs) + (rank < (nbbloc % nbprocs ) ) ;
29 static inline unsigned OwnerBlock(
const unsigned bid,
const unsigned nbprocs) {
40 return ((nbbloc + nbprocs - 1 ) / nbprocs) * param->
unitblocksize;
49 static inline unsigned TotalNumberOfElementProc(
const unsigned glen,
const unsigned rank,
const unsigned nbprocs,
const unsigned bsz) {
53 unsigned long low = ( nbblocfull * nbprocs + rank ) * bsz;
54 unsigned long end = low + bsz;
55 unsigned long high = (glen < end ? glen : end);
57 return nbblocfull * bsz + ( high - low );
62 static inline unsigned BlockNumberOfElementProc(
const unsigned glen,
const unsigned rank,
const unsigned nbprocs,
const unsigned bsz,
65 unsigned long low = ( pos * nbprocs + rank ) * bsz;
66 unsigned long end = low + bsz;
67 unsigned long high = (glen < end ? glen : end);
69 return ( high - low );
74 static inline void computeBlockBounds(
unsigned long *low,
unsigned long *high,
const unsigned glen,
75 const unsigned rank,
const unsigned nbprocs,
const unsigned bsz,
const unsigned pos) {
77 unsigned long start = (pos * nbprocs + rank) * bsz;
78 unsigned long end = start + bsz;
80 *high = ((glen <= end)?glen:end);
84 static inline unsigned computeBlockBoundInf(
const unsigned bsz,
const unsigned rank,
const unsigned nbprocs,
const unsigned pos) {
85 return ( pos * nbprocs + rank) * bsz;
89 const unsigned nbprocs,
const unsigned pos) {
90 unsigned tmp = ( pos * nbprocs + rank + 1) * bsz;
91 return ((glen <= tmp)?glen:tmp);
94 #if defined(__cplusplus) static unsigned BlockNumberOfElementProc(const unsigned glen, const unsigned rank, const unsigned nbprocs, const unsigned bsz, const unsigned pos)
static unsigned NumberOfBlockProc(const unsigned glen, const unsigned nbprocs, const unsigned bsz, const unsigned rank)
static unsigned computeBlockBoundSup(const unsigned glen, const unsigned bsz, const unsigned rank, const unsigned nbprocs, const unsigned pos)
static unsigned OwnerBlock(const unsigned bid, const unsigned nbprocs)
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 TotalNumberOfElementProc(const unsigned glen, const unsigned rank, const unsigned nbprocs, const unsigned bsz)
static unsigned computeBlockBoundInf(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 blockSize(const unsigned glen, const unsigned nbprocs, const ParisBlock_param_t *param)
unsigned int unitblocksize
ParisBlock_distri_type_t type