-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Currently, when using ALP's transition path (e.g., with the CG method), the maximum number of threads is determined by the OMP_NUM_THREADS environment variable. However, attempts to dynamically set the thread count via omp_set_num_threads() in the calling code (e.g., in main()) have no effect on ALP's behavior.
This occurs because ALP initializes the thread count via a static global variable, which is resolved before main() executes. Consequently, runtime adjustments using OpenMP's API are ignored.
While one potential fix would be to query the active thread count dynamically (e.g., via omp_get_max_threads() in numThreads() (see init.hpp in nonblocking)), this could introduce work imbalance as there are assumptions that was already made based on the original value of the number of threads before the execution of main(). Existing logic may rely on the initial static thread count, and altering it mid-execution might lead to unintended side effects.
Requested Feature:
A mechanism to safely configure ALP's thread count at runtime (e.g., through an explicit ALP API call or controlled re-initialization) without disrupting internal assumptions.