fork download
  1. #include <stdio.h>
  2. // #include <stdlib.h>
  3. // #include <mpi.h>
  4.  
  5. // #define ARRAY_SIZE 1000
  6.  
  7. // int main(int argc, char** argv) {
  8. // MPI_Init(&argc, &argv);
  9.  
  10. // int world_size, world_rank;
  11. // MPI_Comm_size(MPI_COMM_WORLD, &world_size);
  12. // MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
  13.  
  14. // int* array = NULL;
  15. // int min_local = INT_MAX;
  16. // int min_global = INT_MAX;
  17.  
  18. // if (world_rank == 0) {
  19. // // Master process generates random numbers
  20. // array = (int*)malloc(ARRAY_SIZE * sizeof(int));
  21. // for (int i = 0; i < ARRAY_SIZE; ++i)
  22. // array[i] = rand() % 1000;
  23. // }
  24.  
  25. // // Broadcast array to all processes
  26. // MPI_Bcast(array, ARRAY_SIZE, MPI_INT, 0, MPI_COMM_WORLD);
  27.  
  28. // // Each process finds local minimum
  29. // for (int i = world_rank * (ARRAY_SIZE / world_size); i < (world_rank + 1) * (ARRAY_SIZE / world_size); ++i)
  30. // if (array[i] < min_local)
  31. // min_local = array[i];
  32.  
  33. // // Reduce all local minima to find global minimum
  34. // MPI_Reduce(&min_local, &min_global, 1, MPI_INT, MPI_MIN, 0, MPI_COMM_WORLD);
  35.  
  36. // if (world_rank == 0)
  37. // printf("Min number: %d\n", min_global);
  38.  
  39. // MPI_Finalize();
  40. // return 0;
  41. // }
  42.  
  43.  
Success #stdin #stdout #stderr 0.27s 40728KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: unexpected '/' in "/"
Execution halted