34 #ifndef __H__LIB_ALGEBRA__PARALLELIZATION__PARALLELIZATION_UTIL_IMPL__
35 #define __H__LIB_ALGEBRA__PARALLELIZATION__PARALLELIZATION_UTIL_IMPL__
43 template <
class TIndVec>
51 indsOut.resize(numLocalInds, 0);
55 uint64 numLocalUniqueInds = 0;
56 const index_t invalidIndex = -1;
60 for(
size_t i = 0; i < numLocalInds; ++i){
61 if(indsOut[i] != invalidIndex){
70 std::vector<uint64> p0_uniqueIndNumbers(procCom.
size());
78 for(
size_t i = 0; i < p0_uniqueIndNumbers.size(); ++i){
79 size_t newOffset = offset + p0_uniqueIndNumbers[i];
80 p0_uniqueIndNumbers[i] = offset;
90 index_t newInd =
static_cast<index_t
>(indOffset);
91 for(
size_t i = 0; i < numLocalInds; ++i){
92 if(indsOut[i] != invalidIndex){
120 template <
class TMatrix>
123 std::vector<AlgebraID>* algebraIDs,
128 std::vector<AlgebraID> fallbackAlgebraIDs;
135 algebraIDs = &fallbackAlgebraIDs;
139 IDByIndex (
const std::vector<AlgebraID>* algIDs) : m_algIDs(*algIDs) {}
141 const std::vector<AlgebraID>& m_algIDs;
144 IDByIndex idByIndex(algebraIDs);
146 bool ok = pcl::TestLayout<IndexLayout, AlgebraID> (
154 UG_COND_THROW(!ok,
"H-Master <-> H-Slave mismatch in matrix layout");
157 ok = pcl::TestLayout<IndexLayout> (
163 UG_COND_THROW(!ok,
"H-Master-Overlap <-> H-Slave-Overlap mismatch in matrix layout");
location verbose
Definition: checkpoint_util.lua:128
Performs communication between interfaces on different processes.
Definition: pcl_interface_communicator.h:68
bool communicate(int tag=749345)
sends and receives the collected data.
Definition: pcl_interface_communicator_impl.hpp:409
void send_data(int targetProc, const Interface &interface, ICommunicationPolicy< TLayout > &commPol)
collects data that will be send during communicate.
Definition: pcl_interface_communicator_impl.hpp:80
void receive_data(int srcProc, const Interface &interface, ICommunicationPolicy< TLayout > &commPol)
registers a communication-policy to receive data on communicate.
Definition: pcl_interface_communicator_impl.hpp:188
Definition: pcl_process_communicator.h:70
void gather(const void *sendBuf, int sendCount, DataType sendType, void *recBuf, int recCount, DataType recType, int root) const
performs MPI_Gather on the processes of the communicator.
Definition: pcl_process_communicator.cpp:339
size_t size() const
returns the size of the communicator
Definition: pcl_process_communicator.cpp:71
void scatter(const void *sendBuf, int sendCount, DataType sendType, void *recBuf, int recCount, DataType recType, int root) const
performs MPI_Scatter on the processes of the communicator
Definition: pcl_process_communicator.cpp:392
int get_local_proc_id(int globalProcID=pcl::ProcRank()) const
returns the proc-id relative to this communicator
Definition: pcl_process_communicator.cpp:95
Extends the HorizontalAlgebraLayouts by vertical layouts.
Definition: algebra_layouts.h:121
const IndexLayout & vertical_master() const
Definition: algebra_layouts.h:133
Communication Policy to copy values of a vector.
Definition: communication_policies.h:88
const pcl::ProcessCommunicator & proc_comm() const
returns process communicator
Definition: algebra_layouts.h:68
const IndexLayout & master_overlap() const
Definition: algebra_layouts.h:62
const IndexLayout & slave() const
Definition: algebra_layouts.h:63
const IndexLayout & master() const
Definition: algebra_layouts.h:61
pcl::InterfaceCommunicator< IndexLayout > & comm() const
returns (non-const !!!) communicator
Definition: algebra_layouts.h:78
const IndexLayout & slave_overlap() const
Definition: algebra_layouts.h:64
void GenerateGlobalAlgebraIDs(pcl::InterfaceCommunicator< TLayout > &communicator, std::vector< AlgebraID > &idsOut, size_t numIDs, const TLayout &masterLayout, const TLayout &slaveLayout)
Generates a set of unique global algebra ids.
Definition: parallelization_util.h:81
void SetLayoutValues(TVector *pVec, const IndexLayout &layout, typename TVector::value_type val)
sets the values of a vector to a given number only on the layout indices
Definition: parallelization_util.h:315
#define PCL_DT_UNSIGNED_LONG_LONG
Definition: pcl_datatype.h:55
#define UG_COND_THROW(cond, msg)
UG_COND_THROW(cond, msg) : performs a UG_THROW(msg) if cond == true.
Definition: error.h:61
ugtypes::uint64_t uint64
Definition: types.h:117
#define PU_PROFILE_FUNC()
Definition: parallelization_util.h:48
void GenerateGlobalConsecutiveIndices(TIndVec &indsOut, size_t numLocalInds, const AlgebraLayouts &layouts)
Generates a set of global consecutive indices.
Definition: parallelization_util_impl.h:44
void TestHorizontalAlgebraLayouts(const TMatrix &mat, std::vector< AlgebraID > *algebraIDs=NULL, bool verbose=false)
Tests layouts by matching master and slave interfaces and by comparing global id's.
Definition: parallelization_util_impl.h:121
T value_type
Definition: sparsematrix_interface.h:2
value_type & operator()(size_t r, size_t c)
this type is used to identify distributed objects.
Definition: algebra_id.h:46