source: CIVL/examples/mpi/collective/scatter_bad.c@ 2261cec

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 2261cec was a7f50d5, checked in by Manchun Zheng <zmanchun@…>, 11 years ago

added some more tests

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@2093 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 594 bytes
Line 
1#include<mpi.h>
2#include<stdlib.h>
3
4int main()
5{
6 int argc;
7 char** argv;
8 int rank;
9 int procs;
10 int* values;
11
12 MPI_Init(&argc,&argv);
13 MPI_Comm_size(MPI_COMM_WORLD, &procs);
14 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
15
16 if (rank == 0) {
17 values = (int*)malloc(sizeof(int)*procs);
18 for(int i = 0; i < procs; i++){
19 values[i] = i;
20 }
21 }else{
22 values = (int*)malloc(sizeof(int));
23 }
24
25 if (rank != 2)
26 MPI_Scatter(values, 1, MPI_INT, values, 1, MPI_INT, 0, MPI_COMM_WORLD);
27
28 free(values);
29 MPI_Finalize();
30 return 0;
31}
Note: See TracBrowser for help on using the repository browser.