fixes + rrange/rindex: remove constraint geo-extension == nranks
This commit is contained in:
parent
d3358d71d6
commit
8586fa074a
5 changed files with 36 additions and 16 deletions
|
@ -69,12 +69,17 @@ namespace CNORXZ
|
|||
{
|
||||
const String blim = "(";
|
||||
const String elim = ")";
|
||||
const String dlim = ",";
|
||||
return iter<1,sizeof...(Ts)>
|
||||
( [&](auto i) { return toString(std::get<i>(t)); },
|
||||
[&](const auto&... xs) {
|
||||
return blim + toString(std::get<0>(t)) + ( (dlim + xs) + ... ) + elim;
|
||||
} );
|
||||
if constexpr(sizeof...(Ts) == 1){
|
||||
return blim + toString(std::get<0>(t)) + elim;
|
||||
}
|
||||
else {
|
||||
const String dlim = ",";
|
||||
return iter<1,sizeof...(Ts)>
|
||||
( [&](auto i) { return toString(std::get<i>(t)); },
|
||||
[&](const auto&... xs) {
|
||||
return blim + toString(std::get<0>(t)) + ( (dlim + xs) + ... ) + elim;
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
|
|
|
@ -145,6 +145,12 @@ namespace CNORXZ
|
|||
return Concat<T1,T2>::cat(a1, a2);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
decltype(auto) concat(const T& a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
template <typename T1, typename T2, typename... Ts>
|
||||
decltype(auto) concat(const T1& a1, const T2& a2, const Ts&... as)
|
||||
{
|
||||
|
|
|
@ -61,14 +61,16 @@ namespace CNORXZ
|
|||
RAIndex<T> RAIndex<T>::operator+(Int n) const
|
||||
{
|
||||
RAIndex<T> o = *this;
|
||||
return o += n;
|
||||
o += n;
|
||||
return o;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
RAIndex<T> RAIndex<T>::operator-(Int n) const
|
||||
{
|
||||
RAIndex<T> o = *this;
|
||||
return o -= n;
|
||||
o -= n;
|
||||
return o;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -29,7 +29,8 @@ namespace CNORXZ
|
|||
RIndex<IndexI,IndexK>::RIndex(const RIndex& in) :
|
||||
mRange(in.mRange),
|
||||
mI(std::make_shared<IndexI>(mRange->local())),
|
||||
mK(std::make_shared<IndexK>(mRange->geom()))
|
||||
mK(std::make_shared<IndexK>(mRange->geom())),
|
||||
mNRanks(getNumRanks())
|
||||
{
|
||||
*this = in.lex();
|
||||
}
|
||||
|
@ -40,6 +41,7 @@ namespace CNORXZ
|
|||
mRange = in.mRange;
|
||||
mI = std::make_shared<IndexI>(mRange->local());
|
||||
mK = std::make_shared<IndexK>(mRange->geom());
|
||||
mNRanks = getNumRanks();
|
||||
*this = in.lex();
|
||||
return *this;
|
||||
}
|
||||
|
@ -48,7 +50,8 @@ namespace CNORXZ
|
|||
RIndex<IndexI,IndexK>::RIndex(const RangePtr& global, SizeT lexpos) :
|
||||
mRange(rangeCast<RangeType>(global)),
|
||||
mI(std::make_shared<IndexI>(mRange->local())),
|
||||
mK(std::make_shared<IndexK>(mRange->geom()))
|
||||
mK(std::make_shared<IndexK>(mRange->geom())),
|
||||
mNRanks(getNumRanks())
|
||||
{
|
||||
*this = lexpos;
|
||||
}
|
||||
|
@ -57,7 +60,8 @@ namespace CNORXZ
|
|||
RIndex<IndexI,IndexK>::RIndex(const Sptr<IndexI>& i, const Sptr<IndexK>& k) :
|
||||
mRange(rangeCast<RangeType>( RRangeFactory(i->range(), k->range()).create() )),
|
||||
mI(i),
|
||||
mK(k)
|
||||
mK(k),
|
||||
mNRanks(getNumRanks())
|
||||
{
|
||||
(*this)();
|
||||
}
|
||||
|
@ -264,7 +268,7 @@ namespace CNORXZ
|
|||
{
|
||||
mI->at(metaPos);
|
||||
const size_t lex = mI->lex();
|
||||
Vector<size_t> lexs(mK->lmax().val());
|
||||
Vector<size_t> lexs(mNRanks);
|
||||
MPI_Allgather(&lex, 1, MPI_UNSIGNED_LONG, lexs.data(), 1, MPI_UNSIGNED_LONG,
|
||||
MPI_COMM_WORLD);
|
||||
SizeT root = 0;
|
||||
|
@ -418,9 +422,12 @@ namespace CNORXZ
|
|||
{
|
||||
int s = 0;
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &s);
|
||||
CXZ_ASSERT(rk->size() == static_cast<SizeT>(s),
|
||||
"geometry rank size ( = " << rk->size()
|
||||
<< ") does not match number of ranks ( = " << s << ")");
|
||||
//CXZ_ASSERT(rk->size() == static_cast<SizeT>(s),
|
||||
// "geometry rank size ( = " << rk->size()
|
||||
// << ") does not match number of ranks ( = " << s << ")");
|
||||
CXZ_ASSERT(static_cast<SizeT>(s) % rk->size() == 0,
|
||||
"geometry dimension (" << rk->size()
|
||||
<< ") does not divide number of ranks (" << s << ")");
|
||||
if constexpr(has_static_sub<typename RangeI::IndexType>::value and
|
||||
has_static_sub<typename RangeK::IndexType>::value) {
|
||||
constexpr SizeT NRI = RangeI::NR;
|
||||
|
|
|
@ -164,7 +164,7 @@ namespace CNORXZ
|
|||
Sptr<RangeType> mRange; /**< RRange. */
|
||||
Sptr<IndexI> mI; /**< Index on the local range of the THIS rank. */
|
||||
Sptr<IndexK> mK; /**< Multi-index indicating the current rank. */
|
||||
|
||||
SizeT mNRanks; /**< Number of ranks; in general different from but dividable by mK's maximum. */
|
||||
};
|
||||
|
||||
template <class IndexI, class IndexK>
|
||||
|
|
Loading…
Reference in a new issue