Add taskiter NODES test

This commit is contained in:
Rodrigo Arias 2023-04-14 10:25:17 +02:00 committed by Rodrigo Arias Mallo
parent 26d01d18eb
commit 3c6c6ed230
2 changed files with 28 additions and 1 deletions

View File

@ -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)

26
test/rt/nodes/taskiter.c Normal file
View File

@ -0,0 +1,26 @@
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include "compat.h"
#include <stdio.h>
/* 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);
}