Professional Documents
Culture Documents
As 3
As 3
Question #1:
```c
#include <stdio.h>
#include <mpi.h>
if (size % 4 != 0) {
if (rank == 0) {
printf("Number of MPI processes must be divisible by 4.\n");
}
MPI_Finalize();
return 0;
}
MPI_Finalize();
return 0;
}
```
Question #2:
a) The iteration for one-to-all broadcast in a hypercube involves sending the message to all
neighboring nodes. The minimum number of iterations is the logarithm base 2 of the number of
nodes.
Question #3:
```c
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#define N 10
int main() {
double A[N][N], B[N][N], C[N][N];
int i, j, k;
return 0;
}
```