From 3e28c654ba9012dc2f41453836dd5a3261271d80 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 10 Mar 2020 22:14:27 +0100 Subject: [PATCH] WIP --- src/ParaMEDMEM/CommInterface.hxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/ParaMEDMEM/CommInterface.hxx b/src/ParaMEDMEM/CommInterface.hxx index 32ff28dde..9d96cde93 100644 --- a/src/ParaMEDMEM/CommInterface.hxx +++ b/src/ParaMEDMEM/CommInterface.hxx @@ -20,6 +20,7 @@ #pragma once #include "ParaIdType.hxx" +#include "MEDCouplingMemArray.hxx" #include @@ -93,6 +94,25 @@ namespace MEDCoupling MPI_Op op, int root, MPI_Comm comm) const { return MPI_Reduce(sendbuf, recvbuf, count, datatype, op, root, comm); } int allReduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) const { return MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm); } public: + + /*! + * \a counts is expected to be an array of array length. This method returns an array of split array. + */ + static std::unique_ptr SplitArrayOfLength(const std::unique_ptr& counts, std::size_t countsSz, int rk, int size) + { + std::unique_ptr ret(new mcIdType[countsSz]); + for(std::size_t i=0;i static std::unique_ptr ToIntArray(const std::unique_ptr& arr, std::size_t size) { @@ -100,6 +120,10 @@ namespace MEDCoupling std::copy(arr.get(),arr.get()+size,ret.get()); return ret; } + + /*! + * Helper of alltoallv and allgatherv + */ static std::unique_ptr ComputeOffset(const std::unique_ptr& counts, std::size_t sizeOfCounts) { std::unique_ptr ret(new int[sizeOfCounts]); -- 2.39.2