aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2019-05-17 10:49:20 +0200
committerCyril SIX <cyril.six@kalray.eu>2019-05-17 10:49:20 +0200
commite3b4b3280ffd0d57d4f40f5ca253a1c570ddd6c6 (patch)
tree611d2f5aaeaa327bbc14466047d56693a40d4375 /test
parent271177a4df951407ef0aed295364d11e292b40e0 (diff)
parent2b61ab1ac7b91ada112ca143410dbafbfc46b57c (diff)
downloadcompcert-kvx-e3b4b3280ffd0d57d4f40f5ca253a1c570ddd6c6.tar.gz
compcert-kvx-e3b4b3280ffd0d57d4f40f5ca253a1c570ddd6c6.zip
Merge branch 'mppa_k1c' into mppa-abstractbb-dev
Diffstat (limited to 'test')
-rw-r--r--test/monniaux/benches.list2
-rw-r--r--test/monniaux/binary_search/make.proto1
-rw-r--r--test/monniaux/bitsliced-aes/make.proto2
-rw-r--r--test/monniaux/bitsliced-tea/make.proto2
-rwxr-xr-xtest/monniaux/build_benches.sh (renamed from test/monniaux/run_makefiles.sh)0
-rwxr-xr-xtest/monniaux/clean_csv.sh9
-rw-r--r--test/monniaux/complex/complex_mat.c6
-rw-r--r--test/monniaux/complex/make.proto1
-rwxr-xr-xtest/monniaux/generate_makefiles.sh1
-rwxr-xr-xtest/monniaux/genmake.py25
-rw-r--r--test/monniaux/lustrev4_lv4_heater_control/heater_control.c275
-rw-r--r--test/monniaux/lustrev4_lv4_heater_control/heater_control.h47
-rw-r--r--test/monniaux/lustrev4_lv4_heater_control/heater_control.lus126
-rw-r--r--test/monniaux/lustrev4_lv4_heater_control/heater_control_loop.c64
-rw-r--r--test/monniaux/lustrev4_lv6-en-2cgc_heater_control/heater_control_heater_control.c27
-rw-r--r--test/monniaux/lustrev6-carlightV2/carlightV2_carlight.c (renamed from test/monniaux/lustre-carlightV2/carlightV2_carlight.c)0
-rw-r--r--test/monniaux/lustrev6-carlightV2/carlightV2_carlight.h (renamed from test/monniaux/lustre-carlightV2/carlightV2_carlight.h)0
-rw-r--r--test/monniaux/lustrev6-carlightV2/carlightV2_carlight_loop.c (renamed from test/monniaux/lustre-carlightV2/carlightV2_carlight_loop.c)0
-rw-r--r--test/monniaux/lustrev6-carlightV2/lustre_consts.c (renamed from test/monniaux/lustre-carlightV2/lustre_consts.c)0
-rw-r--r--test/monniaux/lustrev6-carlightV2/lustre_consts.h (renamed from test/monniaux/lustre-carlightV2/lustre_consts.h)0
-rw-r--r--test/monniaux/lustrev6-carlightV2/lustre_types.h (renamed from test/monniaux/lustre-carlightV2/lustre_types.h)0
-rw-r--r--test/monniaux/lustrev6-convertible-2cgc/convertible_main.c (renamed from test/monniaux/lustre-convertible-2cgc/convertible_main.c)0
-rw-r--r--test/monniaux/lustrev6-convertible-2cgc/convertible_main.h (renamed from test/monniaux/lustre-convertible-2cgc/convertible_main.h)0
-rw-r--r--test/monniaux/lustrev6-convertible-2cgc/convertible_main_loop.c (renamed from test/monniaux/lustre-convertible-2cgc/convertible_main_loop.c)0
-rw-r--r--test/monniaux/lustrev6-convertible-2cgc/lustre_consts.c (renamed from test/monniaux/lustre-convertible-2cgc/lustre_consts.c)0
-rw-r--r--test/monniaux/lustrev6-convertible-2cgc/lustre_consts.h (renamed from test/monniaux/lustre-convertible-2cgc/lustre_consts.h)0
-rw-r--r--test/monniaux/lustrev6-convertible-2cgc/lustre_types.h (renamed from test/monniaux/lustre-convertible-2cgc/lustre_types.h)0
-rw-r--r--test/monniaux/lustrev6-convertible-en-2cgc/convertible_main.c (renamed from test/monniaux/lustre-convertible-en-2cgc/convertible_main.c)0
-rw-r--r--test/monniaux/lustrev6-convertible-en-2cgc/convertible_main.h (renamed from test/monniaux/lustre-convertible-en-2cgc/convertible_main.h)0
-rw-r--r--test/monniaux/lustrev6-convertible-en-2cgc/convertible_main_loop.c (renamed from test/monniaux/lustre-convertible-en-2cgc/convertible_main_loop.c)0
-rw-r--r--test/monniaux/lustrev6-convertible-en-2cgc/lustre_consts.c (renamed from test/monniaux/lustre-convertible-en-2cgc/lustre_consts.c)0
-rw-r--r--test/monniaux/lustrev6-convertible-en-2cgc/lustre_consts.h (renamed from test/monniaux/lustre-convertible-en-2cgc/lustre_consts.h)0
-rw-r--r--test/monniaux/lustrev6-convertible-en-2cgc/lustre_types.h (renamed from test/monniaux/lustre-convertible-en-2cgc/lustre_types.h)0
-rw-r--r--test/monniaux/lustrev6-convertible/convertible_main.c (renamed from test/monniaux/lustre-convertible/convertible_main.c)0
-rw-r--r--test/monniaux/lustrev6-convertible/convertible_main.h (renamed from test/monniaux/lustre-convertible/convertible_main.h)0
-rw-r--r--test/monniaux/lustrev6-convertible/convertible_main_loop.c (renamed from test/monniaux/lustre-convertible/convertible_main_loop.c)0
-rw-r--r--test/monniaux/lustrev6-convertible/lustre_consts.c (renamed from test/monniaux/lustre-convertible/lustre_consts.c)0
-rw-r--r--test/monniaux/lustrev6-convertible/lustre_consts.h (renamed from test/monniaux/lustre-convertible/lustre_consts.h)0
-rw-r--r--test/monniaux/lustrev6-convertible/lustre_types.h (renamed from test/monniaux/lustre-convertible/lustre_types.h)0
-rw-r--r--test/monniaux/number_theoretic_transform/ntt.c23
-rwxr-xr-xtest/monniaux/run_benches.sh23
41 files changed, 612 insertions, 22 deletions
diff --git a/test/monniaux/benches.list b/test/monniaux/benches.list
deleted file mode 100644
index ff62dd4e..00000000
--- a/test/monniaux/benches.list
+++ /dev/null
@@ -1,2 +0,0 @@
- binary_search bitslicedaes bitslicedtea complex float_mat glibc_qsort heapsort idea number_theoretic_transform quicksort sha2 taclebenchlift taclebenchpowerwindow ternary too_slow
-
diff --git a/test/monniaux/binary_search/make.proto b/test/monniaux/binary_search/make.proto
index 69f04092..c5c39a6b 100644
--- a/test/monniaux/binary_search/make.proto
+++ b/test/monniaux/binary_search/make.proto
@@ -1 +1,2 @@
target: binary_search
+measures: ["random fill", "search1"]
diff --git a/test/monniaux/bitsliced-aes/make.proto b/test/monniaux/bitsliced-aes/make.proto
index 530d7e36..5fb11e5f 100644
--- a/test/monniaux/bitsliced-aes/make.proto
+++ b/test/monniaux/bitsliced-aes/make.proto
@@ -1,2 +1,4 @@
sources: "$(wildcard *.c) tests/tests.c"
target: test
+measures: ["cycles"]
+name: bitsliced-aes
diff --git a/test/monniaux/bitsliced-tea/make.proto b/test/monniaux/bitsliced-tea/make.proto
index 7ddc95d2..09113280 100644
--- a/test/monniaux/bitsliced-tea/make.proto
+++ b/test/monniaux/bitsliced-tea/make.proto
@@ -1,2 +1,4 @@
objdeps: [{name: bstea_run, compiler: gcc}]
target: bstea
+name: bitsliced-tea
+measures: ["cycles"]
diff --git a/test/monniaux/run_makefiles.sh b/test/monniaux/build_benches.sh
index 02123665..02123665 100755
--- a/test/monniaux/run_makefiles.sh
+++ b/test/monniaux/build_benches.sh
diff --git a/test/monniaux/clean_csv.sh b/test/monniaux/clean_csv.sh
new file mode 100755
index 00000000..e480aa5a
--- /dev/null
+++ b/test/monniaux/clean_csv.sh
@@ -0,0 +1,9 @@
+
+source benches.sh
+
+rm -f commands.txt
+for bench in $benches; do
+ (cd $bench && rm *.csv)
+done
+
+rm measures.csv
diff --git a/test/monniaux/complex/complex_mat.c b/test/monniaux/complex/complex_mat.c
index 6c7dae1d..b7103f60 100644
--- a/test/monniaux/complex/complex_mat.c
+++ b/test/monniaux/complex/complex_mat.c
@@ -227,9 +227,9 @@ int main() {
printf("c1==c8: %s\n"
"c1==c9: %s\n"
- "c1_time = %" PRIu64 "\n"
- "c8_time = %" PRIu64 "\n"
- "c9_time = %" PRIu64 "\n",
+ "c1_time : %" PRIu64 "\n"
+ "c8_time : %" PRIu64 "\n"
+ "c9_time : %" PRIu64 "\n",
COMPLEX_mat_equal(m, n, c1, p, c8, p)?"true":"false",
COMPLEX_mat_equal(m, n, c1, p, c9, p)?"true":"false",
diff --git a/test/monniaux/complex/make.proto b/test/monniaux/complex/make.proto
index b4d1222f..b959c611 100644
--- a/test/monniaux/complex/make.proto
+++ b/test/monniaux/complex/make.proto
@@ -1 +1,2 @@
target: complex_mat
+measures: ["c1_time"]
diff --git a/test/monniaux/generate_makefiles.sh b/test/monniaux/generate_makefiles.sh
index 14a6bd92..1c05538f 100755
--- a/test/monniaux/generate_makefiles.sh
+++ b/test/monniaux/generate_makefiles.sh
@@ -5,3 +5,4 @@ source benches.sh
for bench in $benches; do
./genmake.py $bench/make.proto > $bench/Makefile
done
+
diff --git a/test/monniaux/genmake.py b/test/monniaux/genmake.py
index c0fe0d05..ddbdf839 100755
--- a/test/monniaux/genmake.py
+++ b/test/monniaux/genmake.py
@@ -42,6 +42,8 @@ basename = settings["target"]
objdeps = settings["objdeps"] if "objdeps" in settings else []
intro = settings["intro"] if "intro" in settings else ""
sources = settings["sources"] if "sources" in settings else None
+measures = settings["measures"] if "measures" in settings else []
+name = settings["name"] if "name" in settings else None
if sources:
intro += "\nsrc=" + sources
@@ -77,6 +79,22 @@ def print_rule(env, optim):
print(" {compiler} {flags} $+ -o $@"
.format(compiler = env.compiler.full, flags = optim.full))
+def make_env_list(envs):
+ return ",".join([(env.compiler.short + ((" " + optim.short) if optim.short != "" else "") + " " + env.target)
+ for env in environments
+ for optim in env.optimizations])
+
+def print_measure_rule(environments, measures):
+ print("measures.csv: $(PRODUCTS_OUT)")
+ print(' echo ", {}" > $@'.format(make_env_list(environments)))
+ for measure in measures:
+ print(' echo "{name} {measure}"'.format(name=basename if not name else name, measure=measure if len(measures) > 1 else ""), end="")
+ for env in environments:
+ for optim in env.optimizations:
+ print(", $$(grep '{measure}' {outfile} | cut -d':' -f2)".format(
+ measure=measure, outfile=make_product(env, optim) + ".out"), end="")
+ print('>> $@')
+
products = []
for env in environments:
for optim in env.optimizations:
@@ -93,7 +111,7 @@ PRODUCTS_OUT=$(addsuffix .out,$(PRODUCTS))
all: $(PRODUCTS)
.PHONY:
-exec: $(PRODUCTS_OUT)
+run: measures.csv
""".format(intro=intro, prod=" ".join(products)))
@@ -101,8 +119,11 @@ for env in environments:
for optim in env.optimizations:
print_rule(env, optim)
+print_measure_rule(environments, measures)
+
+
print("""
.PHONY:
clean:
- rm -f *.o *.s *.k1c
+ rm -f *.o *.s *.k1c *.csv
""")
diff --git a/test/monniaux/lustrev4_lv4_heater_control/heater_control.c b/test/monniaux/lustrev4_lv4_heater_control/heater_control.c
new file mode 100644
index 00000000..4a2b8174
--- /dev/null
+++ b/test/monniaux/lustrev4_lv4_heater_control/heater_control.c
@@ -0,0 +1,275 @@
+/********
+* ec2c version 0.67
+* c file generated for node : heater_control
+* context method = HEAP
+* ext call method = PROCEDURES
+********/
+#include <stdlib.h>
+#include <string.h>
+#define _heater_control_EC2C_SRC_FILE
+#include "heater_control.h"
+/*--------
+Internal structure for the call
+--------*/
+typedef struct {
+ void* client_data;
+ //INPUTS
+ _real _T;
+ _real _T1;
+ _real _T2;
+ _real _T3;
+ //OUTPUTS
+ _boolean _Heat_on;
+ //REGISTERS
+ _boolean M73;
+ _boolean M73_nil;
+ _boolean M5;
+} heater_control_ctx;
+/*--------
+Output procedures must be defined,
+Input procedures must be used:
+--------*/
+void heater_control_I_T(heater_control_ctx* ctx, _real V){
+ ctx->_T = V;
+}
+void heater_control_I_T1(heater_control_ctx* ctx, _real V){
+ ctx->_T1 = V;
+}
+void heater_control_I_T2(heater_control_ctx* ctx, _real V){
+ ctx->_T2 = V;
+}
+void heater_control_I_T3(heater_control_ctx* ctx, _real V){
+ ctx->_T3 = V;
+}
+extern void heater_control_O_Heat_on(void* cdata, _boolean);
+#ifdef CKCHECK
+extern void heater_control_BOT_Heat_on(void* cdata);
+#endif
+/*--------
+Internal reset input procedure
+--------*/
+static void heater_control_reset_input(heater_control_ctx* ctx){
+ //NOTHING FOR THIS VERSION...
+}
+/*--------
+Reset procedure
+--------*/
+void heater_control_reset(heater_control_ctx* ctx){
+ ctx->M73_nil = _true;
+ ctx->M5 = _true;
+ heater_control_reset_input(ctx);
+}
+/*--------
+Copy the value of an internal structure
+--------*/
+void heater_control_copy_ctx(heater_control_ctx* dest, heater_control_ctx
+* src){
+ memcpy((void*)dest, (void*)src, sizeof(heater_control_ctx));
+}
+/*--------
+Dynamic allocation of an internal structure
+--------*/
+heater_control_ctx* heater_control_new_ctx(void* cdata){
+ heater_control_ctx* ctx = (heater_control_ctx*)calloc(1, sizeof(
+heater_control_ctx));
+ ctx->client_data = cdata;
+ heater_control_reset(ctx);
+ return ctx;
+}
+/*--------
+Step procedure
+--------*/
+void heater_control_step(heater_control_ctx* ctx){
+//LOCAL VARIABLES
+ _real L16;
+ _boolean L15;
+ _real L18;
+ _real L14;
+ _boolean L13;
+ _boolean L12;
+ _real L24;
+ _boolean L23;
+ _real L25;
+ _real L22;
+ _boolean L21;
+ _boolean L20;
+ _boolean L11;
+ _real L30;
+ _boolean L29;
+ _real L31;
+ _real L28;
+ _boolean L27;
+ _boolean L26;
+ _boolean L10;
+ _real L32;
+ _boolean L38;
+ _boolean L37;
+ _boolean L40;
+ _boolean L39;
+ _boolean L36;
+ _boolean L42;
+ _boolean L41;
+ _boolean L35;
+ _real L46;
+ _real L45;
+ _boolean L50;
+ _real L49;
+ _boolean L48;
+ _real L47;
+ _real L44;
+ _boolean L54;
+ _real L53;
+ _boolean L52;
+ _real L51;
+ _real L43;
+ _boolean L57;
+ _boolean L56;
+ _real L59;
+ _real L63;
+ _real L62;
+ _real L65;
+ _real L64;
+ _real L61;
+ _real L58;
+ _real L55;
+ _real L34;
+ _real L9;
+ _boolean L8;
+ _boolean L68;
+ _boolean L71;
+ _boolean L70;
+ _boolean L67;
+ _boolean L7;
+ _boolean L4;
+ _boolean T73;
+//CODE
+ L16 = (ctx->_T1 - ctx->_T2);
+ L15 = (L16 >= 0.000000);
+ L18 = (- L16);
+ if (L15) {
+ L14 = L16;
+ } else {
+ L14 = L18;
+ }
+ L13 = (L14 < 0.500000);
+ L12 = (! L13);
+ L24 = (ctx->_T1 - ctx->_T3);
+ L23 = (L24 >= 0.000000);
+ L25 = (- L24);
+ if (L23) {
+ L22 = L24;
+ } else {
+ L22 = L25;
+ }
+ L21 = (L22 < 0.500000);
+ L20 = (! L21);
+ L11 = (L12 && L20);
+ L30 = (ctx->_T2 - ctx->_T3);
+ L29 = (L30 >= 0.000000);
+ L31 = (- L30);
+ if (L29) {
+ L28 = L30;
+ } else {
+ L28 = L31;
+ }
+ L27 = (L28 < 0.500000);
+ L26 = (! L27);
+ L10 = (L11 && L26);
+ L32 = (- 999.000000);
+ L38 = (L13 && L20);
+ L37 = (L38 && L26);
+ L40 = (L21 && L12);
+ L39 = (L40 && L26);
+ L36 = (L37 || L39);
+ L42 = (L27 && L12);
+ L41 = (L42 && L20);
+ L35 = (L36 || L41);
+ L46 = (ctx->_T1 + ctx->_T2);
+ L45 = (L46 + ctx->_T3);
+ L50 = (ctx->_T2 < ctx->_T3);
+ if (L50) {
+ L49 = ctx->_T2;
+ } else {
+ L49 = ctx->_T3;
+ }
+ L48 = (ctx->_T1 < L49);
+ if (L48) {
+ L47 = ctx->_T1;
+ } else {
+ L47 = L49;
+ }
+ L44 = (L45 - L47);
+ L54 = (ctx->_T2 > ctx->_T3);
+ if (L54) {
+ L53 = ctx->_T2;
+ } else {
+ L53 = ctx->_T3;
+ }
+ L52 = (ctx->_T1 > L53);
+ if (L52) {
+ L51 = ctx->_T1;
+ } else {
+ L51 = L53;
+ }
+ L43 = (L44 - L51);
+ L57 = (L13 && L21);
+ L56 = (L57 && L27);
+ L59 = (L46 / 2.000000);
+ L63 = (ctx->_T1 + ctx->_T3);
+ L62 = (L63 / 2.000000);
+ L65 = (ctx->_T2 + ctx->_T3);
+ L64 = (L65 / 2.000000);
+ if (L21) {
+ L61 = L62;
+ } else {
+ L61 = L64;
+ }
+ if (L13) {
+ L58 = L59;
+ } else {
+ L58 = L61;
+ }
+ if (L56) {
+ L55 = L43;
+ } else {
+ L55 = L58;
+ }
+ if (L35) {
+ L34 = L43;
+ } else {
+ L34 = L55;
+ }
+ if (L10) {
+ L9 = L32;
+ } else {
+ L9 = L34;
+ }
+ L8 = (L9 == L32);
+ L68 = (L9 < 6.000000);
+ L71 = (L9 > 9.000000);
+ if (L71) {
+ L70 = _false;
+ } else {
+ L70 = ctx->M73;
+ }
+ if (L68) {
+ L67 = _true;
+ } else {
+ L67 = L70;
+ }
+ if (L8) {
+ L7 = _false;
+ } else {
+ L7 = L67;
+ }
+ if (ctx->M5) {
+ L4 = _true;
+ } else {
+ L4 = L7;
+ }
+ heater_control_O_Heat_on(ctx->client_data, L4);
+ T73 = L4;
+ ctx->M73 = T73;
+ ctx->M73_nil = _false;
+ ctx->M5 = ctx->M5 && !(_true);
+}
diff --git a/test/monniaux/lustrev4_lv4_heater_control/heater_control.h b/test/monniaux/lustrev4_lv4_heater_control/heater_control.h
new file mode 100644
index 00000000..64be774b
--- /dev/null
+++ b/test/monniaux/lustrev4_lv4_heater_control/heater_control.h
@@ -0,0 +1,47 @@
+/********
+* ec2c version 0.67
+* context method = HEAP
+* ext call method = PROCEDURES
+* c header file generated for node : heater_control
+* to be used with : heater_control.c
+********/
+#ifndef _heater_control_EC2C_H_FILE
+#define _heater_control_EC2C_H_FILE
+/*-------- Predefined types ---------*/
+#ifndef _EC2C_PREDEF_TYPES
+#define _EC2C_PREDEF_TYPES
+typedef int _boolean;
+typedef int _integer;
+typedef char* _string;
+typedef double _real;
+typedef double _double;
+typedef float _float;
+#define _false 0
+#define _true 1
+#endif
+/*--------- Pragmas ----------------*/
+//MODULE: heater_control 4 1
+//IN: _real T
+//IN: _real T1
+//IN: _real T2
+//IN: _real T3
+//OUT: _boolean Heat_on
+#ifndef _heater_control_EC2C_SRC_FILE
+/*--------Context type -------------*/
+struct heater_control_ctx;
+/*-------- Input procedures -------------*/
+extern void heater_control_I_T(struct heater_control_ctx* ctx, _real);
+extern void heater_control_I_T1(struct heater_control_ctx* ctx, _real);
+extern void heater_control_I_T2(struct heater_control_ctx* ctx, _real);
+extern void heater_control_I_T3(struct heater_control_ctx* ctx, _real);
+/*-------- Reset procedure -----------*/
+extern void heater_control_reset(struct heater_control_ctx* ctx);
+/*--------Context copy -------------*/
+extern void heater_control_copy_ctx(struct heater_control_ctx* dest, struct
+heater_control_ctx* src);
+/*--------Context allocation --------*/
+extern struct heater_control_ctx* heater_control_new_ctx(void* client_data);
+/*-------- Step procedure -----------*/
+extern void heater_control_step(struct heater_control_ctx* ctx);
+#endif
+#endif
diff --git a/test/monniaux/lustrev4_lv4_heater_control/heater_control.lus b/test/monniaux/lustrev4_lv4_heater_control/heater_control.lus
new file mode 100644
index 00000000..5d0db95f
--- /dev/null
+++ b/test/monniaux/lustrev4_lv4_heater_control/heater_control.lus
@@ -0,0 +1,126 @@
+--
+-- A fault-tolerant heater controller with 3 sensors.
+--
+-- To guess the temperature (T),
+--
+-- (1) It compares the value of the 3 sensors 2 by 2 to determine
+-- which ones seem are broken -- we consider then broken if they
+-- differ too much.
+--
+-- (2) then, it performs a vote:
+-- o If the tree sensors are broken, it does not heat;
+-- o If the temperature is bigger than TMAX, it does not heat;
+-- o If the temperature is smaller than TMIN, it heats;
+-- o Otherwise, it keeps its previous state.
+
+
+const FAILURE = -999.0; -- a fake temperature given when all sensors are broken
+const TMIN = 6.0;
+const TMAX = 9.0;
+
+
+const DELTA = 0.5;
+-- const DELTA : real;
+
+-----------------------------------------------------------------------
+-----------------------------------------------------------------------
+node heater_control(T, T1, T2, T3 : real) returns (Heat_on:bool);
+-- T is supposed to be the real temperature and is not
+-- used in the controller; we add it here in oder to test the
+-- controller to be able to write a sensible oracle.
+
+
+var
+ V12, V13, V23 : bool;
+ Tguess : real;
+
+let
+ V12 = abs(T1-T2) < DELTA; -- Are T1 and T2 valid?
+ V13 = abs(T1-T3) < DELTA; -- Are T1 and T3 valid?
+ V23 = abs(T2-T3) < DELTA; -- Are T2 and T3 valid?
+
+ Tguess =
+ if noneoftree(V12, V13, V23) then FAILURE else
+ if oneoftree(V12, V13, V23) then Median(T1, T2, T3) else
+ if alloftree(V12, V13, V23) then Median(T1, T2, T3) else
+ -- 2 among V1, V2, V3 are false
+ if V12 then Average(T1, T2) else
+ if V13 then Average(T1, T3) else
+ -- V23 is necessarily true, hence T1 is wrong
+ Average(T2, T3) ;
+
+ Heat_on = true ->
+ if Tguess = FAILURE then false else
+ if Tguess < TMIN then true else
+ if Tguess > TMAX then false else
+ pre Heat_on;
+tel
+
+
+-----------------------------------------------------------------------
+-----------------------------------------------------------------------
+node not_a_sauna(T, T1, T2, T3 : real; Heat_on: bool) returns (ok:bool);
+
+let
+ ok = true -> pre T < TMAX + 1.0 ;
+tel
+
+node not_a_sauna2(T, T1, T2, T3 : real; Heat_on: bool) returns (ok:bool);
+
+let
+ ok = true -> pre T < TMAX - 6.0 ;
+tel
+
+
+
+-----------------------------------------------------------------------
+-----------------------------------------------------------------------
+
+-- returns the absolute value of 2 reals
+node abs (v : real) returns (a : real) ;
+let
+ a = if v >= 0.0 then v else -v ;
+tel
+
+-- returns the average values of 2 reals
+node Average(a, b: real) returns (z : real);
+let
+ z = (a+b)/2.0 ;
+tel
+
+-- returns the median values of 3 reals
+node Median(a, b, c : real) returns (z : real);
+let
+ z = a + b + c - min2 (a, min2(b,c)) - max2 (a, max2(b,c)) ;
+tel
+
+
+-- returns the maximum values of 2 reals
+node max2 (one, two : real) returns (m : real) ;
+let
+ m = if one > two then one else two ;
+tel
+
+-- returns the minimum values of 2 reals
+node min2 (one, two : real) returns (m : real) ;
+let
+ m = if one < two then one else two ;
+tel
+
+
+node noneoftree (f1, f2, f3 : bool) returns (r : bool)
+let
+ r = not f1 and not f2 and not f3 ;
+tel
+
+node alloftree (f1, f2, f3 : bool) returns (r : bool)
+let
+ r = f1 and f2 and f3 ;
+tel
+
+node oneoftree (f1, f2, f3 : bool) returns (r : bool)
+let
+ r = f1 and not f2 and not f3 or
+ f2 and not f1 and not f3 or
+ f3 and not f1 and not f2 ;
+tel
diff --git a/test/monniaux/lustrev4_lv4_heater_control/heater_control_loop.c b/test/monniaux/lustrev4_lv4_heater_control/heater_control_loop.c
new file mode 100644
index 00000000..06bad418
--- /dev/null
+++ b/test/monniaux/lustrev4_lv4_heater_control/heater_control_loop.c
@@ -0,0 +1,64 @@
+/********
+* ec2c version 0.67
+* c main file generated for node : heater_control
+* to be used with : heater_control.c
+* and : heater_control.h
+* context method = HEAP
+* ext call method = PROCEDURES
+********/
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include "../clock.h"
+#include "../dm_random.c"
+#include "heater_control.h"
+
+/* Print a promt ? ************************/
+static int ISATTY;
+/* MACROS DEFINITIONS ****************/
+#ifndef TT
+#define TT "true"
+#endif
+#ifndef FF
+#define FF "false"
+#endif
+#ifndef BB
+#define BB "bottom"
+#endif
+#ifdef CKCHECK
+/* set this macro for testing output clocks */
+#endif
+
+/* Standard Input procedures **************/
+_real _get_real(char* n){
+ return (dm_random_uint32()%70000U) * 1E-3 -20.0;
+}
+/* Standard Output procedures **************/
+void _put_bool(char* n, _boolean b){
+ printf("%s: %d\n", n, b);
+}
+/* Output procedures **********************/
+void heater_control_O_Heat_on(void* cdata, _boolean _V) {
+ // _put_bool("Heat_on", _V);
+}
+/* Main procedure *************************/
+int main(){
+
+ /* Context allocation */
+ struct heater_control_ctx* ctx = heater_control_new_ctx(NULL);
+ /* Main loop */
+ clock_prepare();
+ clock_start();
+ heater_control_reset(ctx);
+ for(int count=0; count<1000; count++){
+ heater_control_I_T(ctx, _get_real("T"));
+ heater_control_I_T1(ctx, _get_real("T1"));
+ heater_control_I_T2(ctx, _get_real("T2"));
+ heater_control_I_T3(ctx, _get_real("T3"));
+ heater_control_step(ctx);
+
+ }
+ clock_stop();
+ print_total_clock();
+ return 0;
+}
diff --git a/test/monniaux/lustrev4_lv6-en-2cgc_heater_control/heater_control_heater_control.c b/test/monniaux/lustrev4_lv6-en-2cgc_heater_control/heater_control_heater_control.c
index 1b3cb947..b3995c61 100644
--- a/test/monniaux/lustrev4_lv6-en-2cgc_heater_control/heater_control_heater_control.c
+++ b/test/monniaux/lustrev4_lv6-en-2cgc_heater_control/heater_control_heater_control.c
@@ -4,52 +4,59 @@
#include "heater_control_heater_control.h"
//// Defining step functions
// Memory initialisation for Lustre_arrow_ctx
-void Lustre_arrow_ctx_reset(Lustre_arrow_ctx_type* ctx){
+#define DM_INLINE inline
+
+DM_INLINE void Lustre_arrow_ctx_reset(Lustre_arrow_ctx_type* ctx){
int _i;
ctx->_memory = _true;
}
// Initialisation of the internal structure of Lustre_arrow_ctx
-void Lustre_arrow_ctx_init(Lustre_arrow_ctx_type* ctx){
+DM_INLINE void Lustre_arrow_ctx_init(Lustre_arrow_ctx_type* ctx){
// ctx->client_data = cdata;
Lustre_arrow_ctx_reset(ctx);
}
// Step function(s) for Lustre_arrow_ctx
-void Lustre_arrow_step(_boolean i1,_boolean i2,_boolean *out,Lustre_arrow_ctx_type* ctx){ *out = ((ctx->_memory)? i1 : i2);
+DM_INLINE void Lustre_arrow_step(_boolean i1,_boolean i2,_boolean *out,Lustre_arrow_ctx_type* ctx){ *out = ((ctx->_memory)? i1 : i2);
ctx->_memory = _false;
} // End of Lustre_arrow_step
// Memory initialisation for Lustre_pre_ctx
-void Lustre_pre_ctx_reset(Lustre_pre_ctx_type* ctx){
+DM_INLINE void Lustre_pre_ctx_reset(Lustre_pre_ctx_type* ctx){
int _i;
}
// Initialisation of the internal structure of Lustre_pre_ctx
-void Lustre_pre_ctx_init(Lustre_pre_ctx_type* ctx){
+DM_INLINE void Lustre_pre_ctx_init(Lustre_pre_ctx_type* ctx){
// ctx->client_data = cdata;
Lustre_pre_ctx_reset(ctx);
}
// Step function(s) for Lustre_pre_ctx
-void Lustre_pre_get(_boolean *out,Lustre_pre_ctx_type* ctx){
+DM_INLINE void Lustre_pre_get(_boolean *out,Lustre_pre_ctx_type* ctx){
*out = ctx->_memory;
} // End of Lustre_pre_get
-void Lustre_pre_set(_boolean i1,Lustre_pre_ctx_type* ctx){
+DM_INLINE void Lustre_pre_set(_boolean i1,Lustre_pre_ctx_type* ctx){
ctx->_memory = i1;
} // End of Lustre_pre_set
// Step function(s) for Lustre_slash_ctx
-void Lustre_slash_step(_real i1,_real i2,_real *out){
+#if 0
+DM_INLINE void Lustre_slash_step(_real i1,_real i2,_real *out){
*out = (i1 / i2);
-} // End of Lustre_slash_step
+}
+#else
+#define Lustre_slash_step(x, y, out) *out = x/y
+#endif
+// End of Lustre_slash_step
// Memory initialisation for heater_control_heater_control_ctx
-void heater_control_heater_control_ctx_reset(heater_control_heater_control_ctx_type* ctx){
+DM_INLINE void heater_control_heater_control_ctx_reset(heater_control_heater_control_ctx_type* ctx){
int _i;
Lustre_pre_ctx_reset(&ctx->Lustre_pre_ctx_tab[0]);
diff --git a/test/monniaux/lustre-carlightV2/carlightV2_carlight.c b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight.c
index 206f854a..206f854a 100644
--- a/test/monniaux/lustre-carlightV2/carlightV2_carlight.c
+++ b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight.c
diff --git a/test/monniaux/lustre-carlightV2/carlightV2_carlight.h b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight.h
index c56c8fa1..c56c8fa1 100644
--- a/test/monniaux/lustre-carlightV2/carlightV2_carlight.h
+++ b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight.h
diff --git a/test/monniaux/lustre-carlightV2/carlightV2_carlight_loop.c b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight_loop.c
index a9b4417a..a9b4417a 100644
--- a/test/monniaux/lustre-carlightV2/carlightV2_carlight_loop.c
+++ b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight_loop.c
diff --git a/test/monniaux/lustre-carlightV2/lustre_consts.c b/test/monniaux/lustrev6-carlightV2/lustre_consts.c
index e1a77c9e..e1a77c9e 100644
--- a/test/monniaux/lustre-carlightV2/lustre_consts.c
+++ b/test/monniaux/lustrev6-carlightV2/lustre_consts.c
diff --git a/test/monniaux/lustre-carlightV2/lustre_consts.h b/test/monniaux/lustrev6-carlightV2/lustre_consts.h
index 9d651d25..9d651d25 100644
--- a/test/monniaux/lustre-carlightV2/lustre_consts.h
+++ b/test/monniaux/lustrev6-carlightV2/lustre_consts.h
diff --git a/test/monniaux/lustre-carlightV2/lustre_types.h b/test/monniaux/lustrev6-carlightV2/lustre_types.h
index e1cfb463..e1cfb463 100644
--- a/test/monniaux/lustre-carlightV2/lustre_types.h
+++ b/test/monniaux/lustrev6-carlightV2/lustre_types.h
diff --git a/test/monniaux/lustre-convertible-2cgc/convertible_main.c b/test/monniaux/lustrev6-convertible-2cgc/convertible_main.c
index 285f8941..285f8941 100644
--- a/test/monniaux/lustre-convertible-2cgc/convertible_main.c
+++ b/test/monniaux/lustrev6-convertible-2cgc/convertible_main.c
diff --git a/test/monniaux/lustre-convertible-2cgc/convertible_main.h b/test/monniaux/lustrev6-convertible-2cgc/convertible_main.h
index 63b4ea90..63b4ea90 100644
--- a/test/monniaux/lustre-convertible-2cgc/convertible_main.h
+++ b/test/monniaux/lustrev6-convertible-2cgc/convertible_main.h
diff --git a/test/monniaux/lustre-convertible-2cgc/convertible_main_loop.c b/test/monniaux/lustrev6-convertible-2cgc/convertible_main_loop.c
index 9646b39f..9646b39f 100644
--- a/test/monniaux/lustre-convertible-2cgc/convertible_main_loop.c
+++ b/test/monniaux/lustrev6-convertible-2cgc/convertible_main_loop.c
diff --git a/test/monniaux/lustre-convertible-2cgc/lustre_consts.c b/test/monniaux/lustrev6-convertible-2cgc/lustre_consts.c
index 925cbf0b..925cbf0b 100644
--- a/test/monniaux/lustre-convertible-2cgc/lustre_consts.c
+++ b/test/monniaux/lustrev6-convertible-2cgc/lustre_consts.c
diff --git a/test/monniaux/lustre-convertible-2cgc/lustre_consts.h b/test/monniaux/lustrev6-convertible-2cgc/lustre_consts.h
index a9ba2005..a9ba2005 100644
--- a/test/monniaux/lustre-convertible-2cgc/lustre_consts.h
+++ b/test/monniaux/lustrev6-convertible-2cgc/lustre_consts.h
diff --git a/test/monniaux/lustre-convertible-2cgc/lustre_types.h b/test/monniaux/lustrev6-convertible-2cgc/lustre_types.h
index 83a1c722..83a1c722 100644
--- a/test/monniaux/lustre-convertible-2cgc/lustre_types.h
+++ b/test/monniaux/lustrev6-convertible-2cgc/lustre_types.h
diff --git a/test/monniaux/lustre-convertible-en-2cgc/convertible_main.c b/test/monniaux/lustrev6-convertible-en-2cgc/convertible_main.c
index 6a4db4c3..6a4db4c3 100644
--- a/test/monniaux/lustre-convertible-en-2cgc/convertible_main.c
+++ b/test/monniaux/lustrev6-convertible-en-2cgc/convertible_main.c
diff --git a/test/monniaux/lustre-convertible-en-2cgc/convertible_main.h b/test/monniaux/lustrev6-convertible-en-2cgc/convertible_main.h
index 4785db8a..4785db8a 100644
--- a/test/monniaux/lustre-convertible-en-2cgc/convertible_main.h
+++ b/test/monniaux/lustrev6-convertible-en-2cgc/convertible_main.h
diff --git a/test/monniaux/lustre-convertible-en-2cgc/convertible_main_loop.c b/test/monniaux/lustrev6-convertible-en-2cgc/convertible_main_loop.c
index 9646b39f..9646b39f 100644
--- a/test/monniaux/lustre-convertible-en-2cgc/convertible_main_loop.c
+++ b/test/monniaux/lustrev6-convertible-en-2cgc/convertible_main_loop.c
diff --git a/test/monniaux/lustre-convertible-en-2cgc/lustre_consts.c b/test/monniaux/lustrev6-convertible-en-2cgc/lustre_consts.c
index 18d80805..18d80805 100644
--- a/test/monniaux/lustre-convertible-en-2cgc/lustre_consts.c
+++ b/test/monniaux/lustrev6-convertible-en-2cgc/lustre_consts.c
diff --git a/test/monniaux/lustre-convertible-en-2cgc/lustre_consts.h b/test/monniaux/lustrev6-convertible-en-2cgc/lustre_consts.h
index eaa21a15..eaa21a15 100644
--- a/test/monniaux/lustre-convertible-en-2cgc/lustre_consts.h
+++ b/test/monniaux/lustrev6-convertible-en-2cgc/lustre_consts.h
diff --git a/test/monniaux/lustre-convertible-en-2cgc/lustre_types.h b/test/monniaux/lustrev6-convertible-en-2cgc/lustre_types.h
index 68127eb6..68127eb6 100644
--- a/test/monniaux/lustre-convertible-en-2cgc/lustre_types.h
+++ b/test/monniaux/lustrev6-convertible-en-2cgc/lustre_types.h
diff --git a/test/monniaux/lustre-convertible/convertible_main.c b/test/monniaux/lustrev6-convertible/convertible_main.c
index 19bc40b9..19bc40b9 100644
--- a/test/monniaux/lustre-convertible/convertible_main.c
+++ b/test/monniaux/lustrev6-convertible/convertible_main.c
diff --git a/test/monniaux/lustre-convertible/convertible_main.h b/test/monniaux/lustrev6-convertible/convertible_main.h
index 6be30a78..6be30a78 100644
--- a/test/monniaux/lustre-convertible/convertible_main.h
+++ b/test/monniaux/lustrev6-convertible/convertible_main.h
diff --git a/test/monniaux/lustre-convertible/convertible_main_loop.c b/test/monniaux/lustrev6-convertible/convertible_main_loop.c
index 46e94cd1..46e94cd1 100644
--- a/test/monniaux/lustre-convertible/convertible_main_loop.c
+++ b/test/monniaux/lustrev6-convertible/convertible_main_loop.c
diff --git a/test/monniaux/lustre-convertible/lustre_consts.c b/test/monniaux/lustrev6-convertible/lustre_consts.c
index 37bd763b..37bd763b 100644
--- a/test/monniaux/lustre-convertible/lustre_consts.c
+++ b/test/monniaux/lustrev6-convertible/lustre_consts.c
diff --git a/test/monniaux/lustre-convertible/lustre_consts.h b/test/monniaux/lustrev6-convertible/lustre_consts.h
index 72ee469e..72ee469e 100644
--- a/test/monniaux/lustre-convertible/lustre_consts.h
+++ b/test/monniaux/lustrev6-convertible/lustre_consts.h
diff --git a/test/monniaux/lustre-convertible/lustre_types.h b/test/monniaux/lustrev6-convertible/lustre_types.h
index e721c12a..e721c12a 100644
--- a/test/monniaux/lustre-convertible/lustre_types.h
+++ b/test/monniaux/lustrev6-convertible/lustre_types.h
diff --git a/test/monniaux/number_theoretic_transform/ntt.c b/test/monniaux/number_theoretic_transform/ntt.c
index 9d8c8906..9c978218 100644
--- a/test/monniaux/number_theoretic_transform/ntt.c
+++ b/test/monniaux/number_theoretic_transform/ntt.c
@@ -14,8 +14,8 @@ FFT original code from Rosetta Code.
#include <string.h>
#include "../clock.h"
-typedef uint64_t modint;
-typedef int64_t smodint;
+typedef uint32_t modint;
+typedef int32_t smodint;
static modint invm(modint a0, modint b0)
{
@@ -89,6 +89,12 @@ void fft(modint modulus, modint root_of_unit, modint buf[], unsigned n)
free(out);
}
+static void negate(modint MODULUS, modint buf[restrict], unsigned n) {
+ for(unsigned i=0; i<n; i++) {
+ if (buf[i]) buf[i] = MODULUS-buf[i];
+ }
+}
+
static void mulvecm(modint modulus, modint buf[restrict], unsigned n, modint coef) {
for(unsigned i=0; i<n; i++) {
buf[i] = mulm(buf[i], coef, modulus);
@@ -107,6 +113,7 @@ modint randm(modint modulus) {
}
int main() {
+#if 0
modint root_of_unit = 1;
for(modint i=1; i<MODULUS; i++) {
if (powm_u(i, MUL_MODULUS/2, MODULUS) != 1) {
@@ -114,8 +121,11 @@ int main() {
break;
}
}
+#else
+ modint root_of_unit = 3;
+#endif
assert(root_of_unit != 1);
- printf("root of unit = %" PRIu64 "\n", root_of_unit);
+ //printf("root of unit = %" PRIu64 "\n", root_of_unit);
modint *buf = malloc(LENGTH * sizeof(modint)),
*save = malloc(LENGTH * sizeof(modint));
@@ -131,10 +141,13 @@ int main() {
fft(MODULUS, invm(root_of_unit, MODULUS), buf, LENGTH);
clock_stop();
print_total_clock();
-
+
+#if 0
/* can be replaced by x -> -x */
mulvecm(MODULUS, buf, LENGTH, invm(LENGTH, MODULUS));
-
+#else
+ negate(MODULUS, buf, LENGTH);
+#endif
printf("compare = %d\n", memcmp(buf, save, LENGTH * sizeof(modint)));
/*
diff --git a/test/monniaux/run_benches.sh b/test/monniaux/run_benches.sh
new file mode 100755
index 00000000..4db4b5a2
--- /dev/null
+++ b/test/monniaux/run_benches.sh
@@ -0,0 +1,23 @@
+
+source benches.sh
+
+rm -f commands.txt
+for bench in $benches; do
+ echo "(cd $bench && make -j5 run)" >> commands.txt
+done
+
+cat commands.txt | xargs -n1 -I{} -P4 bash -c '{}'
+
+##
+# Gather all the CSV files
+##
+
+benches_csv=""
+for bench in $benches; do
+ if [ -f $bench/measures.csv ]; then
+ benches_csv="$benches_csv $bench/measures.csv"
+ fi
+done
+
+nawk 'FNR==1 && NR!=1{next;}{print}' $benches_csv > measures.csv
+echo "measures.csv done"