Flow123d
JS_before_hm-1716-g9144da4bf
|
Go to the documentation of this file.
57 for(
unsigned int i=0 ; i<
np(); i++)
starts[i+1]=
starts[i]+sizes[i];
65 :communicator(PETSC_COMM_WORLD),
71 const PetscInt *petsc_starts;
72 chkerr(VecGetOwnershipRanges(petsc_vector,&petsc_starts));
75 for(
unsigned int i=0 ; i<=
np(); i++)
starts[i]=petsc_starts[i];
91 unsigned int reminder, per_proc;
93 reminder=global_size %
np(); per_proc=global_size /
np();
97 for(
unsigned int i=0; i<
np(); i++)
104 for(
unsigned int i=1; i<=
np(); i++)
starts[i]=global_size;
107 OLD_ASSERT( 0 ,
"Cyclic distribution is not yet implemented.\n");
115 : communicator(distr.communicator)
133 OLD_ASSERT(idx <
size(),
"Index %d greater then distribution size %d.\n", idx,
size());
135 for(
unsigned int i=0; i<
np(); i++) {
138 OLD_ASSERT( 0 ,
"Can not find owner of index %d. \n", idx);
162 stream <<
"[" <<
myp() <<
"]" <<
"Distribution size: " <<
size() <<
" lsize: " <<
lsize() <<
" offset: " <<
begin() <<
" mpi_size: " <<
np() << endl;
163 for(
unsigned int i=0; i<
np();++i)
164 stream <<
"[" <<
myp() <<
"]" <<
"proc: " << i <<
" offset: " <<
begin(i) <<
" lsize: " <<
lsize(i) << endl;
unsigned int np() const
get num of processors
unsigned int lsize() const
unsigned int myp() const
get my processor
int my_proc
my proc number
Support classes for parallel programing.
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
unsigned int size() const
get global size
Distribution(const unsigned int size, MPI_Comm comm)
unsigned int * starts
starts[i] index of the first index on the proc i; starts[n_procs]=size of whole array
unsigned int get_proc(unsigned int idx) const
get processor of the given index
int num_of_procs
number of procs
const unsigned int * get_lsizes_array()
get local sizes array
unsigned int * lsizes
local sizes
const unsigned int * get_starts_array() const
get local starts array
Global macros to enhance readability and debugging, general constants.
const MPI_Comm communicator
communicator
unsigned int begin() const
#define MPI_Allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm)
bool is_on_proc(unsigned int idx, unsigned int proc) const
void view(std::ostream &stream) const
distribution view