Go to the documentation of this file.
26 #ifndef TILEDARRAY_PMAP_CYCLIC_PMAP_H__INCLUDED
27 #define TILEDARRAY_PMAP_CYCLIC_PMAP_H__INCLUDED
82 :
Pmap(world, rows * cols),
85 proc_cols_(proc_cols),
86 proc_rows_(proc_rows) {
97 if (
rank_ < (proc_rows_ * proc_cols_)) {
99 rank_row_ =
rank_ / proc_cols_;
100 rank_col_ =
rank_ % proc_cols_;
103 (rows_ / proc_rows_) + ((rows_ % proc_rows_) > rank_row_ ? 1ul : 0ul);
105 (cols_ / proc_cols_) + ((cols_ % proc_cols_) > rank_col_ ? 1ul : 0ul);
133 const size_type proc_row = tile_row % proc_rows_;
134 const size_type proc_col = tile_col % proc_cols_;
136 const size_type proc = proc_row * proc_cols_ + proc_col;
152 virtual void advance(
size_type& value,
bool increment)
const {
154 auto row = value / cols_;
155 const auto row_end = (row + 1) * cols_;
157 if (value >= row_end) {
160 value = row * cols_ + rank_col_;
165 auto row = value / cols_;
166 const auto row_begin = row * cols_;
167 if (value < proc_cols_) {
171 if (value < row_begin) {
172 if (row < proc_rows_)
175 value = row * cols_ + rank_col_ +
176 (local_cols_ - 1) * proc_cols_;
184 ?
Iterator(*
this, rank_row_ * cols_ + rank_col_, this->
size_,
185 rank_row_ * cols_ + rank_col_,
false,
true)
190 ?
Iterator(*
this, rank_row_ * cols_ + rank_col_, this->
size_,
191 this->
size_,
false,
true)
200 #endif // TILEDARRAY_PMAP_CYCLIC_PMAP_H__INCLUDED
size_type ncols_proc() const
Access number of columns in the process matrix.
const size_type procs_
The number of processes.
virtual size_type owner(const size_type tile) const
Maps tile to the processor that owns it.
const size_type rank_
< The number of processes
virtual const_iterator begin() const
Begin local element iterator.
virtual bool is_local(const size_type tile) const
Check that the tile is owned by this process.
CyclicPmap(World &world, size_type rows, size_type cols, size_type proc_rows, size_type proc_cols)
Construct process map.
Pmap::size_type size_type
Size type.
#define TA_ASSERT(EXPR,...)
const size_type procs_
The number of processes.
virtual const_iterator end() const
End local element iterator.
Maps cyclically a sequence of indices onto a 2-d matrix of processes.
size_type nrows_proc() const
Access number of rows in the process matrix.
const size_type rank_
The rank of this process.
size_type nrows() const
Access number of rows in the tile index matrix.
std::size_t size_type
Size type.
const size_type size_
< The rank of this process
friend class Iterator
Iterator type.
const size_type size_
The number of tiles mapped among all processes.
size_type ncols() const
Access number of columns in the tile index matrix.