Skip to content
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

[OpenMP] Use OMP_NUM_THREADS by default #699

Closed
yeganer opened this issue Jan 27, 2017 · 6 comments
Closed

[OpenMP] Use OMP_NUM_THREADS by default #699

yeganer opened this issue Jan 27, 2017 · 6 comments

Comments

@yeganer
Copy link
Contributor

yeganer commented Jan 27, 2017

If the configuration is missing montecarlo.nthreads use the OpenMP default value for parallelization.
On the C level this is already possible by calling montecarlo_main_loop with nthreads=0.

All that is left to do is change the default value in the yaml schema and verify this is working as expected.

@saurvs
Copy link

saurvs commented Feb 3, 2017

Hello I'm a new contributor here and I'd like to take a stab at this.

@unoebauer
Copy link
Contributor

@yeganer -- is this still relevant?

@unoebauer unoebauer added this to the v2.0 milestone Aug 1, 2017
@unoebauer
Copy link
Contributor

@yeganer, @wkerzendorf - I just had a look at this issue and came to the following conclusions:

  • setting nthreads in the config to 0 triggers the desired behaviour - Tardis OMP uses the number of threads stored in the environment variable OMP_NUM_THREADS
  • However, if the environment variable is not set, OMP uses all threads available on the system (e.g. on my laptop with an intel i5 and hyperthreading 4).

Based on these findings, I'd advocate not to change the default value, since it would most likely lead to the undesired outcomes for inexperienced users who have not set OMP_NUM_THREADS. Users with OMP experience who wish to control the Tardis OMP behaviour via an environment variable can still do so by setting nthreads to 1 in their configs.

@wkerzendorf
Copy link
Member

From my perspective - by default - TARDIS should use the maximum number of threads available. That means the default value should be 0 (not visible in the configuration file), but we should have in our examples nthreads=1 commented out so people see how they can change the number of threads.

@unoebauer
Copy link
Contributor

Ok, I think I can live with that. I'll include it in my PR.

wkerzendorf added a commit that referenced this issue Oct 9, 2017
@unoebauer
Copy link
Contributor

Resolved by #797.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants