This commit is contained in:
Christian Zimmermann 2024-03-27 00:28:32 +01:00
parent c972a9db52
commit e65635cb0e
2 changed files with 47 additions and 0 deletions

View file

@ -191,6 +191,44 @@ namespace CNORXZ
{
return mGeom;
}
SizeT getRankedSize(const RangePtr& r, const RangePtr& x)
{
SizeT rsize = 1;
for(SizeT mu = 0; mu != r->dim(); ++mu){
const RangePtr s = r->sub(mu);
const RangePtr y = x->sub(mu);
if(s->size() > 1){
rsize *= getRankedSize(s,y);
}
else {
}
}
return rsize;
}
template <typename T>
template <class Index1, class Index2>
void RCArray<T>::load(const Sptr<Index1>& i1, const Sptr<Index2>& i2) const
{
const SizeT rsize = getRankedSize(mGeom);
if(mMap.size() != rsize){
mMap.resize(rsize);
}
const SizeT block = ; // size of un-ranked range
Vector<T> sendbuf;
SizeT sendc = 0;
SizeT recvc = 0;
// make src-tar-map!!!
i1->ifor( operation( [](const SizeT ptar, const SizeT psrc) {
const SizeT sendr = psrc/mA.size();
const SizeT recvr = ptar/mA.size();
if(sendr == getRankNumber()) { }
if(recvr == getRankNumber()) { }
}, pos(i1), pos(i2) ) );
// MPI_Sendrecv()!!!
}
} // namespace mpi
} // namespace CNORXZ

View file

@ -109,11 +109,20 @@ namespace CNORXZ
/** Get rank geometry. */
RangePtr geom() const;
/** Load all data from other ranks that is accessed by i2 in a loop over i1.
@param i1 Loop index.
@param i2 Access index.
*/
template <class Index1, class Index2>
void load(const Sptr<Index1>& i1, const Sptr<Index2>& i2) const;
private:
ObjHandle<CArrayBase<T>> mA;
RangePtr mGeom;
RangePtr mGlobal;
mutable Vector<T> mBuf; // data from other ranks
mutable Vector<const T*> mMap; // point to positions in mA or mBuf
};
/** ****