ARCHER Training Courses
Sponsors
ARCHER Training Courses Sponsors Reusing this material This work - - PowerPoint PPT Presentation
ARCHER Training Courses Sponsors Reusing this material This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. http://creativecommons.org/licenses/by-nc-sa/4.0/ This means you are free
Sponsors
This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. http://creativecommons.org/licenses/by-nc-sa/4.0/
This means you are free to copy and redistribute the material and adapt and build on the material under the following terms: You must give appropriate credit, provide a link to the license and indicate if changes were made. If you adapt or build on the material you must distribute your work under the same license as the original. Note that this presentation contains images owned by others. Please seek their permission before reusing these images.
3
4
5
with collectives
6
7
9 10 13 14 1 2 3 4 5 6 7 8 11 12 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
rank 0 (0,0) rank 1 (0,1) rank 3 (1,1) rank 2 (1,0)
Gather to rank 0 i j (assume integer arrays and C-like array storage)
8
1 2 1 2 3 4 3 4 1 2 1 2 3 4 3 4
rank 0 (0,0) rank 1 (0,1) rank 3 (1,1) rank 2 (1,0)
Gather to rank 0 1 2 3 4 1 2 1 2 3 4 3 4 1 2 3 4 i j
9
1 2 1 2 3 4 3 4 1 2 1 2 3 4 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 rank 0 rank 0 rank 1 rank 2 rank 3
10
MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype int root, MPI_Comm comm) MPI_GATHER(SENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, RECVCOUNT, RECVTYPE, ROOT, COMM, IERROR)
11
1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 rank 0 rank 1 rank 2 rank 3 0*4*sizeof(int) 1*4*sizeof(int) 2*4*sizeof(int) 3*4*sizeof(int) 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
12
13
rank 0 rank 1 rank 3 rank 2
0*sizeof(int) 2*sizeof(int) 8*sizeof(int) 10*sizeof(int)
14
MPI_Type_create_resized(MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype) MPI_TYPE_CREATE_RESIZED(OLDTYPE, LB, EXTENT, NEWTYPE, IERR) INTEGER OLDTYPE, NEWTYPE, IERROR INTEGER(KIND=MPI_ADDRESS_KIND) LB, EXTENT 15
MPI_Aint intlb, intsize, lb = 0; MPI_Type_get_extent(MPI_INT, &intlb, &intsize); MPI_Type_create_resized(vector2x2, lb, intsize, &vecresize); MPI_Type_commit(&vecresize); INTEGER(KIND=MPI_ADDRESS_KIND) :: INTLB, INTSIZE, LB=0 CALL MPI_TYPE_GET_EXTENT(MPI_INTEGER, INTLB, INTSIZE, IERR) CALL MPI_TYPE_CREATE_RESIZED(VECTOR2x2, LB, INTSIZE, VECRESIZE, IERR) CALL MPI_TYPE_COMMIT(VECRESIZE, IERR) 16
17
1 2 1 2 3 4 3 4 1 2 1 2 3 4 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 rank 0 rank 0 rank 1 rank 2 rank 3
recvbuf, recvcounts, displs, recvtype, root, comm)
up directly in the correct place – avoids copy-in / copy-out
sendcounts and sdispls as well as recvcounts and rdispls
18
19