forked from pmodels/bolt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BOLT] test: add a new test to check tied/untied tasks
This bug was reported in pmodels#51, which has been already fixed. This test checks if this bug has been really fixed. Acknowledgment: the original code of this test has been created by Joseph Schuchart ([email protected]). Thank you.
- Loading branch information
1 parent
da131bd
commit 4f5dc50
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |