message: adds exec initializer with MPI for common test
diff: @@ -37,6 +37,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  #include <ginkgo/core/base/executor.hpp>
  +#if GINKGO_BUILD_MPI
  +#include <ginkgo/core/base/mpi.hpp>
  +#endif
  +
  +
  #include <memory>
  #include <stdexcept>
  @@ -140,4 +145,62 @@ public:
  };
  +#if GINKGO_BUILD_MPI
  +
  +
  +void init_executor(std::shared_ptr<gko::ReferenceExecutor> ref,
  + std::shared_ptr<gko::ReferenceExecutor>& exec,
  + gko::mpi::communicator comm)
  +{
  + exec = gko::ReferenceExecutor::create();
  +}
  +
  +
  +void init_executor(std::shared_ptr<gko::ReferenceExecutor> ref,
  + std::shared_ptr<gko::OmpExecutor>& exec,
  + gko::mpi::communicator comm)
  +{
  + exec = gko::OmpExecutor::create();
  +}
  +
  +
  +void init_executor(std::shared_ptr<gko::ReferenceExecutor> ref,
  + std::shared_ptr<gko::CudaExecutor>& exec,
  + gko::mpi::communicator comm)
  +{
  + ASSERT_GT(gko::CudaExecutor::get_num_devices(), 0);
  + auto device_id = comm.node_local_rank() % gko::CudaExecutor::get_num_devices();
  + exec = gko::CudaExecutor::create(device_id, ref);
  +}
  +
  +
  +void init_executor(std::shared_ptr<gko::ReferenceExecutor> ref,
  + std::shared_ptr<gko::HipExecutor>& exec,
  + gko::mpi::communicator comm)
  +{
  + ASSERT_GT(gko::HipExecutor::get_num_devices(), 0);
  + auto device_id = comm.node_local_rank() % gko::HipExecutor::get_num_devices();
  + exec = gko::HipExecutor::create(device_id, ref);
  +}
  +
  +
  +void init_executor(std::shared_ptr<gko::ReferenceExecutor> ref,
  + std::shared_ptr<gko::DpcppExecutor>& exec,
  + gko::mpi::communicator comm)
  +{
  + if (gko::DpcppExecutor::get_num_devices("gpu") > 0) {
  + auto device_id = comm.node_local_rank() % gko::DpcppExecutor::get_num_devices("gpu");
  + exec = gko::DpcppExecutor::create(device_id, ref);
  + } else if (gko::DpcppExecutor::get_num_devices("cpu") > 0) {
  + auto device_id = comm.node_local_rank() % gko::DpcppExecutor::get_num_devices("cpu");
  + exec = gko::DpcppExecutor::create(device_id, ref);
  + } else {
  + FAIL() << "No suitable DPC++ devices";
  + }
  +}
  +
  +
  +#endif
  +
  +
  #endif // GKO_TEST_UTILS_EXECUTOR_HPP_
  