Skip to content

[zdnnx] Use OMP_NUM_THREADS to control the number of threads for NNPA #3227

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tungld
Copy link
Collaborator

@tungld tungld commented Jul 16, 2025

Since NNPA in z17 can be remotely accessed, the use of OMP_PLACES to manually assign CPU to threads is not necessary. This patch simplifies that by using OMP_NUM_THREADS which works with both compiler-generated OMP and zdnnx's OMP.

Additionally, an environment variable OM_NUM_ZAIU_THREADS is introduced if users want to use a different number of threads for NNPA. Otherwise, the number of threads for NNPA is the same as OMP_NUM_THREADS.

}
// If OMP_NUM_THREADS is not set, it is the sequential mode.
const char *env = getenv("OMP_NUM_THREADS");
zdnnx_num_procs = (env != NULL) ? atoi(env) : 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between zdnnx_num_procs and zdnnx_num_zaius. The names feel confusing and if they are two different entities, their name should be clearer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! zdnnx_num_procs is not necessary any more. I just removed it and revised some variable names. Thanks!

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