forked from OSchip/llvm-project
[OpenMP][Tests] Fix compiler warnings in OpenMP runtime tests
This patch allows to pass the OpenMP runtime tests after configuring with `cmake . -DOPENMP_TEST_FLAGS:STRING="-Werror"`. The warnings for OMPT tests are addressed in D90752. Differential Revision: https://reviews.llvm.org/D91280
This commit is contained in:
parent
6213ed062b
commit
ce0911b3e9
|
@ -13,8 +13,8 @@
|
|||
|
||||
#define check(condition) \
|
||||
if (!(condition)) { \
|
||||
fprintf(stderr, "error: %s: %d: " STR(condition) "\n", __FILE__, \
|
||||
__LINE__); \
|
||||
fprintf(stderr, "error: %s: %d: %s\n", __FILE__, __LINE__, \
|
||||
STR(condition)); \
|
||||
exit(1); \
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ int main() {
|
|||
at[1].key = omp_atk_fallback;
|
||||
at[1].value = omp_atv_default_mem_fb;
|
||||
a = omp_init_allocator(omp_large_cap_mem_space, 2, at);
|
||||
printf("allocator large created: %p\n", a);
|
||||
#pragma omp parallel num_threads(2)
|
||||
printf("allocator large created: %p\n", (void *)a);
|
||||
#pragma omp parallel num_threads(2)
|
||||
{
|
||||
int i = omp_get_thread_num();
|
||||
p[i] = omp_alloc(1024 * 1024, a);
|
||||
|
|
|
@ -12,8 +12,8 @@ int main() {
|
|||
at[1].key = omp_atk_fallback;
|
||||
at[1].value = omp_atv_null_fb;
|
||||
a = omp_init_allocator(omp_high_bw_mem_space, 2, at);
|
||||
printf("allocator hbw created: %p\n", a);
|
||||
#pragma omp parallel num_threads(2)
|
||||
printf("allocator hbw created: %p\n", (void *)a);
|
||||
#pragma omp parallel num_threads(2)
|
||||
{
|
||||
int i = omp_get_thread_num();
|
||||
p[i] = omp_alloc(1024 * 1024, a);
|
||||
|
|
|
@ -12,8 +12,8 @@ int main() {
|
|||
at[1].key = omp_atk_fallback;
|
||||
at[1].value = omp_atv_null_fb;
|
||||
a = omp_init_allocator(omp_large_cap_mem_space, 2, at);
|
||||
printf("allocator large created: %p\n", a);
|
||||
#pragma omp parallel num_threads(2)
|
||||
printf("allocator large created: %p\n", (void *)a);
|
||||
#pragma omp parallel num_threads(2)
|
||||
{
|
||||
int i = omp_get_thread_num();
|
||||
#pragma omp barrier
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: %libomp-compile-and-run 2>&1 | FileCheck %s
|
||||
// RUN: %libomp-cxx-compile-and-run 2>&1 | FileCheck %s
|
||||
// RUN: %libomp-cxx-compile-c && %libomp-run 2>&1 | FileCheck %s
|
||||
#include <stdio.h>
|
||||
#include <omp.h>
|
||||
int main()
|
||||
|
|
|
@ -9,6 +9,7 @@ enum kmp_target_offload_kind {
|
|||
};
|
||||
|
||||
extern int __kmpc_get_target_offload();
|
||||
extern void kmp_set_defaults(char const *str);
|
||||
|
||||
const char *disabled_examples[] = {
|
||||
// Allowed inputs
|
||||
|
|
|
@ -116,6 +116,8 @@ config.substitutions.append(("%libomp-compile-and-run", \
|
|||
"%libomp-compile && %libomp-run"))
|
||||
config.substitutions.append(("%libomp-cxx-compile-and-run", \
|
||||
"%libomp-cxx-compile && %libomp-run"))
|
||||
config.substitutions.append(("%libomp-cxx-compile-c", \
|
||||
"%clangXX %openmp_flags %flags -std=c++14 -x c++ %s -o %t" + libs))
|
||||
config.substitutions.append(("%libomp-cxx-compile", \
|
||||
"%clangXX %openmp_flags %flags -std=c++14 %s -o %t" + libs))
|
||||
config.substitutions.append(("%libomp-compile", \
|
||||
|
|
|
@ -37,6 +37,7 @@ void* thread_function(void* arg) {
|
|||
a++;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int test_omp_team_reuse()
|
||||
|
|
|
@ -128,7 +128,7 @@ int run_loop_64(i64 loop_lb, i64 loop_ub, i64 loop_st, int loop_chunk) {
|
|||
// Guided scheduling uses FP computations, so current chunk may
|
||||
// be a bit bigger (+1) than allowed maximum
|
||||
if (!(cur <= max + 1)) {
|
||||
printf("Error with iter %d, %d\n", cur, max);
|
||||
printf("Error with iter %llu, %llu\n", cur, max);
|
||||
err++;
|
||||
}
|
||||
// Update maximum for the next chunk
|
||||
|
@ -280,7 +280,7 @@ int run_loop_32(int loop_lb, int loop_ub, int loop_st, int loop_chunk) {
|
|||
// Guided scheduling uses FP computations, so current chunk may
|
||||
// be a bit bigger (+1) than allowed maximum
|
||||
if (!(cur <= max + 1)) {
|
||||
printf("Error with iter %d, %d\n", cur, max);
|
||||
printf("Error with iter %llu, %llu\n", cur, max);
|
||||
err++;
|
||||
}
|
||||
// Update maximum for the next chunk
|
||||
|
|
|
@ -132,7 +132,7 @@ run_loop(
|
|||
// Guided scheduling uses FP computations, so current chunk may
|
||||
// be a bit bigger (+1) than allowed maximum.
|
||||
if (!( cur <= max + 1))
|
||||
printf("Error with iter %d, %d, err %d\n", cur, max, ++err);
|
||||
printf("Error with iter %llu, %llu, err %d\n", cur, max, ++err);
|
||||
// Update maximum for the next chunk.
|
||||
if (last) {
|
||||
if (!no_chunk && cur > ch && nthreads > 1)
|
||||
|
|
|
@ -140,7 +140,7 @@ run_loop(
|
|||
// Guided scheduling uses FP computations, so current chunk may
|
||||
// be a bit bigger (+1) than allowed maximum.
|
||||
if (!( cur <= max + 1))
|
||||
printf("Error with iter %d, %d, err %d\n", cur, max, ++err);
|
||||
printf("Error with iter %llu, %llu, err %d\n", cur, max, ++err);
|
||||
// Update maximum for the next chunk.
|
||||
if (!last && cur % ch)
|
||||
printf("Error with chunk %d, %d, ch %d, tid %d, err %d\n",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
// in combination with OMP_SCHEDULE=static[,chunk]
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <omp.h>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
|
@ -133,7 +134,7 @@ run_loop(
|
|||
// Guided scheduling uses FP computations, so current chunk may
|
||||
// be a bit bigger (+1) than allowed maximum.
|
||||
if (!( cur <= max + 1))
|
||||
printf("Error with iter %d, %d, err %d\n", cur, max, ++err);
|
||||
printf("Error with iter %llu, %llu, err %d\n", cur, max, ++err);
|
||||
// Update maximum for the next chunk.
|
||||
if (last) {
|
||||
if (!no_chunk && cur > ch && nthreads > 1)
|
||||
|
|
Loading…
Reference in New Issue