Vous êtes sur la page 1sur 29

MPI_AlltoAllv Function Outline

int MPI_Alltoallv ( void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype sendtype, void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype recvtype, MPI_Comm comm ) Input Parameters sendbuf starting address of send buffer (choice) sendcounts integer array equal to the group size specifying the number of elements to send to each processor sdispls integer array (of length group size). Entry j specifies the displacement (relative to sendbuf from which to take the outgoing data destined for process j recvcounts integer array equal to the group size specifying the maximum number of elements that can be received from each processor rdispls integer array (of length group size). Entry i specifies the displacement (relative to recvbuf at which to place the incoming data from process i

Each node in parallel community has send buffer


send count array
0 1 2 3 4 5 6 A B 2 C D E F G 3 2 2 5 0 2 3 J K 3 1 3 6

send displacement array

0 1

H I 3 0

0 1 2 3

O P 1 Q R 2 4 1 3 0

4
5 6

L
M N

4
5 6

S
T U

proc 0

proc 1

proc 2

Example of Send for Proc 0


0 1 A B

2
3 4 5 6
index

C
D E F G
Proc 0 send buffer
index

0 2 5
sdispl Array

1
2

3
2
sendcount Array

Example of Send for Proc 0


0 1 A B
start at index 0

2
3 4 5 6
index

C
D E F G
Proc 0 send buffer
index

0 2 5
sdispl Array

1
2

3
2
sendcount Array

Example of Send for Proc 0


0 1 A B
get next 2 elements

2
3 4 5 6
index

C
D E F G
Proc 0 send buffer
index

0 2 5
sdispl Array

1
2

3
2
sendcount Array

Example of Send for Proc 0


0 1 A B
send to receive buffer of proc with same rank as index

2
3 4 5 6
index

C
D E F G
Proc 0 send buffer
index

0 2 5
sdispl Array

1
2

3
2
sendcount Array

Example of Send for Proc 0


0 1 A B
this chunk of send buffer goes to receive buffer of proc 0 send to receive buffer of proc with same rank as index

2
3 4 5 6
index

C
D E F G

0 2 5
sdispl Array

1
2

3
2
sendcount Array

index

Proc 0 send buffer

Example of Send for Proc 0


0 1 A B
for this procs next send, start at index 2 of send buffer

2
3 4 5 6
index

C
D E F G
Proc 0 send buffer
index

0 2 5
sdispl Array

1
2

3
2
sendcount Array

Example of Send for Proc 0


0 1 A B
get next 3 elements of send buffer

2
3 4 5 6
index

C
D E F G
Proc 0 send buffer
index

0 2 5
sdispl Array

1
2

3
2
sendcount Array

Example of Send for Proc 0


0 1 A B
send to receive buffer of proc 1

2
3 4 5 6
index

C
D E F G
Proc 0 send buffer
index

0 2 5
sdispl Array

1
2

3
2
sendcount Array

Example of Send for Proc 0


0 1 A B
for final send, start at index 5

2
3 4 5 6
index

C
D E F G
Proc 0 send buffer

0 2 5
sdispl Array

1
2

3
2
sendcount Array

Example of Send for Proc 0


0 1 A B
get next 2 elements

2
3 4 5 6
index

C
D E F G
Proc 0 send buffer

0 2 5
sdispl Array

1
2

3
2
sendcount Array

Example of Send for Proc 0


0 1 A B
send to receive buffer of proc 2

2
3 4 5 6
index

C
D E F G
Proc 0 send buffer

0 2 5
sdispl Array

1
2

3
2
sendcount Array

Example of Send for Proc 0


0 1 A B
this process occurs for each node in the community

2
3 4 5 6
index

C
D E F G
Proc 0 send buffer

0 2 5
sdispl Array

1
2

3
2
sendcount Array

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 0 1 2 3 3 2 0 3 6 3 4 5 6 7 8

proc 2

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

2 1 4

0 2 3

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 0 1 2 3 3 2 0 3 6 3 4 5 6 7 8

proc 2

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

2 1 4

0 2 3

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 C D E 3 3 2 0 3 6 0 1 2 3 4 5 6 7 8

proc 2

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

2 1 4

0 2 3

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 C D E 3 3 2 0 3 6 0 1 2 3 4 5 6 7 8

proc 2 F G 2 1 4 0 2 3

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 C D E 3 3 2 0 3 6 0 1 2 3 4 5 6 7 8

proc 2 F G 2 1 4 0 2 3

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B H I J r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 C D E 3 3 2 0 3 6 0 1 2 3 4 5 6 7 8

proc 2 F G 2 1 4 0 2 3

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B H I J r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 C D E K L M 3 3 2 0 3 6 0 1 2 3 4 5 6 7 8

proc 2 F G 2 1 4 0 2 3

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B H I J r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 C D E K L M 3 3 2 0 3 6 0 1 2 3 4 5 6 7 8

proc 2 F G N 2 1 4 0 2 3

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B H I J r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 C D E K L M 3 3 2 0 3 6 0 1 2 3 4 5 6 7 8

proc 2 F G N 2 1 4 0 2 3

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B H I J O r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 C D E K L M 3 3 2 0 3 6 0 1 2 3 4 5 6 7 8

proc 2 F G N 2 1 4 0 2 3

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B H I J O r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 C D E K L M P Q 3 3 2 0 3 6 0 1 2 3 4 5 6 7 8

proc 2 F G N 2 1 4 0 2 3

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B H I J O r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 C D E K L M P Q 3 3 2 0 3 6 0 1 2 3 4 5 6 7 8

proc 2 F G N R S T U 2 1 4 0 2 3

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

proc 0 0 A B C D E F G 2 5 2 3 0 2 0 1 2 3 4 5 6

proc 1 H I J K L M N 1 6 3 3 0 3 0 1 2 3 4 5 6

proc 2 O P Q R S T U 4 3 1 2 0 1

S E N D

1 2 3 4 5 6

proc 0 0 A B H I J O r c n t 2 3 1 r d s p l 0 2 5 0 1 2 3 4 5 6 7 8

proc 1 C D E K L M P Q 3 3 2 0 3 6 0 1 2 3 4 5 6 7 8

proc 2 F G N R S T U 2 1 4 0 2 3

R E C E I V E

r b u f f e r

1 2 3 4 5 6 7 8

Notes on AlltoAllv
A receive buffer could potentially be as large as the sum of all send buffer sizes Care must be taken to coincide send counts with receive counts and displacements so data is not overwritten

Vous aimerez peut-être aussi