Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Broken tests fixed

Differential Revision: https://reviews.llvm.org/D55598

llvm-svn: 349017
  • Loading branch information
AndreyChurbanov committed Dec 13, 2018
1 parent 76f4ae1 commit 74f9855
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 4 deletions.
5 changes: 5 additions & 0 deletions openmp/runtime/test/api/omp_in_parallel.c
Expand Up @@ -30,6 +30,11 @@ int main()
int i;
int num_failed=0;

// the test requires more than 1 thread to pass
omp_set_dynamic(0); // disable dynamic adjustment of threads
if (omp_get_max_threads() == 1)
omp_set_num_threads(2); // set 2 threads if no HW resources available

for(i = 0; i < REPETITIONS; i++) {
if(!test_omp_in_parallel()) {
num_failed++;
Expand Down
5 changes: 5 additions & 0 deletions openmp/runtime/test/flush/omp_flush.c
Expand Up @@ -36,6 +36,11 @@ int main()
int i;
int num_failed=0;

// the test requires more than 1 thread to pass
omp_set_dynamic(0); // disable dynamic adjustment of threads
if (omp_get_max_threads() == 1)
omp_set_num_threads(2); // set 2 threads if no HW resources available

for (i = 0; i < REPETITIONS; i++) {
if(!test_omp_flush()) {
num_failed++;
Expand Down
2 changes: 1 addition & 1 deletion openmp/runtime/test/ompt/misc/api_calls_places.c
Expand Up @@ -42,7 +42,7 @@ int main() {
int omp_nums[omp_nums_size];
omp_get_partition_place_nums(omp_nums);
print_list("omp_get_partition_place_nums", omp_nums_size, omp_nums);
int ompt_nums_size = ompt_get_partition_place_nums(0, NULL);
int ompt_nums_size = ompt_get_partition_place_nums(0, omp_nums);
int ompt_nums[ompt_nums_size];
ompt_get_partition_place_nums(ompt_nums_size, ompt_nums);
print_list("ompt_get_partition_place_nums", ompt_nums_size, ompt_nums);
Expand Down
2 changes: 2 additions & 0 deletions openmp/runtime/test/parallel/omp_nested.c
Expand Up @@ -12,6 +12,8 @@ int test_omp_nested()
#ifdef _OPENMP
if (omp_get_max_threads() > 4)
omp_set_num_threads(4);
if (omp_get_max_threads() < 2)
omp_set_num_threads(2);
#endif

int counter = 0;
Expand Down
3 changes: 3 additions & 0 deletions openmp/runtime/test/tasking/omp_task.c
Expand Up @@ -43,6 +43,9 @@ int main()
int i;
int num_failed=0;

if (omp_get_max_threads() < 2)
omp_set_num_threads(8);

for(i = 0; i < REPETITIONS; i++) {
if(!test_omp_task()) {
num_failed++;
Expand Down
3 changes: 3 additions & 0 deletions openmp/runtime/test/tasking/omp_taskyield.c
Expand Up @@ -49,6 +49,9 @@ int main()
int i;
int num_failed=0;

if (omp_get_max_threads() < 2)
omp_set_num_threads(8);

for(i = 0; i < REPETITIONS; i++) {
if(!test_omp_taskyield()) {
num_failed++;
Expand Down
Expand Up @@ -66,6 +66,7 @@ run_loop(
int ub; // Chunk upper bound.
int st; // Chunk stride.
int rc;
int nthreads = omp_get_num_threads();
int tid = omp_get_thread_num();
int gtid = __kmpc_global_thread_num(&loc);
int last;
Expand Down Expand Up @@ -134,7 +135,7 @@ run_loop(
printf("Error with iter %d, %d, err %d\n", cur, max, ++err);
// Update maximum for the next chunk.
if (last) {
if (!no_chunk && cur > ch)
if (!no_chunk && cur > ch && nthreads > 1)
printf("Error: too big last chunk %d (%d), tid %d, err %d\n",
(int)cur, ch, tid, ++err);
} else {
Expand Down
Expand Up @@ -74,6 +74,7 @@ run_loop(
int ub; // Chunk upper bound.
int st; // Chunk stride.
int rc;
int nthreads = omp_get_num_threads();
int tid = omp_get_thread_num();
int gtid = __kmpc_global_thread_num(&loc);
int last;
Expand Down Expand Up @@ -144,7 +145,7 @@ run_loop(
if (!last && cur % ch)
printf("Error with chunk %d, %d, ch %d, tid %d, err %d\n",
chunk, (int)cur, ch, tid, ++err);
if (last && !no_chunk && cur > ch)
if (last && !no_chunk && cur > ch && nthreads > 1)
printf("Error: too big last chunk %d (%d), tid %d, err %d\n",
(int)cur, ch, tid, ++err);
if (cur < max)
Expand Down
Expand Up @@ -67,6 +67,7 @@ run_loop(
int ub; // Chunk upper bound.
int st; // Chunk stride.
int rc;
int nthreads = omp_get_num_threads();
int tid = omp_get_thread_num();
int gtid = __kmpc_global_thread_num(&loc);
int last;
Expand Down Expand Up @@ -135,7 +136,7 @@ run_loop(
printf("Error with iter %d, %d, err %d\n", cur, max, ++err);
// Update maximum for the next chunk.
if (last) {
if (!no_chunk && cur > ch)
if (!no_chunk && cur > ch && nthreads > 1)
printf("Error: too big last chunk %d (%d), tid %d, err %d\n",
(int)cur, ch, tid, ++err);
} else {
Expand Down
2 changes: 2 additions & 0 deletions openmp/runtime/test/worksharing/for/omp_doacross.c
Expand Up @@ -51,6 +51,8 @@ int test_doacross() {
int main(int argc, char **argv) {
int i;
int num_failed = 0;
if (omp_get_max_threads() < 2)
omp_set_num_threads(4);
for (i = 0; i < REPETITIONS; i++) {
if (!test_doacross()) {
num_failed++;
Expand Down

0 comments on commit 74f9855

Please sign in to comment.