Interface ICommunicator
Namespace: Microsoft.ML.Probabilistic
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
public interface ICommunicator
Properties
PercentTimeSpentWaiting
Declaration
double PercentTimeSpentWaiting { get; }
Property Value
| Type | Description |
|---|---|
| Double |
Rank
Identifies the currently executing process within this communicator.
Declaration
int Rank { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Size
The number of processes within this communicator.
Declaration
int Size { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Methods
Allreduce<T>(T, Func<T, T, T>)
Allreduce is a collective algorithm that combines the values stored by each process into a
single value available to all processes. The values are combined in a user-defined way, specified via
a delegate. If value1, value2, ..., valueN are the values provided by the
N processes in the communicator, the result will be the value value1 op value2 op ... op valueN.
An Allreduce is equivalent to a Reduce<T>(T, MPI.ReductionOperation<T>, int)
followed by a Broadcast<T>(ref T, int)
Declaration
T Allreduce<T>(T value, Func<T, T, T> op)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The local value that will be combined with the values provided by other processes. |
| Func<T, T, T> | op | The operation used to combine two values. This operation must be associative. |
Returns
| Type | Description |
|---|---|
| T | The result of the reduction. The same value will be returned to all processes. |
Type Parameters
| Name | Description |
|---|---|
| T | Any serializable type. |
Alltoall<T>(T[])
Collective operation in which every process sends data to every other process. Alltoall differs from Allgather<T>(T) in that a given process can send different data to all of the other processes, rather than contributing the same piece of data to all processes.
Declaration
T[] Alltoall<T>(T[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | values | The array of values that will be sent to each process. The ith value in this array will be sent to the process with rank i. |
Returns
| Type | Description |
|---|---|
| T[] | An array of values received from all of the other processes. The jth value in this array will be the value sent to the calling process from the process with rank j. |
Type Parameters
| Name | Description |
|---|---|
| T | Any serializable type. |
AlltoallFlattened<T>(T[], Int32[], Int32[])
Collective operation in which every process sends data to every other process. Alltoall
differs from Allgather<T>(T) in that a given process can send different
data to all of the other processes, rather than contributing the same piece of data to all
processes.
Declaration
T[] AlltoallFlattened<T>(T[] inValues, int[] sendCounts, int[] recvCounts)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | inValues | The array of values that will be sent to each process. sendCounts[i] worth of data will be sent to process i. |
| Int32[] | sendCounts | The numbers of items to be sent to each process. |
| Int32[] | recvCounts |
Returns
| Type | Description |
|---|---|
| T[] | The array of values received from all of the other processes. |
Type Parameters
| Name | Description |
|---|---|
| T | Any serializable type. |
Barrier()
Wait until all processes in the communicator have reached the same barrier.
Declaration
void Barrier()
Broadcast<T>(ref T, Int32)
Broadcast a value from the root process to all other processes.
Declaration
void Broadcast<T>(ref T value, int root)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to be broadcast. At the root process, this value is read (but not written); at all other processes, this value will be replaced with the value at the root. |
| Int32 | root | The rank of the process that is broadcasting the value out to all of the non-root processes. |
Type Parameters
| Name | Description |
|---|---|
| T | Any serializable type. |
Gather<T>(T, Int32)
Gather the values from each process into an array of values at the root process.
On the root process, the pth element of the result will be equal to the value parameter of the process with rank p when this routine returns.
Other processes receive null.
Declaration
T[] Gather<T>(T value, int root)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value contributed by this process. |
| Int32 | root | The rank of the process that will receive values for all of the processes in the communicator. |
Returns
| Type | Description |
|---|---|
| T[] |
Type Parameters
| Name | Description |
|---|---|
| T | Any serializable type. |
GatherFlattened<T>(T[], Int32)
Similar to Gather<T>(T, Int32) but here all values are aggregated into one large array.
Declaration
T[] GatherFlattened<T>(T[] inValues, int root)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | inValues | The values to be contributed by this process. |
| Int32 | root | The rank of the root node. |
Returns
| Type | Description |
|---|---|
| T[] | The aggregated gathered values. |
Type Parameters
| Name | Description |
|---|---|
| T | Any serializable type. |
ImmediateSend<T>(T, Int32, Int32)
Non-blocking send to a particular processor.
Declaration
ICommunicatorRequest ImmediateSend<T>(T value, int dest, int tag)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | |
| Int32 | dest | |
| Int32 | tag |
Returns
| Type | Description |
|---|---|
| ICommunicatorRequest |
Type Parameters
| Name | Description |
|---|---|
| T |
ImmediateSend<T>(T[], Int32, Int32)
Declaration
ICommunicatorRequest ImmediateSend<T>(T[] values, int dest, int tag)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | values | |
| Int32 | dest | |
| Int32 | tag |
Returns
| Type | Description |
|---|---|
| ICommunicatorRequest |
Type Parameters
| Name | Description |
|---|---|
| T |
Receive<T>(Int32, Int32, out T)
Blocking receive from a particular processor.
Declaration
void Receive<T>(int source, int tag, out T value)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | source | |
| Int32 | tag | |
| T | value |
Type Parameters
| Name | Description |
|---|---|
| T |
Receive<T>(Int32, Int32, ref T[])
Blocking receive an array from a particular processor. Must have a matching array send.
Declaration
void Receive<T>(int source, int tag, ref T[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | source | |
| Int32 | tag | |
| T[] | values | Must be allocated to the correct size. Cannot be null. |
Type Parameters
| Name | Description |
|---|---|
| T |
Reduce<T>(T, Func<T, T, T>, Int32)
Reduce is a collective algorithm that combines the values stored by each process into a
single value available at the designated root process. The values are combined
in a user-defined way, specified via a delegate. If value1, value2, ..., valueN
are the values provided by the N processes in the communicator, the result will be the value
value1 op value2 op ... op valueN. This result is only
available to the root process.
Declaration
T Reduce<T>(T value, Func<T, T, T> op, int root)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The local value that will be combined with the values provided by other processes. |
| Func<T, T, T> | op | The operation used to combine two values. This operation must be associative. |
| Int32 | root | The rank of the process that is the root of the reduction operation, which will receive the result of the reduction operation. |
Returns
| Type | Description |
|---|---|
| T | On the root, returns the result of the reduction operation. The other processes receive a default value. |
Type Parameters
| Name | Description |
|---|---|
| T | Any serializable type. |
Scatter<T>(T[], Int32)
Scatters an array of values by sending the ith value of the array to processor i.
Declaration
T Scatter<T>(T[] values, int root)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | values | An array of values of length Size, which is only significant at the root. The ith value of this array (at the root process) will be sent to the ith processor. |
| Int32 | root | Rank of the "root" process, which will supply the array of values to be scattered. |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | Any serializable type. |
Send<T>(T, Int32, Int32)
Blocking send to a particular processor. Will wait until the value is received.
Declaration
void Send<T>(T value, int dest, int tag)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | |
| Int32 | dest | |
| Int32 | tag |
Type Parameters
| Name | Description |
|---|---|
| T |
Send<T>(T[], Int32, Int32)
Blocking send array to a particular processor. Will wait until the value is received. Must be received by the array-specific receive method.
Declaration
void Send<T>(T[] values, int dest, int tag)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | values | |
| Int32 | dest | |
| Int32 | tag |
Type Parameters
| Name | Description |
|---|---|
| T |