\doxysection{collective\+\_\+communicator.\+hpp}
\hypertarget{collective__communicator_8hpp_source}{}\label{collective__communicator_8hpp_source}\index{ginkgo/core/distributed/collective\_communicator.hpp@{ginkgo/core/distributed/collective\_communicator.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ SPDX-\/FileCopyrightText:\ 2017\ -\/\ 2025\ The\ Ginkgo\ authors}}
\DoxyCodeLine{00002\ \textcolor{comment}{//}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ SPDX-\/License-\/Identifier:\ BSD-\/3-\/Clause}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#ifndef\ GKO\_PUBLIC\_CORE\_DISTRIBUTED\_COLLECTIVE\_COMMUNICATOR\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_DISTRIBUTED\_COLLECTIVE\_COMMUNICATOR\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <ginkgo/config.hpp>}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#if\ GINKGO\_BUILD\_MPI}}
\DoxyCodeLine{00013\ }
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#include\ <variant>}}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/mpi.hpp>}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#include\ <ginkgo/core/distributed/index\_map.hpp>}}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00021\ \textcolor{keyword}{namespace\ }experimental\ \{}
\DoxyCodeLine{00022\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko_1_1experimental_1_1mpi}{mpi}}\ \{}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00031\ \textcolor{keyword}{class\ }CollectiveCommunicator\ \{}
\DoxyCodeLine{00032\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00036\ \ \ \ \ \textcolor{keyword}{using\ }\doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1CollectiveCommunicator_a4eb0fac1710fca957997116855df756e}{index\_map\_ptr}}\ =}
\DoxyCodeLine{00037\ \ \ \ \ \ \ \ \ std::variant<const\ distributed::index\_map<int32,\ int32>*,}
\DoxyCodeLine{00038\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1distributed_1_1index__map}{distributed::index\_map<int32,\ int64>}}*,}
\DoxyCodeLine{00039\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1distributed_1_1index__map}{distributed::index\_map<int64,\ int64>}}*>;}
\DoxyCodeLine{00040\ }
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keyword}{virtual}\ \string~CollectiveCommunicator()\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keyword}{explicit}\ CollectiveCommunicator(\doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1communicator}{communicator}}\ base\ =\ MPI\_COMM\_NULL);}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ \ \ \ \ [[nodiscard]]\ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1communicator}{communicator}}\&\ get\_base\_communicator()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00046\ }
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ SendType,\ \textcolor{keyword}{typename}\ RecvType>}
\DoxyCodeLine{00064\ \ \ \ \ [[nodiscard]]\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1request}{request}}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1CollectiveCommunicator_a94f644ab6d92ef607f82de7092a56056}{i\_all\_to\_all\_v}}(std::shared\_ptr<const\ Executor>\ exec,}
\DoxyCodeLine{00065\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ SendType*\ send\_buffer,}
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ RecvType*\ recv\_buffer)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00072\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1request}{request}}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1CollectiveCommunicator_a8be792dac2b7d4df3f1524bbf0b5e625}{i\_all\_to\_all\_v}}(std::shared\_ptr<const\ Executor>\ exec,}
\DoxyCodeLine{00073\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{void}*\ send\_buffer,\ MPI\_Datatype\ send\_type,}
\DoxyCodeLine{00074\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}*\ recv\_buffer,\ MPI\_Datatype\ recv\_type)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00084\ \ \ \ \ [[nodiscard]]\ \textcolor{keyword}{virtual}\ std::unique\_ptr<CollectiveCommunicator>}
\DoxyCodeLine{00085\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1CollectiveCommunicator_a9a457e816f13e1c1f26c45123a97f0c6}{create\_with\_same\_type}}(\doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1communicator}{communicator}}\ base,\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1CollectiveCommunicator_a4eb0fac1710fca957997116855df756e}{index\_map\_ptr}}\ imap)\ \textcolor{keyword}{const}\ =\ 0;}
\DoxyCodeLine{00086\ }
\DoxyCodeLine{00094\ \ \ \ \ [[nodiscard]]\ \textcolor{keyword}{virtual}\ std::unique\_ptr<CollectiveCommunicator>}
\DoxyCodeLine{00095\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1CollectiveCommunicator_a721c058409fffd021cd31aab1ed9279b}{create\_inverse}}()\ \textcolor{keyword}{const}\ =\ 0;}
\DoxyCodeLine{00096\ }
\DoxyCodeLine{00103\ \ \ \ \ [[nodiscard]]\ \textcolor{keyword}{virtual}\ \doxymbox{\hyperlink{namespacegko_1_1experimental_1_1mpi_a13b7760affb031fee59d385754eaaffb}{comm\_index\_type}}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1CollectiveCommunicator_a77b426c85c3cdada3cd3936c7e5e1e19}{get\_recv\_size}}()\ \textcolor{keyword}{const}\ =\ 0;}
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00111\ \ \ \ \ [[nodiscard]]\ \textcolor{keyword}{virtual}\ \doxymbox{\hyperlink{namespacegko_1_1experimental_1_1mpi_a13b7760affb031fee59d385754eaaffb}{comm\_index\_type}}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1CollectiveCommunicator_ad96f20bbe51b403a08819f27d3be53bf}{get\_send\_size}}()\ \textcolor{keyword}{const}\ =\ 0;}
\DoxyCodeLine{00112\ }
\DoxyCodeLine{00113\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00114\ \ \ \ \ \textcolor{keyword}{virtual}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1request}{request}}\ i\_all\_to\_all\_v\_impl(std::shared\_ptr<const\ Executor>\ exec,}
\DoxyCodeLine{00115\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{void}*\ send\_buffer,}
\DoxyCodeLine{00116\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ MPI\_Datatype\ send\_type,}
\DoxyCodeLine{00117\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}*\ recv\_buffer,}
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ MPI\_Datatype\ recv\_type)\ \textcolor{keyword}{const}\ =\ 0;}
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00120\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00121\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1communicator}{communicator}}\ base\_;}
\DoxyCodeLine{00122\ \};}
\DoxyCodeLine{00123\ }
\DoxyCodeLine{00124\ }
\DoxyCodeLine{00125\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ SendType,\ \textcolor{keyword}{typename}\ RecvType>}
\DoxyCodeLine{00126\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1request}{request}}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1CollectiveCommunicator_a94f644ab6d92ef607f82de7092a56056}{CollectiveCommunicator::i\_all\_to\_all\_v}}(}
\DoxyCodeLine{00127\ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec,\ \textcolor{keyword}{const}\ SendType*\ send\_buffer,}
\DoxyCodeLine{00128\ \ \ \ \ RecvType*\ recv\_buffer)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00129\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00130\ \ \ \ \ \textcolor{keywordflow}{return}\ this-\/>\doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1CollectiveCommunicator_a94f644ab6d92ef607f82de7092a56056}{i\_all\_to\_all\_v}}(std::move(exec),\ send\_buffer,}
\DoxyCodeLine{00131\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1experimental_1_1mpi_1_1type__impl}{type\_impl<SendType>::get\_type}}(),\ recv\_buffer,}
\DoxyCodeLine{00132\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1experimental_1_1mpi_1_1type__impl}{type\_impl<RecvType>::get\_type}}());}
\DoxyCodeLine{00133\ \}}
\DoxyCodeLine{00134\ }
\DoxyCodeLine{00135\ }
\DoxyCodeLine{00136\ \textcolor{keyword}{namespace\ }detail\ \{}
\DoxyCodeLine{00137\ }
\DoxyCodeLine{00138\ }
\DoxyCodeLine{00147\ std::shared\_ptr<CollectiveCommunicator>\ create\_default\_collective\_communicator(}
\DoxyCodeLine{00148\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1experimental_1_1mpi_1_1communicator}{communicator}}\ base);}
\DoxyCodeLine{00149\ }
\DoxyCodeLine{00150\ }
\DoxyCodeLine{00151\ \}\ \ \textcolor{comment}{//\ namespace\ detail}}
\DoxyCodeLine{00152\ \}\ \ \textcolor{comment}{//\ namespace\ mpi}}
\DoxyCodeLine{00153\ \}\ \ \textcolor{comment}{//\ namespace\ experimental}}
\DoxyCodeLine{00154\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00155\ }
\DoxyCodeLine{00156\ }
\DoxyCodeLine{00157\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00158\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_DISTRIBUTED\_COLLECTIVE\_COMMUNICATOR\_HPP\_}}

\end{DoxyCode}
