From c7dbf643d30df6d7992fdfc13b135c8363de1dfa Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 22 Mar 2024 15:14:25 +0100 Subject: [PATCH] Implement outlined fibonacci test too --- test/rt/nodes/fibonacci.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/rt/nodes/fibonacci.c b/test/rt/nodes/fibonacci.c index 30a939e..c3a5700 100644 --- a/test/rt/nodes/fibonacci.c +++ b/test/rt/nodes/fibonacci.c @@ -20,6 +20,22 @@ fib(long index) return a + b; } +/* Outline task version */ +#pragma oss task label("fibonacci") +static void +fib2(long index, long *res) +{ + if (index <= 1) { + *res = index; + } else { + long a, b; + fib2(index-1, &a); + fib2(index-2, &b); + #pragma oss taskwait + *res = a + b; + } +} + int main(void) { @@ -56,6 +72,14 @@ main(void) for (int i = 0; i < 30; i++) fib(5); + #pragma oss taskwait + + long res = 0; + for (int i = 0; i < 30; i++) { + fib2(5, &res); + #pragma oss taskwait + } + #pragma oss taskwait return 0; }