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

Add Tao command to set number of OpenMP threads #1357

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

ken-lauer
Copy link
Collaborator

Background / Changes

Supersedes #1356

On-the-fly configuration of OpenMP's number of threads can be helpful, without having to resort to environment variable changes.

  • Moves s%com%omp_n_threads to s%global%n_threads and updates references (only one which was commented out)
    • s%com isn't something users typically modify with set or view with show, so I think this move is justified
    • (Do we need backward-compatibility for this?)
  • Adds show global and pipe global support to show n_threads

Usage

So with the typical set syntax:

Tao> set global n_threads = 3
[MESSAGE | 2025-JAN-09 18:06:15] tao_set_openmp_n_threads:
    OpenMP active with number of threads: 3

@ken-lauer ken-lauer force-pushed the enh_global_n_threads branch from adfe2fe to 9802d57 Compare January 9, 2025 18:08
@DavidSagan
Copy link
Member

@ken-lauer This looks generally good. One thing that got overlooked is the case when the User sets n_threads in an init file. You need to modify the routine tao_init_global which is in tao_init_mod.f90 for this.

@ken-lauer
Copy link
Collaborator Author

@ken-lauer This looks generally good. One thing that got overlooked is the case when the User sets n_threads in an init file. You need to modify the routine tao_init_global which is in tao_init_mod.f90 for this.

Thanks - that led me to reinit tao which also resets globals. Fixed in f054de7.

There are some code paths where it may get set multiple times in a row. I switched the message to then instead only show when n_threads was changed.

@DavidSagan DavidSagan merged commit f9b6e34 into bmad-sim:main Jan 9, 2025
3 checks passed
@ken-lauer ken-lauer deleted the enh_global_n_threads branch January 9, 2025 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants