Skip to content

Commit

Permalink
Disable gcc parallel extension if openmp is not available. (#8871)
Browse files Browse the repository at this point in the history
`<parallel/algorithm>` internally includes the <omp.h> header, which leads to an error
when openmp is not available.
  • Loading branch information
trivialfis authored Mar 6, 2023
1 parent 228a46e commit cad7401
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/common/algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#include "xgboost/context.h" // Context

// clang with libstdc++ works as well
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__sun) && !defined(sun) && !defined(__APPLE__)
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__sun) && !defined(sun) && \
!defined(__APPLE__) && __has_include(<omp.h>)
#define GCC_HAS_PARALLEL 1
#endif // GLIC_VERSION

Expand Down

0 comments on commit cad7401

Please sign in to comment.