From 99e5f103393d554b0d2725303682a35d343a09b6 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Fri, 18 Jan 2019 15:16:17 +0100 Subject: moved to subdirectory --- test/monniaux/mod_int_mat/Makefile | 46 +++++++++++ test/monniaux/mod_int_mat/int_mat.c | 138 ++++++++++++++++++++++++++++++++ test/monniaux/mod_int_mat/int_mat_run.c | 94 ++++++++++++++++++++++ test/monniaux/mod_int_mat/modint.h | 41 ++++++++++ 4 files changed, 319 insertions(+) create mode 100644 test/monniaux/mod_int_mat/Makefile create mode 100644 test/monniaux/mod_int_mat/int_mat.c create mode 100644 test/monniaux/mod_int_mat/int_mat_run.c create mode 100644 test/monniaux/mod_int_mat/modint.h (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/Makefile b/test/monniaux/mod_int_mat/Makefile new file mode 100644 index 00000000..be534653 --- /dev/null +++ b/test/monniaux/mod_int_mat/Makefile @@ -0,0 +1,46 @@ +CFLAGS=-Wall -O3 +K1C_CC=k1-mbr-gcc +K1C_CFLAGS=-Wall -O3 -std=c99 +K1C_CCOMP=../../ccomp +K1C_CCOMPFLAGS=-Wall -O3 -D__thread= -D__int128=int + +PRODUCTS=int_mat.host int_mat.gcc.k1c.out int_mat.ccomp.k1c.out int_mat.ccomp.k1c.s int_mat.gcc.k1c.s + +all: $(PRODUCTS) + +%.gcc.k1c.s: %.c + $(K1C_CC) $(K1C_CFLAGS) -S $< -o $@ + +%.gcc.k1c.o: %.gcc.k1c.s + $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ + +%.gcc.k1c.o: %.gcc.k1c.c + $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ + +%.ccomp.k1c.s: %.c + $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -S $< -o $@ + +%.ccomp.k1c.o: %.ccomp.k1c.s + $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ + +%.ccomp.k1c.o: %.ccomp.k1c.c + $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ + +int_mat.host: int_mat.c int_mat_run.c modint.h + $(CC) $(CFLAGS) int_mat.c int_mat_run.c -o $@ + +int_mat.gcc.k1c.s int_mat.ccomp.k1c.s: modint.h + +int_mat.gcc.k1c: int_mat.gcc.k1c.o int_mat_run.gcc.k1c.o + $(K1C_CC) $(K1C_CFLAGS) $+ -o $@ + +int_mat.ccomp.k1c: int_mat.ccomp.k1c.o int_mat_run.gcc.k1c.o + $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -o $@ + +%.k1c.out: %.k1c + k1-cluster --cycle-based -- $< | tee $@ + +clean: + $(RM) -f $(PRODUCTS) int_mat.gcc.k1c.o int_mat.ccomp.k1c.o + +.PHONY: clean diff --git a/test/monniaux/mod_int_mat/int_mat.c b/test/monniaux/mod_int_mat/int_mat.c new file mode 100644 index 00000000..d3e14e26 --- /dev/null +++ b/test/monniaux/mod_int_mat/int_mat.c @@ -0,0 +1,138 @@ +#include "modint.h" + +void modint_mat_mul1(unsigned m, unsigned n, unsigned p, + modint * restrict c, unsigned stride_c, + const modint *a, unsigned stride_a, + const modint *b, unsigned stride_b) { + for(unsigned i=0; i +#include +#include +#include +#include "modint.h" + +typedef uint64_t cycle_t; + +#ifdef __K1C__ +#include +static inline void cycle_count_config(void) +{ + /* config pmc for cycle count */ + uint64_t pmc_value = __builtin_k1_get(K1_SFR_PMC); + + pmc_value &= ~(0xfULL); + __builtin_k1_set(K1_SFR_PMC, pmc_value); +} + +static inline uint64_t get_cycle(void) +{ + return __builtin_k1_get(K1_SFR_PM0); +} +#else +static inline void cycle_count_config(void) { } +#ifdef __x86_64__ +#include +static inline cycle_t get_cycle(void) { return __rdtsc(); } +#else +static inline cycle_t get_cycle(void) { return 0; } +#endif +#endif + +int main() { + const unsigned m = 40, n = 21, p = 30; + cycle_count_config(); + modint *a = malloc(sizeof(modint) * m * n); + modint_mat_random(m, n, a, n); + modint *b = malloc(sizeof(modint) * n * p); + modint_mat_random(n, p, b, p); + + modint *c1 = malloc(sizeof(modint) * m * p); + cycle_t c1_time = get_cycle(); + modint_mat_mul1(m, n, p, c1, p, a, n, b, p); + c1_time = get_cycle()-c1_time; + + modint *c2 = malloc(sizeof(modint) * m * p); + cycle_t c2_time = get_cycle(); + modint_mat_mul2(m, n, p, c2, p, a, n, b, p); + c2_time = get_cycle()-c2_time; + + modint *c3 = malloc(sizeof(modint) * m * p); + cycle_t c3_time = get_cycle(); + modint_mat_mul3(m, n, p, c3, p, a, n, b, p); + c3_time = get_cycle()-c3_time; + + modint *c4 = malloc(sizeof(modint) * m * p); + cycle_t c4_time = get_cycle(); + modint_mat_mul4(m, n, p, c4, p, a, n, b, p); + c4_time = get_cycle()-c4_time; + + modint *c5 = malloc(sizeof(modint) * m * p); + cycle_t c5_time = get_cycle(); + modint_mat_mul5(m, n, p, c5, p, a, n, b, p); + c5_time = get_cycle()-c5_time; + + printf("c1==c2: %s\n" + "c1==c3: %s\n" + "c1==c4: %s\n" + "c1==c5: %s\n" + "c1_time = %" PRIu64 "\n" + "c2_time = %" PRIu64 "\n" + "c3_time = %" PRIu64 "\n" + "c4_time = %" PRIu64 "\n" + "c5_time = %" PRIu64 "\n", + modint_mat_equal(m, n, c1, p, c2, p)?"true":"false", + modint_mat_equal(m, n, c1, p, c3, p)?"true":"false", + modint_mat_equal(m, n, c1, p, c4, p)?"true":"false", + modint_mat_equal(m, n, c1, p, c5, p)?"true":"false", + c1_time, + c2_time, + c3_time, + c4_time, + c5_time); + + free(a); + free(b); + free(c1); + free(c2); + free(c3); + free(c4); + free(c5); + return 0; +} diff --git a/test/monniaux/mod_int_mat/modint.h b/test/monniaux/mod_int_mat/modint.h new file mode 100644 index 00000000..5295258b --- /dev/null +++ b/test/monniaux/mod_int_mat/modint.h @@ -0,0 +1,41 @@ +#include +#include + +typedef uint32_t modint; +#define MODULUS 257 + +void modint_mat_mul1(unsigned m, unsigned n, unsigned p, + modint * restrict c, unsigned stride_c, + const modint *a, unsigned stride_a, + const modint *b, unsigned stride_b); + +void modint_mat_mul2(unsigned m, unsigned n, unsigned p, + modint * restrict c, unsigned stride_c, + const modint *a, unsigned stride_a, + const modint *b, unsigned stride_b); + +void modint_mat_mul3(unsigned m, unsigned n, unsigned p, + modint * restrict c, unsigned stride_c, + const modint *a, unsigned stride_a, + const modint *b, unsigned stride_b); + +void modint_mat_mul4(unsigned m, unsigned n, unsigned p, + modint * restrict c, unsigned stride_c, + const modint *a, unsigned stride_a, + const modint *b, unsigned stride_b); + +void modint_mat_mul5(unsigned m, unsigned n, unsigned p, + modint * restrict c, unsigned stride_c, + const modint *a, unsigned stride_a, + const modint *b, unsigned stride_b); + +modint modint_random(void); + +void modint_mat_random(unsigned m, + unsigned n, + modint *a, unsigned stride_a); + +bool modint_mat_equal(unsigned m, + unsigned n, + const modint *a, unsigned stride_a, + const modint *b, unsigned stride_b); -- cgit From 2a1db308610355d66c6baff004702fd00816e25a Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Fri, 18 Jan 2019 16:09:13 +0100 Subject: adjust path --- test/monniaux/mod_int_mat/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/Makefile b/test/monniaux/mod_int_mat/Makefile index be534653..9a90a4ae 100644 --- a/test/monniaux/mod_int_mat/Makefile +++ b/test/monniaux/mod_int_mat/Makefile @@ -1,7 +1,7 @@ CFLAGS=-Wall -O3 K1C_CC=k1-mbr-gcc K1C_CFLAGS=-Wall -O3 -std=c99 -K1C_CCOMP=../../ccomp +K1C_CCOMP=../../../ccomp K1C_CCOMPFLAGS=-Wall -O3 -D__thread= -D__int128=int PRODUCTS=int_mat.host int_mat.gcc.k1c.out int_mat.ccomp.k1c.out int_mat.ccomp.k1c.s int_mat.gcc.k1c.s -- cgit From a873e3fb7164db2be4641b244a63895dfc0660dd Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Fri, 18 Jan 2019 17:17:23 +0100 Subject: loop transformation --- test/monniaux/mod_int_mat/int_mat.c | 33 +++++++++++++++++++++++++++++++++ test/monniaux/mod_int_mat/int_mat_run.c | 14 ++++++++++++-- test/monniaux/mod_int_mat/modint.h | 5 +++++ 3 files changed, 50 insertions(+), 2 deletions(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/int_mat.c b/test/monniaux/mod_int_mat/int_mat.c index d3e14e26..58f968c1 100644 --- a/test/monniaux/mod_int_mat/int_mat.c +++ b/test/monniaux/mod_int_mat/int_mat.c @@ -109,6 +109,39 @@ void modint_mat_mul5(unsigned m, unsigned n, unsigned p, } } +void modint_mat_mul6(unsigned m, unsigned n, unsigned p, + modint * c, unsigned stride_c, + const modint *a, unsigned stride_a, + const modint *b, unsigned stride_b) { + const modint *pa_i = a; + modint * pc_i = c; + for(unsigned i=0; i 0) { + do { + modint p0 = *pa_i_j * *pb_j_k; + pa_i_j ++; + pb_j_k += stride_b; + modint p1 = *pa_i_j * *pb_j_k; + pa_i_j ++; + pb_j_k += stride_b; + total += p0 + p1; + j2++; + } while (j2 < n2); + } + if (n%2) { + total += *pa_i_j * *pb_j_k; + } + pc_i[k] = total % MODULUS; + } + pa_i += stride_a; + pc_i += stride_c; + } +} + modint modint_random(void) { static uint64_t next = 1325997111; next = next * 1103515245 + 12345; diff --git a/test/monniaux/mod_int_mat/int_mat_run.c b/test/monniaux/mod_int_mat/int_mat_run.c index 9d5c0c57..20d564cc 100644 --- a/test/monniaux/mod_int_mat/int_mat_run.c +++ b/test/monniaux/mod_int_mat/int_mat_run.c @@ -64,24 +64,33 @@ int main() { modint_mat_mul5(m, n, p, c5, p, a, n, b, p); c5_time = get_cycle()-c5_time; + modint *c6 = malloc(sizeof(modint) * m * p); + cycle_t c6_time = get_cycle(); + modint_mat_mul6(m, n, p, c6, p, a, n, b, p); + c6_time = get_cycle()-c6_time; + printf("c1==c2: %s\n" "c1==c3: %s\n" "c1==c4: %s\n" "c1==c5: %s\n" + "c1==c6: %s\n" "c1_time = %" PRIu64 "\n" "c2_time = %" PRIu64 "\n" "c3_time = %" PRIu64 "\n" "c4_time = %" PRIu64 "\n" - "c5_time = %" PRIu64 "\n", + "c5_time = %" PRIu64 "\n" + "c6_time = %" PRIu64 "\n", modint_mat_equal(m, n, c1, p, c2, p)?"true":"false", modint_mat_equal(m, n, c1, p, c3, p)?"true":"false", modint_mat_equal(m, n, c1, p, c4, p)?"true":"false", modint_mat_equal(m, n, c1, p, c5, p)?"true":"false", + modint_mat_equal(m, n, c1, p, c6, p)?"true":"false", c1_time, c2_time, c3_time, c4_time, - c5_time); + c5_time, + c6_time); free(a); free(b); @@ -90,5 +99,6 @@ int main() { free(c3); free(c4); free(c5); + free(c6); return 0; } diff --git a/test/monniaux/mod_int_mat/modint.h b/test/monniaux/mod_int_mat/modint.h index 5295258b..92005455 100644 --- a/test/monniaux/mod_int_mat/modint.h +++ b/test/monniaux/mod_int_mat/modint.h @@ -29,6 +29,11 @@ void modint_mat_mul5(unsigned m, unsigned n, unsigned p, const modint *a, unsigned stride_a, const modint *b, unsigned stride_b); +void modint_mat_mul6(unsigned m, unsigned n, unsigned p, + modint * restrict c, unsigned stride_c, + const modint *a, unsigned stride_a, + const modint *b, unsigned stride_b); + modint modint_random(void); void modint_mat_random(unsigned m, -- cgit From 017d67d668d47fc67038226939653889814cbcac Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Fri, 18 Jan 2019 17:30:07 +0100 Subject: more on matrices --- test/monniaux/mod_int_mat/int_mat.c | 53 +++++++++++++++++++++++++++++++-- test/monniaux/mod_int_mat/int_mat_run.c | 15 ++++++++-- test/monniaux/mod_int_mat/modint.h | 5 ++++ 3 files changed, 68 insertions(+), 5 deletions(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/int_mat.c b/test/monniaux/mod_int_mat/int_mat.c index 58f968c1..0e51d7ba 100644 --- a/test/monniaux/mod_int_mat/int_mat.c +++ b/test/monniaux/mod_int_mat/int_mat.c @@ -122,13 +122,12 @@ void modint_mat_mul6(unsigned m, unsigned n, unsigned p, unsigned j2=0, n2=n/2; if (n2 > 0) { do { - modint p0 = *pa_i_j * *pb_j_k; + total += *pa_i_j * *pb_j_k; pa_i_j ++; pb_j_k += stride_b; - modint p1 = *pa_i_j * *pb_j_k; + total += *pa_i_j * *pb_j_k; pa_i_j ++; pb_j_k += stride_b; - total += p0 + p1; j2++; } while (j2 < n2); } @@ -142,6 +141,54 @@ void modint_mat_mul6(unsigned m, unsigned n, unsigned p, } } +void modint_mat_mul7(unsigned m, unsigned n, unsigned p, + modint * c, unsigned stride_c, + const modint *a, unsigned stride_a, + const modint *b, unsigned stride_b) { + const modint *pa_i = a; + modint * pc_i = c; + for(unsigned i=0; i 0) { + do { + total += *pa_i_j * *pb_j_k; + pa_i_j ++; + pb_j_k += stride_b; + total += *pa_i_j * *pb_j_k; + pa_i_j ++; + pb_j_k += stride_b; + total += *pa_i_j * *pb_j_k; + pa_i_j ++; + pb_j_k += stride_b; + total += *pa_i_j * *pb_j_k; + pa_i_j ++; + pb_j_k += stride_b; + j4++; + } while (j4 < n4); + } + } + { + unsigned j4=0, n4=n%4; + if (n4 > 0) { + do { + total += *pa_i_j * *pb_j_k; + pa_i_j ++; + pb_j_k += stride_b; + j4++; + } while (j4 < n4); + } + } + pc_i[k] = total % MODULUS; + } + pa_i += stride_a; + pc_i += stride_c; + } +} + modint modint_random(void) { static uint64_t next = 1325997111; next = next * 1103515245 + 12345; diff --git a/test/monniaux/mod_int_mat/int_mat_run.c b/test/monniaux/mod_int_mat/int_mat_run.c index 20d564cc..42cb54fb 100644 --- a/test/monniaux/mod_int_mat/int_mat_run.c +++ b/test/monniaux/mod_int_mat/int_mat_run.c @@ -69,28 +69,39 @@ int main() { modint_mat_mul6(m, n, p, c6, p, a, n, b, p); c6_time = get_cycle()-c6_time; + modint *c7 = malloc(sizeof(modint) * m * p); + cycle_t c7_time = get_cycle(); + modint_mat_mul7(m, n, p, c7, p, a, n, b, p); + c7_time = get_cycle()-c7_time; + printf("c1==c2: %s\n" "c1==c3: %s\n" "c1==c4: %s\n" "c1==c5: %s\n" "c1==c6: %s\n" + "c1==c7: %s\n" "c1_time = %" PRIu64 "\n" "c2_time = %" PRIu64 "\n" "c3_time = %" PRIu64 "\n" "c4_time = %" PRIu64 "\n" "c5_time = %" PRIu64 "\n" - "c6_time = %" PRIu64 "\n", + "c6_time = %" PRIu64 "\n" + "c7_time = %" PRIu64 "\n", + modint_mat_equal(m, n, c1, p, c2, p)?"true":"false", modint_mat_equal(m, n, c1, p, c3, p)?"true":"false", modint_mat_equal(m, n, c1, p, c4, p)?"true":"false", modint_mat_equal(m, n, c1, p, c5, p)?"true":"false", modint_mat_equal(m, n, c1, p, c6, p)?"true":"false", + modint_mat_equal(m, n, c1, p, c7, p)?"true":"false", + c1_time, c2_time, c3_time, c4_time, c5_time, - c6_time); + c6_time, + c7_time); free(a); free(b); diff --git a/test/monniaux/mod_int_mat/modint.h b/test/monniaux/mod_int_mat/modint.h index 92005455..15c70a15 100644 --- a/test/monniaux/mod_int_mat/modint.h +++ b/test/monniaux/mod_int_mat/modint.h @@ -34,6 +34,11 @@ void modint_mat_mul6(unsigned m, unsigned n, unsigned p, const modint *a, unsigned stride_a, const modint *b, unsigned stride_b); +void modint_mat_mul7(unsigned m, unsigned n, unsigned p, + modint * restrict c, unsigned stride_c, + const modint *a, unsigned stride_a, + const modint *b, unsigned stride_b); + modint modint_random(void); void modint_mat_random(unsigned m, -- cgit From 91c23dece6e83c1b6566530ecf9467e091934474 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Fri, 18 Jan 2019 21:33:13 +0100 Subject: fix Makefile --- test/monniaux/mod_int_mat/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/Makefile b/test/monniaux/mod_int_mat/Makefile index 9a90a4ae..912d016b 100644 --- a/test/monniaux/mod_int_mat/Makefile +++ b/test/monniaux/mod_int_mat/Makefile @@ -4,7 +4,7 @@ K1C_CFLAGS=-Wall -O3 -std=c99 K1C_CCOMP=../../../ccomp K1C_CCOMPFLAGS=-Wall -O3 -D__thread= -D__int128=int -PRODUCTS=int_mat.host int_mat.gcc.k1c.out int_mat.ccomp.k1c.out int_mat.ccomp.k1c.s int_mat.gcc.k1c.s +PRODUCTS=int_mat.host int_mat.gcc.k1c.out int_mat.ccomp.k1c.out int_mat.ccomp.k1c.s int_mat.gcc.k1c.s int_mat.gcc.k1c int_mat.ccomp.k1c all: $(PRODUCTS) @@ -41,6 +41,6 @@ int_mat.ccomp.k1c: int_mat.ccomp.k1c.o int_mat_run.gcc.k1c.o k1-cluster --cycle-based -- $< | tee $@ clean: - $(RM) -f $(PRODUCTS) int_mat.gcc.k1c.o int_mat.ccomp.k1c.o + $(RM) -f $(PRODUCTS) int_mat.gcc.k1c.o int_mat.ccomp.k1c.o int_mat_run.gcc.k1c.o .PHONY: clean -- cgit From caa53a3dce35e53ed913557f30aef1f063cf67c0 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Sat, 19 Jan 2019 13:21:49 +0100 Subject: fixes in Makefile --- test/monniaux/mod_int_mat/Makefile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/Makefile b/test/monniaux/mod_int_mat/Makefile index 912d016b..b285c03c 100644 --- a/test/monniaux/mod_int_mat/Makefile +++ b/test/monniaux/mod_int_mat/Makefile @@ -14,22 +14,16 @@ all: $(PRODUCTS) %.gcc.k1c.o: %.gcc.k1c.s $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ -%.gcc.k1c.o: %.gcc.k1c.c - $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ - %.ccomp.k1c.s: %.c $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -S $< -o $@ %.ccomp.k1c.o: %.ccomp.k1c.s $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ -%.ccomp.k1c.o: %.ccomp.k1c.c - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ - int_mat.host: int_mat.c int_mat_run.c modint.h $(CC) $(CFLAGS) int_mat.c int_mat_run.c -o $@ -int_mat.gcc.k1c.s int_mat.ccomp.k1c.s: modint.h +int_mat.gcc.k1c.s int_mat.ccomp.k1c.s int_mat_run.gcc.k1c.s: modint.h int_mat.gcc.k1c: int_mat.gcc.k1c.o int_mat_run.gcc.k1c.o $(K1C_CC) $(K1C_CFLAGS) $+ -o $@ -- cgit From 6c5df17a302e99dec62aa749ffc30745cc7679a4 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Sat, 19 Jan 2019 13:33:57 +0100 Subject: quicksort --- test/monniaux/mod_int_mat/int_mat_run.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/int_mat_run.c b/test/monniaux/mod_int_mat/int_mat_run.c index 42cb54fb..f3955345 100644 --- a/test/monniaux/mod_int_mat/int_mat_run.c +++ b/test/monniaux/mod_int_mat/int_mat_run.c @@ -3,33 +3,7 @@ #include #include #include "modint.h" - -typedef uint64_t cycle_t; - -#ifdef __K1C__ -#include -static inline void cycle_count_config(void) -{ - /* config pmc for cycle count */ - uint64_t pmc_value = __builtin_k1_get(K1_SFR_PMC); - - pmc_value &= ~(0xfULL); - __builtin_k1_set(K1_SFR_PMC, pmc_value); -} - -static inline uint64_t get_cycle(void) -{ - return __builtin_k1_get(K1_SFR_PM0); -} -#else -static inline void cycle_count_config(void) { } -#ifdef __x86_64__ -#include -static inline cycle_t get_cycle(void) { return __rdtsc(); } -#else -static inline cycle_t get_cycle(void) { return 0; } -#endif -#endif +#include "../cycles.h" int main() { const unsigned m = 40, n = 21, p = 30; -- cgit From d70a9e55c3595cf7ee84ca9f3b1d5e272a5e3999 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Sat, 19 Jan 2019 13:42:40 +0100 Subject: use a prime in PRNG --- test/monniaux/mod_int_mat/int_mat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/int_mat.c b/test/monniaux/mod_int_mat/int_mat.c index 0e51d7ba..fc763811 100644 --- a/test/monniaux/mod_int_mat/int_mat.c +++ b/test/monniaux/mod_int_mat/int_mat.c @@ -191,7 +191,7 @@ void modint_mat_mul7(unsigned m, unsigned n, unsigned p, modint modint_random(void) { static uint64_t next = 1325997111; - next = next * 1103515245 + 12345; + next = next * 1103515249 + 12345; return next % MODULUS; } -- cgit From d8bef07031a1928e7e071c47f3d3702d4d9a4ca3 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Wed, 30 Jan 2019 16:08:49 +0100 Subject: remove preprocessor directives about SIZE_TYPE, now useless (long is now 8 bytes like in gcc) --- test/monniaux/mod_int_mat/int_mat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/int_mat.c b/test/monniaux/mod_int_mat/int_mat.c index fc763811..167c91fd 100644 --- a/test/monniaux/mod_int_mat/int_mat.c +++ b/test/monniaux/mod_int_mat/int_mat.c @@ -190,7 +190,7 @@ void modint_mat_mul7(unsigned m, unsigned n, unsigned p, } modint modint_random(void) { - static uint64_t next = 1325997111; + static uint32_t next = 1325997111; next = next * 1103515249 + 12345; return next % MODULUS; } -- cgit From d48a2f396dede39eae20fcfe551bb11832360a5b Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Wed, 30 Jan 2019 17:13:15 +0100 Subject: remove cruft dealing with __int128 and __thread --- test/monniaux/mod_int_mat/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/Makefile b/test/monniaux/mod_int_mat/Makefile index b285c03c..f904c1e4 100644 --- a/test/monniaux/mod_int_mat/Makefile +++ b/test/monniaux/mod_int_mat/Makefile @@ -2,7 +2,7 @@ CFLAGS=-Wall -O3 K1C_CC=k1-mbr-gcc K1C_CFLAGS=-Wall -O3 -std=c99 K1C_CCOMP=../../../ccomp -K1C_CCOMPFLAGS=-Wall -O3 -D__thread= -D__int128=int +K1C_CCOMPFLAGS=-Wall -O3 PRODUCTS=int_mat.host int_mat.gcc.k1c.out int_mat.ccomp.k1c.out int_mat.ccomp.k1c.s int_mat.gcc.k1c.s int_mat.gcc.k1c int_mat.ccomp.k1c -- cgit From 4ba61956bec43ad004e37d1ad33c145daddf0ea2 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Thu, 31 Jan 2019 14:26:03 +0100 Subject: bigger matrix --- test/monniaux/mod_int_mat/int_mat_run.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/int_mat_run.c b/test/monniaux/mod_int_mat/int_mat_run.c index f3955345..9ea1edd0 100644 --- a/test/monniaux/mod_int_mat/int_mat_run.c +++ b/test/monniaux/mod_int_mat/int_mat_run.c @@ -6,7 +6,7 @@ #include "../cycles.h" int main() { - const unsigned m = 40, n = 21, p = 30; + const unsigned m = 60, n = 31, p = 50; cycle_count_config(); modint *a = malloc(sizeof(modint) * m * n); modint_mat_random(m, n, a, n); -- cgit From 18540b654ac649d56bfd7261bdc99c7506aaf602 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Mon, 18 Feb 2019 11:41:24 +0100 Subject: forgot to deallocate block -g changes performance --- test/monniaux/mod_int_mat/int_mat_run.c | 1 + 1 file changed, 1 insertion(+) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/int_mat_run.c b/test/monniaux/mod_int_mat/int_mat_run.c index 9ea1edd0..860c248d 100644 --- a/test/monniaux/mod_int_mat/int_mat_run.c +++ b/test/monniaux/mod_int_mat/int_mat_run.c @@ -85,5 +85,6 @@ int main() { free(c4); free(c5); free(c6); + free(c7); return 0; } -- cgit From c0558ea2fd66679eeca136b41c4378ebebb9b3a0 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Fri, 29 Mar 2019 18:30:07 +0100 Subject: use C99 mode --- test/monniaux/mod_int_mat/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/Makefile b/test/monniaux/mod_int_mat/Makefile index f904c1e4..d1365b34 100644 --- a/test/monniaux/mod_int_mat/Makefile +++ b/test/monniaux/mod_int_mat/Makefile @@ -1,4 +1,4 @@ -CFLAGS=-Wall -O3 +CFLAGS=-Wall -O3 -std=c99 K1C_CC=k1-mbr-gcc K1C_CFLAGS=-Wall -O3 -std=c99 K1C_CCOMP=../../../ccomp -- cgit From a789b94e986375a713263d7d7584ceaac01084f2 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Tue, 28 May 2019 15:13:46 +0200 Subject: adaptation pour k1c-cos --- test/monniaux/mod_int_mat/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/monniaux/mod_int_mat') diff --git a/test/monniaux/mod_int_mat/Makefile b/test/monniaux/mod_int_mat/Makefile index d1365b34..08b97b67 100644 --- a/test/monniaux/mod_int_mat/Makefile +++ b/test/monniaux/mod_int_mat/Makefile @@ -1,5 +1,5 @@ CFLAGS=-Wall -O3 -std=c99 -K1C_CC=k1-mbr-gcc +K1C_CC=k1-cos-gcc K1C_CFLAGS=-Wall -O3 -std=c99 K1C_CCOMP=../../../ccomp K1C_CCOMPFLAGS=-Wall -O3 -- cgit