Reporte 2
Reporte 2
Reporte 2
November 8, 2023
1 Laboratorio 7
1.1 Ejercicio 1
1.1.1 A
#include <iostream>
#include <cmath>
#include <ctime>
#include <mpi.h>
if (size < 2) {
std::cerr << "This program requires at least 2 MPI processes." << std::endl;
MPI_Finalize();
return 1;
1
}
// Inicialización
double start_time = MPI_Wtime();
tiempo = tmin;
u[0] = 0.0;
for (i = 1; i <= n; i++) u[i] = inicial(x[i], tiempo);
u[n + 1] = 0.0;
2
unew[1] = frontera(x[1], tnew);
}
if (local_end == n) {
unew[n] = frontera(x[n], tnew);
}
MPI_Finalize();
return 0;
}
[2]: import matplotlib.pyplot as plt
plt.show()
3
1.1.2 B
El número de FLOPS son: 400 * (10*10) + 3 = 41200 FLOPS.
Ahora para visualizar la velocidad en FLOPS.
[12]: n_process = [2, 4, 8, 16]
#times = [41200/ 0.003144, 41200/0.001194, 41200/0.002173, 41200/0.114123]
times = [0.003144, 0.001194, 0.002173, 0.114123]
t_comm = [0.001234,0.001689,0.002179, 0.239181]
plt.show()
4
[ ]: