You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: NEWS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -342,6 +342,8 @@ See [#2611](https://github.com/Rdatatable/data.table/issues/2611) for details. T
342
342
343
343
21. `[` now preserves existing key(s) when new columns are added before them, instead of incorrectly setting a new column as key, [#7364](https://github.com/Rdatatable/data.table/issues/7364). Thanks @czeildi for the bug report and the fix.
344
344
345
+
22. `setDTthreads(percent=)` and `setDTthreads(threads=)` now respect `OMP_NUM_THREADS` and `omp_get_max_threads()`, ensuring consistency with `setDTthreads()` (no arguments) when OpenMP environment variables are set, [#7165](https://github.com/Rdatatable/data.table/issues/7165). Previously, explicitly setting a thread count or percentage would ignore these OpenMP limits, potentially exceeding the user'sintendedthreadcap.Thanksto@bastisticianforthereportand@ben-schwenforthefix.
if (n==0||n>num_procs) n=num_procs; // setDTthreads(0) == setDTthread(percent=100); i.e. use all logical CPUs (the default in 1.12.0 and before, from 1.12.2 it's 50%)
153
158
}
154
-
n=imin(n, omp_get_thread_limit()); // can't think why this might be different from its value on startup, but call it just in case
155
-
n=imin(n, getIntEnv("OMP_THREAD_LIMIT", INT_MAX)); // user might have called Sys.setenv(OMP_THREAD_LIMIT=) since startup and expect setDTthreads to respect it
156
-
DTthreads=imax(n, 1); // imax just in case
159
+
DTthreads=cap_threads(n);
157
160
// Do not call omp_set_num_threads() here. Any calls to omp_set_num_threads() affect other
158
161
// packages and R itself too which has some OpenMP usage. Instead we set our own DTthreads
159
162
// static variable and read that from getDTthreads(n, throttle).
0 commit comments