forked from sysprog21/compute-pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark_clock_gettime_95.c
50 lines (37 loc) · 967 Bytes
/
benchmark_clock_gettime_95.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "computepi.h"
#include "benchmark_helper.h"
int main(int argc, char const *argv[])
{
if (argc < 2) return -1;
int N = atoi(argv[1]);
// Baseline
PRINT_TIME_95( "%.9f,",
compute_pi_baseline(N);
);
// OpenMP with 2 threads
PRINT_TIME_95( "%.9f,",
compute_pi_openmp(N, 2);
);
// OpenMP SIMD 2 threads
PRINT_TIME_95( "%.9f,",
compute_pi_omp_simd(N, 2);
);
// AVX SIMD
PRINT_TIME_95( "%.9f,",
compute_pi_avx(N);
);
// AVX SIMD + Loop unrolling
PRINT_TIME_95( "%.9f,",
compute_pi_avx_unroll(N);
);
// OpenCL
init_opencl(N, 1);
PRINT_TIME_95( "%.9f\n",
compute_pi_opencl(N, 1);
);
release_opencl();
return 0;
}