fabsig / GPBoost

Combining tree-boosting with Gaussian process and mixed effects models
Other
574 stars 46 forks source link

[R] Detecting OpenMP support does not work correctly on macOS when building with GCC #95

Closed barracuda156 closed 1 year ago

barracuda156 commented 1 year ago

Configure assumes Clang’s libomp, while GCC uses libgomp.

checking whether OpenMP will work in a package... no
***********************************************************************************************
 OpenMP is unavailable on this macOS system. GPBoost code will run single-threaded as a result.
 To use all CPU cores for training jobs, you should install OpenMP by running

     brew install libomp
***********************************************************************************************
fabsig commented 1 year ago

Thanks a lot for reporting this.

I have not yet had a lot of time to look into this.

Which version of macOS are you using and which chip? arm64 Apple silicon, e.g., M1/M2, or older x86 Intel ones?

Have you read these requirements? https://github.com/fabsig/GPBoost/tree/master/python-package#requirements

In particular the ones concerning arm64 (M1/M2) if you have one of those (see glibc, proper installation of libomp / homebrew)

barracuda156 commented 1 year ago

@fabsig Thank you for responding. I should have made clear I refer to building R package, I added that to issue title now.

libomp is Clang-specific library. GCC has libgomp, but normally it needs only -fopenmp flag passed, not explicit linking to the dylib. (I build for ppc, but this issue is not arch-specific: GCC does not use libomp on any arch.)

I switched my PR to draft, because while I fixed OpenMP detection with GCC, I am getting one symbol undefined: https://github.com/fabsig/GPBoost/issues/97 Apparently emulated TLS still needs some fix.

fabsig commented 1 year ago

Is it an arm64 Apple silicon, e.g., M1/M2, or x86 Intel processor?

I suggest that you still pay attention to the Python package requirements. It might be that the OpenMP / libgomp library is not correctly installed for ARM processors (-> uninstall homebrew, reinstall homebrew, install libgomp). Just a guess...

FWIW: if it is the R package, why don't you just take it from CRAN? There are many precompiled versions there.

barracuda156 commented 1 year ago

@fabsig This is on PowerPC :)

libgomp is installed perfectly fine, it is configure script which is used here that is broken and fails to find it, assuming that macOS = Clang, which is obviously needs not be the case.

Anyway, I have fixed everything, will update the PR (symbol error mentioned above is specific to emulation in Rosetta, for w/e reason; native build is fine).

UPD. All tests pass now.

fabsig commented 1 year ago

Very nice! Thanks a lot for your contribution.