fork download
  1. #include<stdio.h>
  2. #include <math.h>
  3. #include "mpi.h"
  4.  
  5. int main(int argc, char *argv)
  6. {
  7. int rank, size, x,y;
  8. x=5;
  9. MPI_Init(&argc,&argv);
  10. MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  11. MPI_Comm_size(MPI_COMM_WORLD, &size);
  12. if(rank==0) y=pow(x,2);
  13. else if(rank==1) y=pow(x,3);
  14. else if(rank==2) y=pow(x,4);
  15. printf("On Process %d , y= %d\n",rank,y);
  16. MPI_Finalize();
  17. return 0;
  18. }
  19.  
Success #stdin #stdout #stderr 0.28s 40380KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: unexpected symbol in "int main"
Execution halted