fork download
  1. #include <stdio.h>
  2. #include <mpi.h>
  3.  
  4. int main(int argc, char** argv){
  5. int process_Rank, size_Of_Comm;
  6. int distro_Array[4] = {39, 72, 129, 42};
  7. int scattered_Data;
  8.  
  9. MPI_Init(&argc, &argv);
  10. MPI_Comm_size(MPI_COMM_WORLD, &size_Of_Comm);
  11. MPI_Comm_rank(MPI_COMM_WORLD, &process_Rank);
  12.  
  13. MPI_Scatter(&distro_Array, 1, MPI_INT, &scattered_Data, 1, MPI_INT, 0, MPI_COMM_WORLD);
  14.  
  15. printf("Process has received: %d \n", scattered_Data);
  16. MPI_Finalize();
  17. return 0;
  18. }
  19.  
Success #stdin #stdout #stderr 0.24s 40868KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: unexpected symbol in "int main"
Execution halted