Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenMP required by libperf.c's ucx_perf_do_warmup #9848

Closed
jakirkham opened this issue Apr 27, 2024 · 0 comments · Fixed by #9850
Closed

OpenMP required by libperf.c's ucx_perf_do_warmup #9848

jakirkham opened this issue Apr 27, 2024 · 0 comments · Fixed by #9850

Comments

@jakirkham
Copy link
Contributor

jakirkham commented Apr 27, 2024

Most code in UCX that uses OpenMP is guarded to check that OpenMP is enabled. If it is not, there is fallback logic that doesn't use OpenMP

For example this happens in libperf_thread.c where an OpenMP block is provided if OpenMP is found

#if _OPENMP
# include <omp.h>
static ucs_status_t ucx_perf_thread_run_test(void* arg)

Otherwise a non-OpenMP fallback is provided

#else
ucs_status_t ucx_perf_thread_spawn(ucx_perf_context_t *perf,
ucx_perf_result_t* result)
{
ucs_error("Invalid test parameter (thread mode requested without OpenMP capabilities)");
return UCS_ERR_INVALID_PARAM;
}
#endif /* _OPENMP */

As a result any #pragma omp lines live in the OpenMP enabled block

#pragma omp barrier

So are not encountered outside it


With libperf.c however the OpenMP #include is optional

#if _OPENMP
# include <omp.h>
#endif /* _OPENMP */

Though later in the code #pragma omp is not guarded

#pragma omp barrier
#pragma omp single copyprivate(status)
/* Synchronize on whether to continue or stop the warmup phase */
status = ucx_perf_test_exchange_status(perf, stop_status);
#pragma omp barrier

As a result building without OpenMP leads to errors like this

make[3]: Entering directory '/home/conda/feedstock_root/build_artifacts/ucx-split_1714181624237/work/src/tools/perf/lib'
  CC       libucxperf_la-libperf.lo
  CC       libucxperf_la-libperf_memory.lo
libperf.c: In function 'ucx_perf_do_warmup':
libperf.c:1356: error: ignoring '#pragma omp barrier' [-Werror=unknown-pragmas]
 1356 | #pragma omp barrier
      | 
libperf.c:1357: error: ignoring '#pragma omp single' [-Werror=unknown-pragmas]
 1357 | #pragma omp single copyprivate(status)
      | 
libperf.c:1360: error: ignoring '#pragma omp barrier' [-Werror=unknown-pragmas]
 1360 | #pragma omp barrier
      | 

This comes from a UCX 1.16.0 build. Here is the full build log


Would it be possible to guard the OpenMP code above and provide a fallback to allow building without OpenMP?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant