Skip to content

Commit

Permalink
[BOLT] test: add a new test, untied_tasks.c
Browse files Browse the repository at this point in the history
This bug was reported in pmodels#51, which has
been already fixed.  This test checks if this bug has been fixed.

Acknowledgment: the original code of this test has been created by Joseph
Schuchart ([email protected]).  Thank you.
  • Loading branch information
shintaro-iwasaki committed May 1, 2020
1 parent 28aca21 commit 2313f01
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions runtime/test/bolt/misc_bugs/untied_tasks.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// RUN: %libomp-compile-and-run
// REQUIRES: abt
#include "omp_testsuite.h"

int test_omp_untied_tasks()
{
// https://github.com/pmodels/bolt/issues/49
int val = 0;
#pragma omp parallel
#pragma omp master
{
#pragma omp task untied
{ val = 1; }
}
return val;
}

int test_omp_tied_tasks()
{
int val = 0;
#pragma omp parallel
#pragma omp master
{
#pragma omp task
{ val = 1; }
}
return val;
}

int test_omp_tied_and_untied_tasks()
{
int val1 = 0;
int val2 = 0;
#pragma omp parallel
#pragma omp master
{
#pragma omp task
{ val1 = 1; }
#pragma omp task untied
{ val2 = 1; }
}
return val1 == 1 && val2 == 1;
}

int main()
{
int i;
int num_failed = 0;
for (i = 0; i < REPETITIONS; i++) {
if (!test_omp_untied_tasks()) {
num_failed++;
}
if (!test_omp_tied_tasks()) {
num_failed++;
}
if (!test_omp_tied_and_untied_tasks()) {
num_failed++;
}
}
return num_failed;
}

0 comments on commit 2313f01

Please sign in to comment.