Handle Openmp num threads via Kokkos#263
Conversation
… the fact that Kokkos won't change the threadCount
|
The (num_omp_threads_) parameter at the loops were not really needed. Only in the case if you would run two simultaneous GmgPolar instances with e.g 2 threads each (making the global parameter equal to 4, but you could restrict it to 2 threads for a single instance). |
|
I think that the num_omp_thread parameter is basically just used to set the number of threads used in the main.cpp starting from our run.sh script. Inside the GmgPolar solver it is basically unusued. TLDR: Yes we can remove the number of threads variable and modify the run.sh script as you described. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #263 +/- ##
==========================================
- Coverage 89.42% 89.38% -0.04%
==========================================
Files 79 79
Lines 9172 9139 -33
==========================================
- Hits 8202 8169 -33
Misses 970 970 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|

Previously the number of threads was set at each individual loop. This is error prone as it can easily be forgotten on 1 loop. It is safer to set the number of threads once and for all using
omp_set_num_threads. However Kokkos does not use the value ofomp_num_threadsset via the OpenMP function. Instead the only way to set this information is during the call toKokkos::initialise(orKokkos::ScopeGuard) at set up. As we remove explicit OpenMP loops from the code we therefore lose control of the number of threads.This PR removes the
num_omp_threadsvariable passed throughout the code. It runs the tests with 1 or 16 threads via the macroGMGPOLAR_TEST_THREADS. For the main the number of threads should be specified using:or
Merge Request - GuideLine Checklist
Guideline to check code before resolve WIP and approval, respectively.
As many checkboxes as possible should be ticked.
Checks by code author:
Always to be checked:
If functions were changed or functionality was added:
If new functionality was added:
If new third party software is used:
If new mathematical methods or epidemiological terms are used:
Checks by code reviewer(s):