From 7db80fd255fe4e9be85214c2f159316752983330 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Wed, 3 Apr 2024 23:53:53 +0200 Subject: [PATCH] im com --- src/include/ranges/xindex.cc.h | 2 +- src/opt/mpi/include/rrange.cc.h | 2 +- src/opt/mpi/include/rrange.h | 14 +++++--------- src/opt/mpi/tests/rindex_exp.cc | 3 +-- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/include/ranges/xindex.cc.h b/src/include/ranges/xindex.cc.h index f72e7c2..276972f 100644 --- a/src/include/ranges/xindex.cc.h +++ b/src/include/ranges/xindex.cc.h @@ -142,7 +142,7 @@ namespace CNORXZ template UPos XIndex::stepSize(const IndexId<0>& id) const { - return mI->stepSize(id); + return UPos(mI->stepSize(id).val()); } template diff --git a/src/opt/mpi/include/rrange.cc.h b/src/opt/mpi/include/rrange.cc.h index e0111ed..1463ced 100644 --- a/src/opt/mpi/include/rrange.cc.h +++ b/src/opt/mpi/include/rrange.cc.h @@ -205,7 +205,7 @@ namespace CNORXZ template decltype(auto) RIndex::stepSize(const IndexId& id) const { - return getRankStepSize(id) * mI->pmax() + mI->stepSize(id); + return getRankStepSize(id); } template diff --git a/src/opt/mpi/include/rrange.h b/src/opt/mpi/include/rrange.h index 7c2c92f..ed23e38 100644 --- a/src/opt/mpi/include/rrange.h +++ b/src/opt/mpi/include/rrange.h @@ -168,27 +168,23 @@ namespace CNORXZ decltype(auto) getRankStepSize(const IndexId& id) const { auto ss = mI->stepSize(id); - FPos x; - VCHECK(typeid(ss).name()); - VCHECK(typeid(x).name()); - assert(0); if constexpr(std::is_same::value){ - assert(0); if(mRankMap.count(id.id()) != 0){ - return FPos(ss.val(), mRankMap[id.id()].data()); + return FPos(ss.val(), mRankMap[id.id()].data(), ss.max(), ss.max2()); } else { Vector mp(ss.max()); + const SizeT b = mI->pmax().val() / ss.val(); for(SizeT i = 0; i != mp.size(); ++i){ //max2 = num ranks in this dir (preliminary solution)!!! - mp[i] = ( ss.map()[i] / ss.max() ) % ss.max2(); + mp[i] = ( ( ss.map()[i] / ss.max() ) % ss.max2() ) * b + ss.map()[i]; } mRankMap[id.id()] = mp; - return FPos(ss.val(), mp.data()); + return FPos(ss.val(), mp.data(), ss.max(), ss.max2()); } } else { - return SPos<0> {}; + return ss; } } }; diff --git a/src/opt/mpi/tests/rindex_exp.cc b/src/opt/mpi/tests/rindex_exp.cc index 93c4c27..a1a2a35 100644 --- a/src/opt/mpi/tests/rindex_exp.cc +++ b/src/opt/mpi/tests/rindex_exp.cc @@ -74,7 +74,6 @@ namespace decltype(auto) stepSize(const IndexId& id) const { // TODO: new Pos Type!!! - //assert(0); return FPos( mI->stepSize(id).val(), mMap.data(), mI->lmax().val(), mR->lmax().val() ); } @@ -182,7 +181,7 @@ void run2(const Env& env) shift(rgi->local()->pack()[C3], ri->pack()[C3]) ), ri ); VCHECK(srgi->lmax().val()); - + *rgj = 0; while(rgj->rank() != 1){ ++*rgj;