[Dune-devel] [Dune-Commit] [Commit] dune-common - 7fab262: Added methods scatterv, gatherv and allgatherv to collectivecommunication
Oliver Sander
sander at igpm.rwth-aachen.de
Tue Apr 8 07:20:26 CEST 2014
Hi Carsten,
yeah, I screwed that one up. The author is Benjamin Bykowski, and "Convex Function"
is his github name. I suppose there is no way to fix that directly in the git
repository?
Cheers,
Oliver
Am 07.04.2014 22:27, schrieb Carsten Gräser:
> Dear Oliver,
>
> Am 07.04.2014 21:28, schrieb Oliver Sander:
>> New commit, appeared at Mon Apr 7 21:28:15 2014 +0200
>> as part of the following ref changes:
>>
>> branch refs/heads/master updated from cb5be0f -> 7fab262
>>
>> Browsable version: http://cgit.dune-project.org/repositories/dune-common/commit/?id=7fab262f647f4ebc429a12fdd4d0a02dbaa032c7
>>
>> ======================================================================
>>
>> commit 7fab262f647f4ebc429a12fdd4d0a02dbaa032c7
>> Author: Convex Function <329364 at wright.mathepool.rwth-aachen.de>
> that's incredible! This guy's parents must be some really
> dedicated math nerds ;-)
>
> In case the above is not true and in view of the recurring discussion
> about possible relicensing: Could you add the authors real name to
> the contributors list.
>
> Carsten
>
>
>> AuthorDate: Wed Apr 2 09:08:48 2014 +0200
>> Commit: Oliver Sander <sander at igpm.rwth-aachen.de>
>> CommitDate: Mon Apr 7 21:27:51 2014 +0200
>>
>> Added methods scatterv, gatherv and allgatherv to collectivecommunication
>>
>> dune/common/parallel/collectivecommunication.hh | 74 ++++++++++++++++++++++
>> dune/common/parallel/mpicollectivecommunication.hh | 28 ++++++++
>> 2 files changed, 102 insertions(+)
>>
>>
>>
>> diff --git a/dune/common/parallel/collectivecommunication.hh b/dune/common/parallel/collectivecommunication.hh
>> index d3c469a..f4e91d1 100644
>> --- a/dune/common/parallel/collectivecommunication.hh
>> +++ b/dune/common/parallel/collectivecommunication.hh
>> @@ -198,6 +198,32 @@ namespace Dune
>> return 0;
>> }
>>
>> + /** @brief Gather arrays of variable size on root task.
>> + *
>> + * Each process sends its in array of length sendlen to the root process
>> + * (including the root itself). In the root process these arrays are stored in rank
>> + * order in the out array.
>> + * @param[in] in The send buffer with the data to be sent
>> + * @param[in] sendlen The number of elements to send on each task
>> + * @param[out] out The buffer to store the received data in. May have length zero on non-root
>> + * tasks.
>> + * @param[in] recvlen An array with size equal to the number of processes containing the number
>> + * of elements to receive from process i at position i, i.e. the number that
>> + * is passed as sendlen argument to this function in process i.
>> + * May have length zero on non-root tasks.
>> + * @param[in] displ An array with size equal to the number of processes. Data received from
>> + * process i will be written starting at out+displ[i] on the root process.
>> + * May have length zero on non-root tasks.
>> + * @param[out] root The root task that gathers the data.
>> + */
>> + template<typename T>
>> + int gatherv (T* in, int sendlen, T* out, int* recvlen, int* displ, int root) const
>> + {
>> + for (int i=*displ; i<sendlen; i++)
>> + out[i] = in[i];
>> + return 0;
>> + }
>> +
>> /** @brief Scatter array from a root to all other task.
>> *
>> * The root process sends the elements with index from k*len to (k+1)*len-1 in its array to
>> @@ -218,6 +244,31 @@ namespace Dune
>> return 0;
>> }
>>
>> + /** @brief Scatter arrays of variable length from a root to all other tasks.
>> + *
>> + * The root process sends the elements with index from send+displ[k] to send+displ[k]-1 in
>> + * its array to task k, which stores it at index 0 to recvlen-1.
>> + * @param[in] send The array to scatter. May have length zero on non-root
>> + * tasks.
>> + * @param[in] sendlen An array with size equal to the number of processes containing the number
>> + * of elements to scatter to process i at position i, i.e. the number that
>> + * is passed as recvlen argument to this function in process i.
>> + * @param[in] displ An array with size equal to the number of processes. Data scattered to
>> + * process i will be read starting at send+displ[i] on root the process.
>> + * @param[out] recv The buffer to store the received data in. Upon completion of the
>> + * method each task will have the same data stored there as the one in
>> + * send buffer of the root task before.
>> + * @param[in] recvlen The number of elements in the recv buffer.
>> + * @param[out] root The root task that gathers the data.
>> + */
>> + template<typename T>
>> + int scatterv (T* send, int* sendlen, int* displ, T* recv, int recvlen, int root) const
>> + {
>> + for (int i=*displ; i<*sendlen; i++)
>> + recv[i] = send[i];
>> + return 0;
>> + }
>> +
>> /**
>> * @brief Gathers data from all tasks and distribute it to all.
>> *
>> @@ -239,6 +290,29 @@ namespace Dune
>> }
>>
>> /**
>> + * @brief Gathers data of variable length from all tasks and distribute it to all.
>> + *
>> + * The block of data sent from the jth process is received by every
>> + * process and placed in the jth block of the buffer out.
>> + *
>> + * @param[in] in The send buffer with the data to send.
>> + * @param[in] sendlen The number of elements to send on each task.
>> + * @param[out] out The buffer to store the received data in.
>> + * @param[in] recvlen An array with size equal to the number of processes containing the number
>> + * of elements to recieve from process i at position i, i.e. the number that
>> + * is passed as sendlen argument to this function in process i.
>> + * @param[in] displ An array with size equal to the number of processes. Data recieved from
>> + * process i will be written starting at out+displ[i].
>> + */
>> + template<typename T>
>> + int allgatherv (T* in, int sendlen, T* out, int* recvlen, int* displ) const
>> + {
>> + for (int i=*displ; i<sendlen; i++)
>> + out[i] = in[i];
>> + return 0;
>> + }
>> +
>> + /**
>> * @brief Compute something over all processes
>> * for each component of an array and return the result
>> * in every process.
>> diff --git a/dune/common/parallel/mpicollectivecommunication.hh b/dune/common/parallel/mpicollectivecommunication.hh
>> index 7433e19..8b57b53 100644
>> --- a/dune/common/parallel/mpicollectivecommunication.hh
>> +++ b/dune/common/parallel/mpicollectivecommunication.hh
>> @@ -258,6 +258,15 @@ namespace Dune
>> root,communicator);
>> }
>>
>> + //! @copydoc CollectiveCommunication::gatherv()
>> + template<typename T>
>> + int gatherv (T* in, int sendlen, T* out, int* recvlen, int* displ, int root) const
>> + {
>> + return MPI_Gatherv(in,sendlen,MPITraits<T>::getType(),
>> + out,recvlen,displ,MPITraits<T>::getType(),
>> + root,communicator);
>> + }
>> +
>> //! @copydoc CollectiveCommunication::scatter()
>> //! @note out must have space for P*len elements
>> template<typename T>
>> @@ -268,6 +277,16 @@ namespace Dune
>> root,communicator);
>> }
>>
>> + //! @copydoc CollectiveCommunication::scatterv()
>> + template<typename T>
>> + int scatterv (T* send, int* sendlen, int* displ, T* recv, int recvlen, int root) const
>> + {
>> + return MPI_Scatterv(send,sendlen,displ,MPITraits<T>::getType(),
>> + recv,recvlen,MPITraits<T>::getType(),
>> + root,communicator);
>> + }
>> +
>> +
>> operator MPI_Comm () const
>> {
>> return communicator;
>> @@ -282,6 +301,15 @@ namespace Dune
>> communicator);
>> }
>>
>> + //! @copydoc CollectiveCommunication::allgatherv()
>> + template<typename T>
>> + int allgatherv (T* in, int sendlen, T* out, int* recvlen, int* displ) const
>> + {
>> + return MPI_Allgatherv(in,sendlen,MPITraits<T>::getType(),
>> + out,recvlen,displ,MPITraits<T>::getType(),
>> + communicator);
>> + }
>> +
>> //! @copydoc CollectiveCommunication::allreduce(Type* inout,int len) const
>> template<typename BinaryFunction, typename Type>
>> int allreduce(Type* inout, int len) const
>>
>> _______________________________________________
>> Dune-Commit mailing list
>> Dune-Commit at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune-commit
>
> _______________________________________________
> Dune-devel mailing list
> Dune-devel at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 534 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20140408/bf33b200/attachment.sig>
More information about the Dune-devel
mailing list