Skip to content

Commit

Permalink
export omp.h again
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Dec 6, 2023
1 parent 921fecb commit b068106
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions R-package/tests/testthat/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# the check farm is a shared resource and will typically be running many checks simultaneously.
#
.LGB_MAX_THREADS <- 2L
setLGBMthreads(.LGB_MAX_THREADS)

# by default, how much should results in tests be allowed to differ from hard-coded expected numbers?
.LGB_NUMERIC_TOLERANCE <- 1e-6
Expand Down
4 changes: 3 additions & 1 deletion include/LightGBM/utils/openmp_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ LIGHTGBM_EXTERN_C int LGBM_DEFAULT_NUM_THREADS;

#include <LightGBM/utils/log.h>

#include <omp.h>

#include <exception>
#include <memory>
#include <mutex>
Expand Down Expand Up @@ -112,9 +114,9 @@ class ThreadExceptionHelper {
/** Fall here if no OPENMP support, so just
simulate a single thread running.
All #pragma omp should be ignored by the compiler **/
inline int OMP_NUM_THREADS() __GOMP_NOTHROW { return 1; }
inline void OMP_SET_NUM_THREADS(int) __GOMP_NOTHROW {}
inline int omp_get_thread_num() __GOMP_NOTHROW {return 0;}
inline int OMP_NUM_THREADS() __GOMP_NOTHROW { return 1; }
#ifdef __cplusplus
} // extern "C"
#endif
Expand Down

0 comments on commit b068106

Please sign in to comment.