mpi: WIP: add rank acc xpr

This commit is contained in:
Christian Zimmermann 2024-10-15 10:51:23 -07:00
parent ce5c3a25b1
commit e36b9bc6fd
2 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,46 @@
#ifndef __cxz_mpi_racc_xpr_cc_h__
#define __cxz_mpi_racc_xpr_cc_h__
#include "racc_xpr.h"
namespace CNOXRZ
{
namespace mpi
{
template <SizeT L, class Xpr, class F = NoF>
constexpr RankAccXpr<L,Xpr,F>::RankAccXpr(SizeT size, const IndexId<L>& id,
const Xpr& xpr, F&& f) :
{}
template <SizeT L, class Xpr, class F = NoF>
template <class PosT>
inline decltype(auto) RankAccXpr<L,Xpr,F>::operator()(const PosT& last) const
{
}
template <SizeT L, class Xpr, class F = NoF>
inline decltype(auto) RankAccXpr<L,Xpr,F>::operator()() const
{
}
template <SizeT L, class Xpr, class F = NoF>
template <SizeT I>
inline decltype(auto) RankAccXpr<L,Xpr,F>::rootSteps(const IndexId<I>& id) const
{
}
template <SizeT L, class Xpr, class F = NoF>
constexpr decltype(auto) rankaccxpr(SizeT size, const IndexId<L>& id,
const Xpr& xpr, F&& f)
{
return RankAccXpr<L,Xpr,F>(size, id, xpr, std::forward<F>(f));
}
}
}
#endif

View file

@ -0,0 +1,45 @@
// rank access expression, fix rank position to current rank
#ifndef __cxz_mpi_racc_xpr_h__
#define __cxz_mpi_racc_xpr_h__
#include "mpi_base.h"
namespace CNORXZ
{
namespace mpi
{
template <SizeT L, class Xpr, class F = NoF>
class RankAccXpr : public XprInterface<RankAccXpr<L,Xpr,F>>
{
public:
DEFAULT_MEMBERS(RankAccXpr);
constexpr RankAccXpr(SizeT size, const IndexId<L>& id, const Xpr& xpr, F&& f);
template <class PosT>
inline decltype(auto) operator()(const PosT& last) const;
inline decltype(auto) operator()() const;
template <SizeT I>
inline decltype(auto) rootSteps(const IndexId<I>& id) const;
private:
SizeT mSize = 0;
IndexId<L> mId;
Xpr mXpr;
typedef decltype(mXpr.rootSteps(mId)) XPosT;
XPosT mExt;
F mF;
};
template <SizeT L, class Xpr, class F = NoF>
constexpr decltype(auto) rankaccxpr(SizeT size, const IndexId<L>& id,
const Xpr& xpr, F&& f);
}
}
#endif