Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::ITransferValuesParallelOperation Class Referenceabstract

Sends values across different processors. More...

#include <arcane/core/ITransferValuesParallelOperation.h>

Public Member Functions

virtual ~ITransferValuesParallelOperation ()=default
 Destructor.
virtual IParallelMngparallelMng ()=0
 Associated parallelism manager.
virtual void setTransferRanks (Int32ConstArrayView ranks)=0
 Positions the array indicating who to send the values to.
virtual void addArray (Int32ConstArrayView send_values, SharedArray< Int32 > recv_value)=0
 Adds an array of Int32.
virtual void addArray (Int64ConstArrayView send_values, SharedArray< Int64 > recv_values)=0
 Adds an array of Int64.
virtual void addArray (RealConstArrayView send_values, SharedArray< Real > recv_values)=0
 Adds an array of Int64.
virtual void transferValues ()=0
 Sends and receives values.

Detailed Description

Sends values across different processors.

This operation allows values to be communicated with other processors. The array ranks indicates for each element the rank of the processor it is intended for. It is then possible to specify arrays containing the values to send and to receive. The send arrays must have the same number of elements as ranks

An instance is used only once. Once the transfer is complete, it can be destroyed.

For example, for a case with 3 processors:

// Processor of rank 0:
ranks.add(2); // Sends to rank 2
ranks.add(1); // Sends to rank 1
ranks.add(1); // Sends to rank 1
values_1.add(5); // Sends 5 to rank 2 (ranks[0])
values_1.add(7); // Sends 7 to rank 1 (ranks[1])
values_1.add(6); // Sends 6 to rank 1 (ranks[2])
values_2.add(-5); // Sends -5 to rank 2 (ranks[0])
values_2.add(-7); // Sends -7 to rank 1 (ranks[1])
values_2.add(-6); // Sends -6 to rank 1 (ranks[2])
// Processor of rank 1:
ranks.add(0); // Sends to rank 0
ranks.add(2); // Sends to rank 2
values_1.add(1); // Sends 1 to rank 0 (ranks[0])
values_1.add(3); // Sends 3 to rank 2 (ranks[1])
values_2.add(23); // Sends 23 to rank 0 (ranks[0])
values_2.add(24); // Sends 24 to rank 2 (ranks[1])
// Processor of rank 2:
ranks.add(0); // Sends to rank 0
ranks.add(0); // Sends to rank 0
values_1.add(0); // Sends 1 to rank 0 (ranks[0])
values_1.add(4); // Sends 3 to rank 0 (ranks[1])
values_2.add(-1); // Sends -1 to rank 0 (ranks[0])
values_2.add(4); // Sends 4 to rank 0 (ranks[1])
void add(ConstReferenceType val)
Adds element val to the end of the array.
UniqueArray< Int64 > Int64UniqueArray
Dynamic 1D array of 64-bit integers.
Definition UtilsTypes.h:339
UniqueArray< Int32 > Int32UniqueArray
Dynamic 1D array of 32-bit integers.
Definition UtilsTypes.h:341

To perform the transfer

Int32UniqueArray recv_values_1;
Int64UniqueArray recv_values_2;
op->setTransferRanks(ranks);
op->addArray(values_1,recv_values_1);
op->addArray(values_2,recv_values_2);
op->transferValues();

After sending, processor of rank 0 will have the following values:

recv_values_1[0] == 1; // sent by rank 1
recv_values_1[1] == 0; // sent by rank 2
recv_values_1[2] == 4; // sent by rank 2
recv_values_2[0] == 23; // sent by rank 1
recv_values_2[1] == -1; // sent by rank 2
recv_values_2[2] == 4; // sent by rank 2

Note that the order of elements is undetermined

Definition at line 105 of file ITransferValuesParallelOperation.h.

Member Function Documentation

◆ transferValues()

virtual void Arcane::ITransferValuesParallelOperation::transferValues ( )
pure virtual

Sends and receives values.

This call is collective and blocking.


The documentation for this class was generated from the following file: