Presentation is loading. Please wait.

Presentation is loading. Please wait.

Collectives Reduce Scatter Gather Many more.

Similar presentations


Presentation on theme: "Collectives Reduce Scatter Gather Many more."— Presentation transcript:

1 Collectives Reduce Scatter Gather Many more

2 Prototype of MPI_Reduce()
int MPI_Reduce ( void *operand, /* addr of 1st reduction element */ void *result, /* addr of 1st reduction result */ int count, /* reductions to perform */ MPI_Datatype type, /* type of elements */ MPI_Op operator, /* reduction operator */ int root, /* process getting result(s) */ MPI_Comm comm /* communicator */ )

3 MPI_Datatype Options MPI_CHAR MPI_DOUBLE MPI_FLOAT MPI_INT MPI_LONG
MPI_LONG_DOUBLE MPI_SHORT MPI_UNSIGNED_CHAR MPI_UNSIGNED MPI_UNSIGNED_LONG MPI_UNSIGNED_SHORT

4 MPI_Op Options MPI_BAND MPI_BOR MPI_BXOR MPI_LAND MPI_LOR MPI_LXOR
MPI_MAX MPI_MAXLOC MPI_MIN MPI_MINLOC MPI_PROD MPI_SUM

5 Our Call to MPI_Reduce()
MPI_Reduce (&count, &global_count, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD); Only process 0 will get the result if (!id) printf ("There are %d different solutions\n", global_count);

6 MPI_Allgatherv

7 MPI_Allgatherv int MPI_Allgatherv ( void *send_buffer, int send_cnt,
MPI_Datatype send_type, void *receive_buffer, int *receive_cnt, int *receive_disp, MPI_Datatype receive_type, MPI_Comm communicator)

8 MPI_Allgatherv in Action

9 Reading a Block-Column Matrix
File

10 MPI_Scatterv

11 Header for MPI_Scatterv
int MPI_Scatterv ( void *send_buffer, int *send_cnt, int *send_disp, MPI_Datatype send_type, void *receive_buffer, int receive_cnt, MPI_Datatype receive_type, int root, MPI_Comm communicator)

12 Printing a Block-Column Matrix
Data motion opposite to that we did when reading the matrix Replace “scatter” with “gather” Use “v” variant because different processes contribute different numbers of elements

13 Function MPI_Gatherv

14 Header for MPI_Gatherv
int MPI_Gatherv ( void *send_buffer, int send_cnt, MPI_Datatype send_type, void *receive_buffer, int *receive_cnt, int *receive_disp, MPI_Datatype receive_type, int root, MPI_Comm communicator)

15 Function MPI_Alltoallv

16 Header for MPI_Alltoallv
int MPI_Gatherv ( void *send_buffer, int *send_cnt, int *send_disp, MPI_Datatype send_type, void *receive_buffer, int *receive_cnt, int *receive_disp, MPI_Datatype receive_type, MPI_Comm communicator)

17 Count/Displacement Arrays
create_mixed_xfer_arrays builds these MPI_Alltoallv requires two pairs of count/displacement arrays First pair for values being sent send_cnt: number of elements send_disp: index of first element Second pair for values being received recv_cnt: number of elements recv_disp: index of first element


Download ppt "Collectives Reduce Scatter Gather Many more."

Similar presentations


Ads by Google