Last active
February 23, 2016 23:36
-
-
Save pkpio/e7e25b17fac47f2710dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MPI_Datatype row_type; | |
| MPI_Datatype col_type; | |
| // Row definition | |
| MPI_Type_vector(DIM_LEN, DIM_LEN, 0, MPI_INT, &row_type); | |
| MPI_Type_commit(&row_type); | |
| // Column definition | |
| MPI_Type_vector(DIM_LEN, 1, DIM_LEN, MPI_INT, &col_type); | |
| MPI_Type_commit(&col_type); | |
| int *sendcnts; | |
| int *disps; | |
| sendcnts = malloc(sizeof(int) * comm_size); | |
| disps = malloc(sizeof(int) * comm_size); | |
| int i; | |
| for(i=0; i<comm_size; i++){ | |
| sendcnts[i] = DIM_LEN / comm_size; | |
| disps[i] = i; | |
| } | |
| MPI_Scatterv(mat_1, sendcnts, disps, row_type, mat_1, DIM_LEN, row_type, 0, MPI_COMM_WORLD); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment