-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add functions to check if OpenMP is working #1000
Conversation
Pull Request Test Coverage Report for Build 3645632564
💛 - Coveralls |
@tilmantroester I wonder if |
Is the |
This is what I got in the file
|
5ab41b0
to
077defb
Compare
5c551e0
to
3b5178e
Compare
This is the 1000th tag! 🎉🎉🎉 |
The c unit tests in ci on ubuntu did not run any tests (or the log did not show it?). Is this behaviour expected? |
Just want to leave a note for Apple Clang users with homebrew-installed libomp on macOS 10.15. If the installation failed or there are errors when python tries to import pyccl, in the shell, execute |
@hsinfan1996 @tilmantroester can I check where we stand on this PR? |
The functions checking OpenMP version and threads are done. However, some Apple Clang compilers (e.g. on my machine running MacOS 10.15) cannot link homebrew-installed libomp. The latest commit (d892a30) solves this issue by forcing libomp to link with all compiled library. I will revert the commit if this is not a proper way to solve the problem. I am happy with the changes to |
OK, can we run the tests and check they pass? |
@tilmantroester you've paid more attention than me to this. Are you happy to approve? |
pyccl/pyutils.py
Outdated
if openmp_version > 0: | ||
print(f'OpenMP version: {openmp_version}') | ||
else: | ||
print('OpenMP is not supported') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be preferable to have functions that return the numerical values with the expected values documented in a doc string, rather than print messages to stdout.
Right now they can't be used in automated scripts, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I haven't written in C language for a while. This is how I check if OpenMP is working on the compiled pyccl. Checked on macOS 10.15.7 with Apple Clang with OpenMP disabled and homebrew-installed Clang 15, the function is working as expected even if the environment variable "OMP_NUM_THREAD" is set to 0.