-
Notifications
You must be signed in to change notification settings - Fork 22
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 semantic for reading thread count from $OMP_NUM_THREADS #73
Add semantic for reading thread count from $OMP_NUM_THREADS #73
Conversation
Zero or negative values given as first argument of the various prototypes led to errors. This commit adds semantic to 0 or negative values by enabling the program to read the OMP_NUM_THREAD value from the environment, or using the number of procs availables if the variable is not defined.
Add first argument values and the associated effect on the multithreaded behavior
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.
Thanks, this looks like a good idea!
NB: I have retargeted the PR to develop
I haven't tested this myself, yet, but leaving a request for guarding the use of the OpenMP API, to make sure this can build without OpenMP available.
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.
Hi @antoine-morvan many thanks for the contribution.
I also agree that this is a good idea, but that we might also need the #ifdef
guards. However, I've run this and recreated the previous failure, and it all works nicely and as expected, so should be good to go once this is in place.
Regarding the For the in Fortran files that would match what's in the |
Should be better with OpenMP-less support :) |
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.
Ok, fantastic. Many thanks @antoine-morvan GTG from me.
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.
Many thanks for adding the guards! We should sort this for CUDA/C as well, but that's for a different PR.
Hello,
I am using some scripts to automatically launch the CloudSC dwarf with various numbers of OpenMP thread. The framework however relies on
$OMP_NUM_THREAD
to set this value, and cannot act on the executable arguments.This PR does 2 things:
$OMP_NUM_THREADS
variable from the environment if present or defaults to CPU count (omp_get_max_threads()
);The updated readme should reflect these changes.
This should not break existing behavior, as zero or negative arguments were leading to aplication crash.
Best regards.