Compare commits
3 Commits
5aab319424
...
bba9ced348
| Author | SHA1 | Date | |
|---|---|---|---|
|
bba9ced348
|
|||
|
a8aa0bbb07
|
|||
|
1257534a64
|
80
charts/combined_sankey.r
Normal file
80
charts/combined_sankey.r
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
library(ggplot2)
|
||||||
|
library(ggalluvial)
|
||||||
|
|
||||||
|
# Usage: Rscript combined_comparion.r exp_abspath1 exp_abspath2 ...
|
||||||
|
|
||||||
|
args <- commandArgs(trailingOnly = TRUE)
|
||||||
|
argc <- length(args)
|
||||||
|
|
||||||
|
if (argc != 2) {
|
||||||
|
print("Expecting two input files")
|
||||||
|
stop()
|
||||||
|
}
|
||||||
|
|
||||||
|
for (experiment in args) {
|
||||||
|
datafile <- paste(experiment, "/faults.csv", sep = "")
|
||||||
|
if (!file.exists(datafile)) {
|
||||||
|
print(paste("Input file", datafile, "is missing"))
|
||||||
|
stop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resulttype_labels <- c(
|
||||||
|
OK_MARKER = "OK",
|
||||||
|
FAIL_MARKER = "FAIL",
|
||||||
|
DETECTED_MARKER = "DETECTED",
|
||||||
|
TIMEOUT = "TIMEOUT",
|
||||||
|
TRAP = "TRAP",
|
||||||
|
ACCESS_OUTERSPACE = "OUTERSPC",
|
||||||
|
WRITE_TEXTSEGMENT = "WRITETXT"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Read data
|
||||||
|
datafile1 <- paste(args[1], "/faults.csv", sep = "")
|
||||||
|
data1 <- readr::read_csv(datafile1)
|
||||||
|
data1$fault_address <- strtoi(data1$fault_address)
|
||||||
|
data1$resulttype <- resulttype_labels[data1$resulttype]
|
||||||
|
# tibble::glimpse(data1)
|
||||||
|
|
||||||
|
datafile2 <- paste(args[2], "/faults.csv", sep = "")
|
||||||
|
data2 <- readr::read_csv(datafile2)
|
||||||
|
data2$fault_address <- strtoi(data2$fault_address)
|
||||||
|
data2$resulttype <- resulttype_labels[data2$resulttype]
|
||||||
|
# tibble::glimpse(data2)
|
||||||
|
|
||||||
|
# https://corybrunson.github.io/ggalluvial/
|
||||||
|
joined <- merge(
|
||||||
|
data1[, c("fault_address", "resulttype", "faults")],
|
||||||
|
data2[, c("fault_address", "resulttype", "faults")],
|
||||||
|
by = "fault_address",
|
||||||
|
suffixes = c("_bench1", "_bench2")
|
||||||
|
)
|
||||||
|
|
||||||
|
streams <- aggregate(
|
||||||
|
faults_bench2 ~ resulttype_bench1 + resulttype_bench2,
|
||||||
|
data = joined,
|
||||||
|
sum
|
||||||
|
)
|
||||||
|
names(streams) <- c("bench1", "bench2", "faults")
|
||||||
|
|
||||||
|
plot <- ggplot(
|
||||||
|
data = streams,
|
||||||
|
aes(axis1 = bench1, axis2 = bench2, y = faults)
|
||||||
|
) +
|
||||||
|
scale_x_discrete(
|
||||||
|
# TODO: Name the benchmarks
|
||||||
|
# limits = c(args[1], args[2])
|
||||||
|
limits = c("Bench A", "Bench B")
|
||||||
|
) +
|
||||||
|
labs(x = "Benchmark", y = "Faults") +
|
||||||
|
geom_alluvium(aes(fill = bench1)) +
|
||||||
|
geom_stratum() +
|
||||||
|
geom_text(stat = "stratum", aes(label = after_stat(stratum))) +
|
||||||
|
theme_minimal() +
|
||||||
|
theme(legend.position = "none")
|
||||||
|
|
||||||
|
# TODO: Name the file according to the benchmarks
|
||||||
|
ggsave(
|
||||||
|
paste(args[2], "/../sankey.svg", sep = ""),
|
||||||
|
plot = plot,
|
||||||
|
)
|
||||||
@ -252,7 +252,7 @@ sub select_experiment {
|
|||||||
|
|
||||||
push @exp_with_notes,
|
push @exp_with_notes,
|
||||||
( defined $info && length($info) > 0 )
|
( defined $info && length($info) > 0 )
|
||||||
? sprintf( "%-50s (Note: %s)", $exp, $info )
|
? sprintf( "%-50s (%s)", $exp, $info )
|
||||||
: $exp;
|
: $exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ sub select_experiment {
|
|||||||
TUI::select_from_list( "Select Experiment", $multi, @exp_with_notes );
|
TUI::select_from_list( "Select Experiment", $multi, @exp_with_notes );
|
||||||
die "No experiment selected" unless @selected_experiments;
|
die "No experiment selected" unless @selected_experiments;
|
||||||
|
|
||||||
map { s/(.*?)\s+\(Note:.+\)$/$1/ } @selected_experiments;
|
map { s/(.*?)\s+\(.+\)$/$1/ } @selected_experiments;
|
||||||
|
|
||||||
return $multi == 1 ? @selected_experiments : $selected_experiments[0];
|
return $multi == 1 ? @selected_experiments : $selected_experiments[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -322,11 +322,7 @@ my %handlers = (
|
|||||||
'16. Plot Results' => sub {
|
'16. Plot Results' => sub {
|
||||||
|
|
||||||
# Generate R ggplot2 charts
|
# Generate R ggplot2 charts
|
||||||
my @experiments = Util::find_subdirs($local_archive_dir);
|
my @selected_experiments = Util::select_experiment(1);
|
||||||
my @selected_experiments =
|
|
||||||
TUI::select_from_list( "Select Experiments to Plot", 1,
|
|
||||||
@experiments );
|
|
||||||
die "No experiment selected" unless @selected_experiments;
|
|
||||||
|
|
||||||
my @charts = map { s/\.r//r } Util::find_files($local_charts_dir);
|
my @charts = map { s/\.r//r } Util::find_files($local_charts_dir);
|
||||||
my @selected_charts =
|
my @selected_charts =
|
||||||
|
|||||||
@ -48,6 +48,8 @@ sub trace {
|
|||||||
"-e $remote_builds_dir/$experiment/system.elf",
|
"-e $remote_builds_dir/$experiment/system.elf",
|
||||||
"-i $remote_builds_dir/$experiment/system.iso",
|
"-i $remote_builds_dir/$experiment/system.iso",
|
||||||
"--",
|
"--",
|
||||||
|
"-Wf,--full-trace",
|
||||||
|
"-Wf,--check-bounds",
|
||||||
"-Wf,--start-symbol=fail_start_trace",
|
"-Wf,--start-symbol=fail_start_trace",
|
||||||
"-Wf,--save-symbol=fail_start_trace",
|
"-Wf,--save-symbol=fail_start_trace",
|
||||||
"-Wf,--end-symbol=fail_stop_trace",
|
"-Wf,--end-symbol=fail_stop_trace",
|
||||||
|
|||||||
63
targets/wasm-module/matrix0_base.cpp
Normal file
63
targets/wasm-module/matrix0_base.cpp
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#include "../lib.h"
|
||||||
|
|
||||||
|
#define REPLICA_COUNT 1
|
||||||
|
#define MAT_SIZE 3
|
||||||
|
|
||||||
|
static uint32_t X[MAT_SIZE * MAT_SIZE] = {
|
||||||
|
0, 1, 2, //
|
||||||
|
3, 4, 5, //
|
||||||
|
6, 7, 8 //
|
||||||
|
};
|
||||||
|
static uint32_t Y[MAT_SIZE * MAT_SIZE] = {
|
||||||
|
8, 7, 6, //
|
||||||
|
5, 4, 3, //
|
||||||
|
2, 1, 0 //
|
||||||
|
};
|
||||||
|
static uint32_t Calculated[MAT_SIZE * MAT_SIZE] = {0};
|
||||||
|
|
||||||
|
static INLINE uint32_t *idx(uint32_t *matrix, uint8_t x, uint8_t y) {
|
||||||
|
return &matrix[y * MAT_SIZE + x];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <const unsigned int N> static INLINE void matrix(void) {
|
||||||
|
for (uint8_t y = 0; y < MAT_SIZE; ++y) {
|
||||||
|
for (uint8_t x = 0; x < MAT_SIZE; ++x) {
|
||||||
|
for (uint8_t k = 0; k < MAT_SIZE; ++k) {
|
||||||
|
*idx(Calculated, x, y) += (*idx(X, k, y)) * (*idx(Y, x, k));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cmp(uint32_t *A, uint32_t *B) {
|
||||||
|
for (uint8_t i = 0; i < MAT_SIZE * MAT_SIZE; ++i) {
|
||||||
|
if (A[i] != B[i]) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" EXPORT("wasm_module") int wasm_module(void) {
|
||||||
|
fail_start_trace();
|
||||||
|
|
||||||
|
matrix<0>();
|
||||||
|
|
||||||
|
fail_stop_trace();
|
||||||
|
|
||||||
|
uint32_t Expected[MAT_SIZE * MAT_SIZE] = {
|
||||||
|
9, 6, 3, //
|
||||||
|
54, 42, 30, //
|
||||||
|
99, 78, 57 //
|
||||||
|
};
|
||||||
|
|
||||||
|
if (cmp(Calculated, Expected)) {
|
||||||
|
HOST_PRINT("result correct.\n");
|
||||||
|
fail_marker_positive();
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
HOST_PRINT("result incorrect.\n");
|
||||||
|
fail_marker_negative();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user