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

Fix: nosmt OMP Threads Default #3647

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Src/Base/AMReX_OpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,13 @@ namespace amrex::OpenMP
// default or OMP_NUM_THREADS environment variable
} else if (omp_threads == "nosmt") {
char const *env_omp_num_threads = std::getenv("OMP_NUM_THREADS");
if (env_omp_num_threads != nullptr && amrex::system::verbose > 1) {
if (env_omp_num_threads == nullptr) {
omp_set_num_threads(numUniquePhysicalCores());
}
else if (amrex::system::verbose > 1) {
amrex::Print() << "amrex.omp_threads was set to nosmt,"
<< "but OMP_NUM_THREADS was set. Will keep "
<< "OMP_NUM_THREADS=" << env_omp_num_threads << ".\n";
} else {
omp_set_num_threads(numUniquePhysicalCores());
}
} else {
std::optional<int> num_omp_threads = to_int(omp_threads);
Expand Down