Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. double *v = (double*)malloc(sizeof(double)*n);
  2. if (mpi_rank == 0) {
  3. init_random_vector(n, v);
  4. }
  5. // n is the number of data items
  6. int elements_per_proc = n/mpi_p;
  7. double *sub_v = (double*)malloc(sizeof(double)*elements_per_proc);
  8.  
  9. if (mpi_rank == 0) {
  10. //insertion_sort(n, v);
  11. MPI_SCATTER(v, elements_per_proc, MPI_DOUBLE, sub_v,
  12. elements_per_proc, MPI_DOUBLE, 0, MPI_COMM_WORLD);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement