aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/010_stats_tables_h48/stats_tables_h48.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/010_stats_tables_h48/stats_tables_h48.c b/tools/010_stats_tables_h48/stats_tables_h48.c
index 8b65862..18fd411 100644
--- a/tools/010_stats_tables_h48/stats_tables_h48.c
+++ b/tools/010_stats_tables_h48/stats_tables_h48.c
@@ -3,7 +3,6 @@
3#include "../tool.h" 3#include "../tool.h"
4 4
5#define MAXMOVES 20 5#define MAXMOVES 20
6#define NTHREADS 32
7#define NCUBES_PER_THREAD 10000 6#define NCUBES_PER_THREAD 10000
8#define LOG_EVERY (NCUBES_PER_THREAD / 10) 7#define LOG_EVERY (NCUBES_PER_THREAD / 10)
9 8
@@ -57,10 +56,10 @@ run_thread(void *arg)
57void run(void) { 56void run(void) {
58 int64_t i, j, k, tot; 57 int64_t i, j, k, tot;
59 double avg; 58 double avg;
60 pthread_t thread[NTHREADS]; 59 pthread_t thread[THREADS];
61 thread_arg_t arg[NTHREADS]; 60 thread_arg_t arg[THREADS];
62 61
63 for (i = 0; i < NTHREADS; i++) { 62 for (i = 0; i < THREADS; i++) {
64 arg[i] = (thread_arg_t) { 63 arg[i] = (thread_arg_t) {
65 .thread_id = i, 64 .thread_id = i,
66 .n = NCUBES_PER_THREAD, 65 .n = NCUBES_PER_THREAD,
@@ -69,18 +68,18 @@ void run(void) {
69 pthread_create(&thread[i], NULL, run_thread, &arg[i]); 68 pthread_create(&thread[i], NULL, run_thread, &arg[i]);
70 } 69 }
71 70
72 for (i = 0; i < NTHREADS; i++) 71 for (i = 0; i < THREADS; i++)
73 pthread_join(thread[i], NULL); 72 pthread_join(thread[i], NULL);
74 73
75 for (j = 0; j < 12; j++) { 74 for (j = 0; j < 12; j++) {
76 printf("Data for h=%" PRId64 "\n", j); 75 printf("Data for h=%" PRId64 "\n", j);
77 for (k = 0, avg = 0.0; k <= 16; k++) { 76 for (k = 0, avg = 0.0; k <= 16; k++) {
78 for (i = 0, tot = 0; i < NTHREADS; i++) 77 for (i = 0, tot = 0; i < THREADS; i++)
79 tot += arg[i].v[j][k]; 78 tot += arg[i].v[j][k];
80 printf("%" PRId64 "\t%" PRId64 "\n", k, tot); 79 printf("%" PRId64 "\t%" PRId64 "\n", k, tot);
81 avg += tot * k; 80 avg += tot * k;
82 } 81 }
83 avg /= (double)(NCUBES_PER_THREAD * NTHREADS); 82 avg /= (double)(NCUBES_PER_THREAD * THREADS);
84 printf("Average: %.4lf\n", avg); 83 printf("Average: %.4lf\n", avg);
85 printf("\n"); 84 printf("\n");
86 } 85 }

Generated with cgit - Back to sebastiano.tronto.net