Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double *v = (double*)malloc(sizeof(double)*n);
- if (mpi_rank == 0) {
- init_random_vector(n, v);
- }
- // n is the number of data items
- int elements_per_proc = n/mpi_p;
- double *sub_v = (double*)malloc(sizeof(double)*elements_per_proc);
- if (mpi_rank == 0) {
- //insertion_sort(n, v);
- MPI_SCATTER(v, elements_per_proc, MPI_DOUBLE, sub_v,
- elements_per_proc, MPI_DOUBLE, 0, MPI_COMM_WORLD);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement