Paraper
|
Public Types | |
enum | Phase_1_type { PHASE_1_SINGLE, PHASE_1_BULK } |
Type of distribution of the elements in Phase 1. More... | |
typedef INT | value_type |
Integer data type for permutation elements. Matches template parameter INT. | |
typedef std::vector< INT > | vector_type |
Standard library vector type with elemetns of type value_type. | |
Public Member Functions | |
Paraper () | |
Default constructor. | |
~Paraper () | |
Default destructor. | |
void | set_communicator (MPI_Comm comm) |
Set MPI communicator. | |
void | free_communicator () |
Free internal MPI communicators. This function is also called within the destructor. | |
void | generate (INT size, Phase_1_type p1t=PAHSE_1_BULK) |
Parallelly generates random permutation. | |
const vector_type & | elements () const |
Get local array with generated permutation elements. | |
INT | first () const |
Return position of the first local element in the global permutation array. | |
INT | count () const |
Return number of local permutation elements. | |
Private Attributes | |
Paraper_impl< INT > | impl_ |
enum Phase_1_type |
Type of distribution of the elements in Phase 1.
PHASE_1_SINGLE |
Elements are distributed one-by-one to random destination processors. |
PHASE_1_BULK |
Elements are first stored in an auxiliary array together with random destination processor numbers. This array is then sorted according to the processor numbers. Finally, all elements targeting the same processor are sent at once. This process is split into two subphases due to memory requirements. See [1] for more details. |
void set_communicator | ( | MPI_Comm | comm | ) |
Set MPI communicator.
[in] | comm | valid MPI communicator |
Internally, the comm communicator is duplicated, no MPI operations are performed using comm directly.
Must be called collectively within all MPI processes that belongs to comm!
void free_communicator | ( | ) |
Free internal MPI communicators. This function is also called within the destructor.
Must be called collectively within all MPI processes that belongs to the original outer communicator (see set_communicator() function)!
Must be called prior to the execution of the MPI_Finalize() function!
void generate | ( | INT | size, |
Phase_1_type | p1t = PAHSE_1_BULK |
||
) |
Parallelly generates random permutation.
[in] | size | number of elements of the permutation |
[in] | p1t | type of Phase 1 (see Phase_1_type for more details) |
Generation of the random permutation of a set of integer numbers from 0 to (size - 1). After generation, these elements are available via elements() member function.
Must be called collectively within all MPI processes that belongs to the original outer communicator (see set_communicator() function)!
const vector_type& elements | ( | ) | const |
Get local array with generated permutation elements.
The position of the first local element in the global permutation array is provided by the first() member function. The number of local elements is provided by the count() member function.
INT first | ( | ) | const |
Return position of the first local element in the global permutation array.
INT count | ( | ) | const |
Return number of local permutation elements.