From 3c6c6ed23059e5405d796baabd81f5e31fa0c1a0 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 14 Apr 2023 10:25:17 +0200 Subject: [PATCH] Add taskiter NODES test --- test/rt/nodes/CMakeLists.txt | 3 ++- test/rt/nodes/taskiter.c | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test/rt/nodes/taskiter.c diff --git a/test/rt/nodes/CMakeLists.txt b/test/rt/nodes/CMakeLists.txt index 2b97ec3..6458e1e 100644 --- a/test/rt/nodes/CMakeLists.txt +++ b/test/rt/nodes/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Barcelona Supercomputing Center (BSC) +# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC) # SPDX-License-Identifier: GPL-3.0-or-later find_package(Nodes) @@ -41,3 +41,4 @@ nodes_rt_test(../nanos6/nested-task.c NAME nested-task SORT) nodes_rt_test(../nanos6/several-tasks.c NAME several-tasks SORT) nodes_rt_test(../nanos6/if0.c NAME if0 SORT) nodes_rt_test(../nanos6/sched-add.c NAME sched-add SORT) +nodes_rt_test(taskiter.c SORT) diff --git a/test/rt/nodes/taskiter.c b/test/rt/nodes/taskiter.c new file mode 100644 index 0000000..7d4aead --- /dev/null +++ b/test/rt/nodes/taskiter.c @@ -0,0 +1,26 @@ +/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#include "compat.h" +#include + +/* Adapted from Listing 2 of https://arxiv.org/pdf/2208.06332.pdf */ + +int +main(void) +{ + int A; + #pragma oss task out(A) + A = 1; + + #pragma oss taskiter in(A) out(A) + for (int i = 0; i < 10; i++) { + #pragma oss task in(A) + sleep_us(10 + A); + #pragma oss task out(A) + A = A + 1; + } + + # pragma oss task in(A) + printf("A=%d\n", A); +}