From cec71102e30c243ab09c25d1d1211e20169a50d2 Mon Sep 17 00:00:00 2001 From: "raphael.bach" <raphael.bach@etu.hesge.ch> Date: Sat, 2 Jul 2022 19:19:02 +0200 Subject: [PATCH] Add sequential `array_sum.c` --- benchmarks/seq/array_sum.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 benchmarks/seq/array_sum.c diff --git a/benchmarks/seq/array_sum.c b/benchmarks/seq/array_sum.c new file mode 100644 index 0000000..13389d7 --- /dev/null +++ b/benchmarks/seq/array_sum.c @@ -0,0 +1,27 @@ +#include <stdint.h> // uint8_t +#include <stdlib.h> // EXIT_SUCCESS, size_t +#include <string.h> // memcpy() + +#define T uint64_t +#define X_LEN 10 +#define Y_LEN 10 + +int main(void) +{ + T in[] = { + 1,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,1, + 2,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,2, + 3,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,3, + 4,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,4 + }; + #define size (sizeof(in)/sizeof(T)) + T out = 0; + for(size_t i = 0; i < size; i++) { + out += in[i]; + } + return EXIT_SUCCESS; +} -- GitLab