mpi rarray load

This commit is contained in:
Christian Zimmermann 2024-04-18 12:14:56 +02:00
parent 6e16927442
commit 0cc0a7cea4
3 changed files with 28 additions and 27 deletions

View file

@ -149,6 +149,19 @@ namespace CNORXZ
/** check if container views the data, i.e. it does not own it */ /** check if container views the data, i.e. it does not own it */
virtual bool isView() const = 0; virtual bool isView() const = 0;
/** Perform compatibility checks
@tparam Acc index type or index pack type
@param acc index or index pack.
*/
template <class Acc>
void checkFormatCompatibility(const Acc& acc) const;
/** check if format is trivial
@return true if container is data owning array, else return
result of the corresponding container index
*/
virtual bool formatIsTrivial() const = 0;
protected: protected:
RangePtr mRange; /**< the container range */ RangePtr mRange; /**< the container range */
@ -171,18 +184,6 @@ namespace CNORXZ
template <class Acc> template <class Acc>
const_iterator itLexSave(const Acc& acc) const; const_iterator itLexSave(const Acc& acc) const;
/** Perform compatibility checks
@tparam Acc index type or index pack type
@param acc index or index pack.
*/
template <class Acc>
void checkFormatCompatibility(const Acc& acc) const;
/** check if format is trivial
@return true if container is data owning array, else return
result of the corresponding container index
*/
virtual bool formatIsTrivial() const = 0;
}; };
/** **** /** ****

View file

@ -221,14 +221,13 @@ namespace CNORXZ
} }
template <typename T> template <typename T>
template <class Index1, class Index2> template <class TarI, class RTarI, class SrcI, class RSrcI, class I>
void RCArray<T>::load(const Sptr<Index1>& lpi, const Sptr<Index2>& ai, void RCArray<T>::load(const Sptr<RIndex<TarI,RTarI>>& lpi, const Sptr<RIndex<SrcI,RSrcI>>& ai,
const Sptr<Vector<SizeT>>& imap) const const Sptr<I>& i, const Sptr<Vector<SizeT>>& imap) const
{ {
// TODO: blocks!!! mA->checkFormatCompatibility(ai->local()*i);
const SizeT blocks = 0; assert(0); // TODO!!! const SizeT blocks = i->pmax().val();
setupBuffer(lpi, ai, imap, *mA, mBuf, mMap, blocks);
setupBuffer(ai, lpi, imap, *mA, mBuf, mMap, blocks);
} }
template <typename T> template <typename T>
@ -242,7 +241,7 @@ namespace CNORXZ
} }
template <class TarI, class RTarI, class SrcI, class RSrcI, typename T> template <class TarI, class RTarI, class SrcI, class RSrcI, typename T>
void setupBuffer(const Sptr<RIndex<TarI,RTarI>>& rgj, const Sptr<RIndex<SrcI,RSrcI>>& rgi, void setupBuffer(const Sptr<RIndex<TarI,RTarI>>& rgi, const Sptr<RIndex<SrcI,RSrcI>>& rgj,
const Sptr<Vector<SizeT>>& imap, const CArrayBase<T>& data, const Sptr<Vector<SizeT>>& imap, const CArrayBase<T>& data,
Vector<T>& buf, Vector<const T*>& map, const SizeT blocks) Vector<T>& buf, Vector<const T*>& map, const SizeT blocks)
{ {

View file

@ -117,15 +117,16 @@ namespace CNORXZ
*/ */
const Vector<const T*> buffermap() const; const Vector<const T*> buffermap() const;
/** Load all data from other ranks that is accessed by i2 in a loop over i1. /** Load all data from other ranks that is accessed by ai in a loop over lpi.
imap indicates the position of i2 for a given position of i1. imap indicates the global (!) position of ai for a given (local) position of lpi.
@param lpi Loop index. @param lpi Loop rank index.
@param ai Access index. @param ai Access rank index.
@param i Index for non-ranked dimensions.
@param imap Index position map. @param imap Index position map.
*/ */
template <class Index1, class Index2> template <class TarI, class RTarI, class SrcI, class RSrcI, class I>
void load(const Sptr<Index1>& lpi, const Sptr<Index2>& ai, void load(const Sptr<RIndex<TarI,RTarI>>& lpi, const Sptr<RIndex<SrcI,RSrcI>>& ai,
const Sptr<Vector<SizeT>>& imap) const; const Sptr<I>& i, const Sptr<Vector<SizeT>>& imap) const;
/** Load all data from other ranks that is accessed by f(i). /** Load all data from other ranks that is accessed by f(i).
@param lpi Loop index. @param lpi Loop index.