diff --git a/CMakeLists.txt b/CMakeLists.txt index 0820db9487..7e7f363f88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ endif (__GIT_EXECUTABLE) # This must be set because version tags set(HYDROGEN_VERSION_MAJOR 1) set(HYDROGEN_VERSION_MINOR 3) -set(HYDROGEN_VERSION_PATCH 0) +set(HYDROGEN_VERSION_PATCH 1) set(HYDROGEN_VERSION_MAJOR_MINOR "${HYDROGEN_VERSION_MAJOR}.${HYDROGEN_VERSION_MINOR}") set(HYDROGEN_VERSION diff --git a/include/El/blas_like/level1/Copy.hpp b/include/El/blas_like/level1/Copy.hpp index 9ea36383ab..af5d8c0240 100644 --- a/include/El/blas_like/level1/Copy.hpp +++ b/include/El/blas_like/level1/Copy.hpp @@ -26,54 +26,91 @@ using Expand = TypeList...>; // This is replaced by a generic multiple dispatch engine in // DiHydrogen; this is a one-off use-case for now, so there's no need // to backport a robust implementation. -template -struct BaseCopy +template +struct CopyDispatcher { - static void Do(BaseDistMatrix const& src, BaseDistMatrix& tgt) + static void Do(FunctorT f, + BaseDistMatrix const& src, BaseDistMatrix& tgt) { using LHead = Head; using LTail = Tail; if (auto const* ptr = dynamic_cast(&src)) - return BaseCopy::DoRHS(*ptr, tgt); + return CopyDispatcher::DoRHS( + f, *ptr, tgt); else - return BaseCopy::Do(src, tgt); + return CopyDispatcher::Do(f, src, tgt); } template - static void DoRHS(LHSType const& src, BaseDistMatrix& tgt) + static void DoRHS(FunctorT f, LHSType const& src, BaseDistMatrix& tgt) { using RHead = Head; using RTail = Tail; if (auto* ptr = dynamic_cast(&tgt)) - return Copy(src, *ptr); + return f(src, *ptr); else - return BaseCopy::DoRHS(src, tgt); + return CopyDispatcher::DoRHS(f, src, tgt); } -}; +};// struct CopyDispatcher -template -struct BaseCopy, RHSList> +template +struct CopyDispatcher, RHSList> { - static void Do(BaseDistMatrix const& src, BaseDistMatrix& tgt) + static void Do(FunctorT const&, + BaseDistMatrix const&, BaseDistMatrix const&) { LogicError("Source matrix type not found."); } }; -template -struct BaseCopy> +template +struct CopyDispatcher> { - static void DoRHS(BaseDistMatrix const& src, BaseDistMatrix& tgt) + static void DoRHS(FunctorT const&, + BaseDistMatrix const&, BaseDistMatrix const&) { LogicError("Target matrix type not found."); } }; +struct CopyFunctor +{ + template + void operator()(AbstractDistMatrix const& src, + AbstractDistMatrix& tgt) const + { + return Copy(src, tgt); + } +};// CopyFunctor + +struct CopyAsyncFunctor +{ + template + void operator()(AbstractDistMatrix const& src, + AbstractDistMatrix& tgt) const + { + return CopyAsync(src, tgt); + } +};// CopyAsyncFunctor + }// namespace details + inline void Copy(BaseDistMatrix const& Source, BaseDistMatrix& Target) { + using FunctorT = details::CopyFunctor; + using MatrixTs = details::Expand; + using Dispatcher = details::CopyDispatcher; + details::CopyFunctor f; + return Dispatcher::Do(f, Source, Target); +} + +inline void CopyAsync(BaseDistMatrix const& Source, BaseDistMatrix& Target) +{ + using FunctorT = details::CopyAsyncFunctor; using MatrixTs = details::Expand; - return details::BaseCopy::Do(Source, Target); + using Dispatcher = details::CopyDispatcher; + details::CopyAsyncFunctor f; + return Dispatcher::Do(f, Source, Target); } template