Skip to content
Snippets Groups Projects
Commit a4a266e7 authored by Bouillaguet Charles's avatar Bouillaguet Charles
Browse files

omp benchmark

parent dc6361d6
No related branches found
No related tags found
No related merge requests found
...@@ -5,3 +5,4 @@ ...@@ -5,3 +5,4 @@
/Cunknown/test_falsenegative /Cunknown/test_falsenegative
/Cunknown/benchmark /Cunknown/benchmark
/Cunknown/main /Cunknown/main
/Cunknown/benchmark_omp
# icc (avec "source /usr/intel/compilers_and_libraries/linux/bin/compilervars.sh intel64" avant)
#CC = icc
#CFLAGS = -O3 -xHost -qopt-zmm-usage=high -qopenmp
#LDFLAGS = -fopenmp -qopenmp
# gcc
CFLAGS = -O3 -Wall -Wextra -Werror -march=native -mtune=native -fopenmp -g CFLAGS = -O3 -Wall -Wextra -Werror -march=native -mtune=native -fopenmp -g
LDFLAGS = -fopenmp LDFLAGS = -fopenmp
LDLIBS = -lm LDLIBS = -lm
all: main benchmark test test_falsenegative all: main benchmark test test_falsenegative benchmark_omp
fonctions.o: fonctions.h fonctions.o: fonctions.h
fonctions_bonus.o: fonctions.h
main.o: fonctions.h pcg_setseq.h main.o: fonctions.h pcg_setseq.h
test.o: fonctions.h pcg_setseq.h test.o: fonctions.h pcg_setseq.h
test_falsenegative.o: fonctions.h pcg_setseq.h test_falsenegative.o: fonctions.h pcg_setseq.h
benchmark.o: fonctions.h pcg_setseq.h benchmark.o: fonctions.h pcg_setseq.h
benchmark_omp.o: fonctions.h pcg_setseq.h
main: fonctions.o main.o main: fonctions.o main.o
benchmark: fonctions.o benchmark.o benchmark: fonctions.o benchmark.o
benchmark_omp: fonctions.o benchmark_omp.o
test: fonctions.o test.o fonctions_bonus.o test: fonctions.o test.o fonctions_bonus.o
test_falsenegative: fonctions.o test_falsenegative.o test_falsenegative: fonctions.o test_falsenegative.o
...@@ -23,5 +32,6 @@ clean: ...@@ -23,5 +32,6 @@ clean:
check: test test_falsenegative check: test test_falsenegative
prove -v ./test ./test_falsenegative prove -v ./test ./test_falsenegative
bench: benchmark bench: benchmark benchmark_omp
./benchmark ./benchmark
./benchmark_omp
\ No newline at end of file
#include <stdlib.h>
#include <stdio.h>
#include <omp.h>
#include "fonctions.h"
static const u64 WORK_FACTOR = 1 << (nbiter * known_up);
int main()
{
/* INITIALISATION DES PARAMETRES */
init_var_globales();
/********** prepare test input ***********/
u64 X[nboutput];
pcg128_t S0 = (((pcg128_t) 5995207026785010249u) << k) + ((pcg128_t) 179350442155841024u);
pcg128_t c = ((((pcg128_t) 6364136223846793005u) << k) + 1442695040888963407u) >> 1;
pcg128_t vraiS[nboutput];
pcg(vraiS, X, S0, &c, nboutput);
int T = omp_get_max_threads();
u64 W0 = 5018, WC = 335 - T/2;
printf("known_low = %d\n", known_low);
printf("# threads = %d\n", T);
printf("Début du benchmark\n");
double t1 = wtime();
#pragma omp parallel
{
int tid = omp_get_thread_num();
struct task_t task;
init_task(&task);
prepare_task(X, W0, WC + tid, &task);
for (u64 r = 0; r < WORK_FACTOR; r++) {
/***** Modification de rot et unrotX *****/
task.rot[0] = (task.rot[0] + 1) % k;
int i = 0;
while (task.rot[i] == 0 && i < nbiter) {
i++;
task.rot[i] = (task.rot[i] + 1) % k;
}
if (solve_isgood(&task)) {
printf("thread %d, candidat DS64 trouvé !!\n", tid);
printf("temps pour trouver la solution = %f\n", wtime() - t1);
}
}
}
double t = wtime() - t1;
printf("Durée benchmark = %.2fs\n", t);
printf("Itérations/s (%d threads) = %.1fM/s\n", T, WORK_FACTOR / t / 1e6 * T);
printf("Itérations/s (1 threads) = %.1fM/s\n", WORK_FACTOR / t / 1e6);
printf("Attaque complète = %.0fK h-CPU\n", t / WORK_FACTOR * (1ull << (nbiter * known_up + 2*known_low - 1)) / 3600 / 1e3);
exit(0);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment