mpi: rmap: fix bug
This commit is contained in:
parent
8586fa074a
commit
de7ac23f87
3 changed files with 19 additions and 7 deletions
|
@ -36,7 +36,9 @@ namespace CNORXZ
|
||||||
for(six = 0; six != sie; ++six){
|
for(six = 0; six != sie; ++six){
|
||||||
tix.at( f(*six) );
|
tix.at( f(*six) );
|
||||||
if(six.rank() == myrank){
|
if(six.rank() == myrank){
|
||||||
const SizeT idx = (tix.pos() - locsz*tix.rank() + tarsize) % tarsize;
|
//const SizeT idx = (tix.pos() - locsz*tix.rank() + tarsize) % tarsize;
|
||||||
|
const SizeT idx = (tix.pos() - locsz*myrank + tarsize) % tarsize;
|
||||||
|
//const SizeT idx = tix.pos();
|
||||||
(*m)[six.local()->pos()] = idx;
|
(*m)[six.local()->pos()] = idx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +48,9 @@ namespace CNORXZ
|
||||||
<< mapsize << ", expected " << six.pmax().val());
|
<< mapsize << ", expected " << six.pmax().val());
|
||||||
for(six = 0; six != sie; ++six){
|
for(six = 0; six != sie; ++six){
|
||||||
tix.at( f(*six) );
|
tix.at( f(*six) );
|
||||||
const SizeT idx = (tix.pos() - locsz*tix.rank() + tarsize) % tarsize;
|
//const SizeT idx = (tix.pos() - locsz*tix.rank() + tarsize) % tarsize;
|
||||||
|
const SizeT idx = (tix.pos() - locsz*myrank + tarsize) % tarsize;
|
||||||
|
//const SizeT idx = tix.pos()
|
||||||
(*m)[six.pos()] = idx;
|
(*m)[six.pos()] = idx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace CNORXZ
|
||||||
template <class TarI, class RTarI, class SrcIndex, class F>
|
template <class TarI, class RTarI, class SrcIndex, class F>
|
||||||
struct MapSetup<mpi::RIndex<TarI,RTarI>,SrcIndex,F>
|
struct MapSetup<mpi::RIndex<TarI,RTarI>,SrcIndex,F>
|
||||||
{
|
{
|
||||||
|
// CAUTION: This needs to be aware of entire geometry!!!
|
||||||
static void setup(const Sptr<mpi::RIndex<TarI,RTarI>>& ti,
|
static void setup(const Sptr<mpi::RIndex<TarI,RTarI>>& ti,
|
||||||
const Sptr<SrcIndex>& si,
|
const Sptr<SrcIndex>& si,
|
||||||
const F& f, const Sptr<Vector<SizeT>>& m);
|
const F& f, const Sptr<Vector<SizeT>>& m);
|
||||||
|
|
|
@ -57,11 +57,12 @@ namespace
|
||||||
mMRange = ltr*ll1r*ll2r*ll3r*scr;
|
mMRange = ltr*ll1r*ll2r*ll3r*scr;
|
||||||
Vector<Double> data(mMRange->size());
|
Vector<Double> data(mMRange->size());
|
||||||
Vector<Double> data2(mMRange->size());
|
Vector<Double> data2(mMRange->size());
|
||||||
|
Double xxx = 1;
|
||||||
for(SizeT i = 0; i != mRXRange->sub(1)->size(); ++i){
|
for(SizeT i = 0; i != mRXRange->sub(1)->size(); ++i){
|
||||||
for(SizeT j = 0; j != scr->size(); ++j){
|
for(SizeT j = 0; j != scr->size(); ++j){
|
||||||
const SizeT k = i*scr->size() + j;
|
const SizeT k = i*scr->size() + j;
|
||||||
data[k] = vec[i] * static_cast<Double>(j+2);
|
data[k] = vec[i] * static_cast<Double>(j+2) + (xxx += 3*mpi::getRankNumber());
|
||||||
data2[k] = vec[i] / static_cast<Double>(j+2);
|
data2[k] = vec[i] / static_cast<Double>(j+2) + (xxx += 5*mpi::getRankNumber());
|
||||||
if(k > 0){
|
if(k > 0){
|
||||||
assert(data[k] != data[k-1]);
|
assert(data[k] != data[k-1]);
|
||||||
}
|
}
|
||||||
|
@ -108,6 +109,12 @@ namespace
|
||||||
TEST_F(ROp_Test, Check)
|
TEST_F(ROp_Test, Check)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(mM1.size(), mM2.size());
|
EXPECT_EQ(mM1.size(), mM2.size());
|
||||||
|
EXPECT_EQ(mM1.size(), mAll1.size());
|
||||||
|
for(auto i = mM1.begin(); i.lex() != i.lmax().val(); ++i){
|
||||||
|
const auto a1 = *i;
|
||||||
|
const auto a2 = mAll1[i.lex()];
|
||||||
|
EXPECT_EQ(a1, a2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ROp_Test, Difference)
|
TEST_F(ROp_Test, Difference)
|
||||||
|
@ -131,7 +138,7 @@ namespace
|
||||||
(std::get<2>(vec)+1)%L, (std::get<3>(vec)+1)%L); } );
|
(std::get<2>(vec)+1)%L, (std::get<3>(vec)+1)%L); } );
|
||||||
Vector<bool> req(xp->range()->size(), false);
|
Vector<bool> req(xp->range()->size(), false);
|
||||||
for(const auto& r: *imap1){
|
for(const auto& r: *imap1){
|
||||||
req[r] = true;
|
req[(r+mpi::getRankNumber()*16*12*12*12/4)%req.size()] = true;
|
||||||
}
|
}
|
||||||
res.load(x, AB, req); // DUMMY, not used...
|
res.load(x, AB, req); // DUMMY, not used...
|
||||||
mM1.load(xp, AB, req);
|
mM1.load(xp, AB, req);
|
||||||
|
|
Loading…
Reference in a new issue