aaaaaaa

parent acb530d1
This source diff could not be displayed because it is too large. You can view the blob instead.
all: pdeSolver
pdeSolver: pdeSolver.o Sistemas_Lineares.o utils.o
gcc -g -o pdeSolver pdeSolver.o Sistemas_Lineares.o utils.o -lm -DLIKWID_PERFMON -I/home/soft/likwid/include -L/home/soft/likwid/lib -llikwid -O3 -mavx -march=native
pdeSolver.o: pdeSolver.c
gcc -g -o pdeSolver.o -c pdeSolver.c -lm -Wall -DLIKWID_PERFMON -I/home/soft/likwid/include -L/home/soft/likwid/lib -llikwid -O3 -mavx -march=native
Sistemas_Lineares.o: Sistemas_Lineares.c Sistemas_Lineares.h
gcc -g -o Sistemas_Lineares.o -c Sistemas_Lineares.c -lm -Wall -DLIKWID_PERFMON -I/home/soft/likwid/include -L/home/soft/likwid/lib -llikwid -O3 -mavx -march=native
utils.o: utils.c utils.h
gcc -g -o utils.o -c utils.c -lm -Wall -O3 -mavx -march=native
doc: arqDox
doxygen arqDox
clean:
rm -rf *.o
rm -rf pdeSolver
rm -rf *.txt *.dat
rm -rf *.c.save
rm -rf html
#export PATH=/home/soft/likwid/bin:/home/soft/likwid/sbin:$PATH
#export LD_LIBRARY_PATH=/home/soft/likwid/lib:$LD_LIBRARY_PATH
\ No newline at end of file
......@@ -83,15 +83,6 @@ double normaL2Residuo(SistLinear_t *SL, int nx, int ny, double *x)
k = 0;
LIKWID_MARKER_START("res");
// for (i = 1; i <= nx; i++)
// {
// for (j = 1; j <= ny; j++)
// {
// k = j + i*(nx+2);
// residuo = SL->b[k] - (SL->dig_p)*x[k] - (SL->dig_inf)*x[k-1] - (SL->dig_inf_af)*x[k-(nx+2)] - (SL->dig_sup)*x[k+1] - (SL->dig_sup_af)*x[k+(nx+2)];
// r_soma += residuo*residuo;
// }
// }
for (i = 1; i <= nx; i++)
{
......@@ -106,23 +97,13 @@ double normaL2Residuo(SistLinear_t *SL, int nx, int ny, double *x)
// residuo = 0.0f;
residuo = SL->b[k+1] - (SL->dig_p)*x[k+1] - (SL->dig_inf)*x[k] - (SL->dig_inf_af)*x[k-(nx+1)] - (SL->dig_sup)*x[k+2] - (SL->dig_sup_af)*x[k+(nx+3)];
r_soma += residuo*residuo;
// residuo = 0.0f;
// residuo = SL->b[k+2] - (SL->dig_p)*x[k+2] - (SL->dig_inf)*x[k+1] - (SL->dig_inf_af)*x[k-nx] - (SL->dig_sup)*x[k+2] - (SL->dig_sup_af)*x[k+(nx+4)];
// r_soma += residuo*residuo;
// residuo = SL->b[k+3] - (SL->dig_p)*x[k+4] - (SL->dig_inf)*x[k+2] - (SL->dig_inf_af)*x[k+1-nx] - (SL->dig_sup)*x[k+3] - (SL->dig_sup_af)*x[k+(nx+5)];
// r_soma += residuo*residuo;
}
// resto do unroll & jam
for (int t = 1; t <= ny%2; t++){
// residuo = 0.0f;
// x[k+2+t] = x[k+2+t]/(SL->dig_p);
residuo = SL->b[k+1+t] - (SL->dig_p)*x[k+1+t] - (SL->dig_inf)*x[k+t] - (SL->dig_inf_af)*x[k+t-(nx + 1)] - (SL->dig_sup)*x[k+2+t] - (SL->dig_sup_af)*x[k+t+(nx+3)];
residuo = SL->b[k+1+t] - (SL->dig_p)*x[k+1+t] - (SL->dig_inf)*x[k+t] - (SL->dig_inf_af)*x[k+t-(nx + 1)] - (SL->dig_sup)*x[k+2+t] - (SL->dig_sup_af)*x[k+t+(nx+3)];
r_soma += residuo*residuo;
// printf("k + 2 + t: %d\n", k + 2 + t);
}
}
r_soma = sqrt(r_soma);
......
,vinicius,vinicius-pc,01.12.2019 16:45,file:///home/vinicius/.config/libreoffice/4;
\ No newline at end of file
double calc_integral_mc(int n, double a, double b){
double sum, x, y;
for(int i=0; i < n; i++) {
double rand_b_a = (double) 1.0 / RAND_MAX * (b - a);
x = a + (double) rand() * rand_b_a;
y = a + (double) rand() * rand_b_a;
// pré calcular os valores que serão utilizados repetidamente
double x_2 = x * x;
double y_2 = y * y;
double x2_y2_2 = (x_2 + y_2) * (x_2 + y_2);
sum += 1e5 * x_2 + y_2 -
x2_y2_2 *(1.0 + 1e-5 * x2_y2_2);
// equivalência do produtório anterior com menos multiplicações
}
return (b - a)*(b - a) * sum / n;
}
\ No newline at end of file
...
/* n é muito grande */
if( x == A ) {
for (i = 0; i < n; i++){
FuncaoA(i);
}
}
else if( x == B ) {
for (i = 0; i < n; i++){
FuncaoB(i);
}
}
else {
for (i = 0; i < n; i++){
FuncaoC(i);
}
}
}
double a[n],x[n],y[n],b[n],z[n];
// ...
// unroll
for (i=0; i<n - n%m; i++){
a[i]=x[i]+y[i]*sin((i%8)*M_PI);
a[i+1]= ...
...
a[i+m-1] = ...
// aproveitar o valor de x[i] recèm utilizado p/ calcular b[i]
b[i]=1.0/x[i]+z[i];
b[i+1]= ...
...
b[i+m-1] = ...
}
// jam
for (int i = n - n%m; i < n; i++){
a[i]=x[i]+y[i]*sin((i%8)*M_PI);
}
double a[nd1][nd2], y[nd2], x[nd1]
...
for (long i=0; i < nd2; ++i){
y[i] = 0.0;
for (long j=0; j < nd1; ++j){
y[i] = y[i] + a[j][i]*x[j];
// y[i] é o valor da COL de a pelo vet x
}
}
double a[nd1][nd2], y[nd2], x[nd1]
...
// cria a com 0.0
for (int i=0; i < nd2; ++i){
y[i] = 0.0f;
}
for (int j=0; j < nd1; ++j){
// double t = 0.0;
// zero o valor de y[j] antes para não sobreescrever 0 em um valor já calculado
for (int i=0; i < nd2; ++i){
//Multiplico a linha inteira por x[j]
y[i] = y[i] + a[j][i]*x[j];
}
}
\ No newline at end of file
#Residuo
#Residuo
32
#Residuo
32
50
64
100
128
200
256
300
400
512
1000
1024
#Gauss
32
50
64
100
128
200
256
300
400
512
1000
1024
#Gauss
32
50
64
100
128
200
256
300
400
512
1000
1024
#Residuo
32
50
64
100
128
200
256
300
400
512
1000
1024
......@@ -4,7 +4,6 @@
*/
#include "Sistemas_Lineares.h"
#include "utils.h"
#include <likwid.h>
const double pi_quad = M_PI*M_PI; /**< Variável para armazenar o valor de π² */
......@@ -82,7 +81,6 @@ double normaL2Residuo(SistLinear_t *SL, int nx, int ny, double *x)
int i,j,k;
k = 0;
LIKWID_MARKER_START("res");
// for (i = 1; i <= nx; i++)
// {
// for (j = 1; j <= ny; j++)
......@@ -126,7 +124,6 @@ double normaL2Residuo(SistLinear_t *SL, int nx, int ny, double *x)
}
}
r_soma = sqrt(r_soma);
LIKWID_MARKER_STOP("res");
return(r_soma);
}
......@@ -160,7 +157,6 @@ void Gauss_Seidel(int nx , int ny, int maxiter, SistLinear_t *SL , double *tempo
for(it = 0; it < maxiter; it++)
{
time_ini = timestamp();
LIKWID_MARKER_START("Gauss");
for (i = 1; i <= nx; i++)
{
......@@ -197,8 +193,6 @@ void Gauss_Seidel(int nx , int ny, int maxiter, SistLinear_t *SL , double *tempo
// printf("k + 2 + t: %d\n", k + 2 + t);
}
}
LIKWID_MARKER_STOP("Gauss");
time_fim = timestamp();
*tempo_medio += (time_fim - time_ini);
......
=============================
FLOPS_DP
=============================
=============================
NX = NY = 32
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 3.39 GHz
=============================
NX = NY = 50
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 3.39 GHz
=============================
NX = NY = 64
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 3.39 GHz
=============================
NX = NY = 100
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 3.39 GHz
=============================
NX = NY = 128
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 3.39 GHz
=============================
NX = NY = 200
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 3.39 GHz
=============================
NX = NY = 256
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 3.39 GHz
=============================
NX = NY = 300
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 2.59 GHz
=============================
NX = NY = 400
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 3.39 GHz
=============================
NX = NY = 512
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 3.39 GHz
=============================
NX = NY = 1000
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 3.02 GHz
=============================
NX = NY = 1024
=============================
--------------------------------------------------------------------------------
CPU name: AMD Ryzen 5 2600 Six-Core Processor
CPU type: AMD K17 (Zen) architecture
CPU clock: 2.59 GHz
--------------------------------------------------------------------------------
CPU name: Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
CPU type: Intel Coffeelake processor
CPU clock: 3.41 GHz
......@@ -6,7 +6,6 @@
#include <stdlib.h>
#include "Sistemas_Lineares.h"
#include "utils.h"
#include <likwid.h>
//Equação:
//(-2hy² + hxhy²)(Ui+1,j) + (-2hy² - hxhy²)(Ui-1,j) + (-2hx² + hx²hy)(Ui,j+1) + (-2hx² - hx²hy)(Ui,j-1) +(4hy² + 4hx² + 8pi²hx²hy²)Uij = f(x,y)*2hx²hy²
......@@ -32,7 +31,6 @@
*/
int main(int argc, char *argv[])
{
LIKWID_MARKER_INIT;
int nx = 0, ny = 0 , maxiter = 0;
char *arquivo_saida = NULL;
// printf("10%3: %d \n", 10%3);
......@@ -59,7 +57,6 @@ int main(int argc, char *argv[])
if(teste != 0)
return teste;
LIKWID_MARKER_CLOSE;
return 0;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment