Generate mandelbrot images using many clustered computers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
478 B

  1. #include<mpi.h>
  2. #include<stdlib.h>
  3. #include<stdio.h>
  4. #include "master.h"
  5. #include "slave.h"
  6. int main(char argc, char **argv)
  7. {
  8. MPI_Init(NULL, NULL);
  9. int worldSize, worldRank;
  10. MPI_Comm_size(MPI_COMM_WORLD, &worldSize);
  11. MPI_Comm_rank(MPI_COMM_WORLD, &worldRank);
  12. if(worldSize == 1)
  13. {
  14. printf("ERROR: You need at least 1 slave!\r\n");
  15. return 1;
  16. }
  17. worldRank == 0 ? master_main(argc, argv, worldSize) : slave_main(worldSize, worldRank);
  18. MPI_Finalize();
  19. return 0;
  20. }