Limiting threads in TensorFlow
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- numpy, python, scikit-learn, tensorflow
- Área
- backend, machine-learning
Línea de trabajo
Start by reading the threadpoolctl code that discovers and controls native thread pools, then check whether TensorFlow exposes a supported control point in the version discussed (2.5.0). Reproduce the example with threadpool_limits(limits=1) and compare CPU time with and without the limit. Done means TensorFlow work respects the requested limit, or the issue documents why threadpoolctl cannot control it and what limitation users should expect.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
As far as I can tell, limiting the number of threads in TensorFlow with threadpoolctl currently doesn't work.
For instance with the following minimal example with Tensorflow 2.5.0,
example.py
import tensorflow as tf
import numpy as np
from threadpoolctl import threadpool_limits
with threadpool_limits(limits=1):
X = tf.constant(np.arange(0, 5000**2, dtype=np.int32), shape=(5000, 5000))
tf.matmul(X, X)
running,
time python example.py
on a 64 cores CPU, produces,
real 0m3.781s
user 1m8.685s
so the user (CPU) time is still >> real run time, meaning that many CPU are used.
This becomes an issue if people run scikit-learn's GridSearchCV or cross_validate on a Keras or TensorFlow model, since it then results in CPU over-subscription. I'm surprised there are no more issues about it at scikit-learn.
Tensorflow also regrettably doesn't recognize any environment variables to limit the number of CPU cores either. The only way I found around it is to set the CPU affinity mask with taskset. But then again it wouldn't help for cross-validation for instance, since joblib would then need to set the affinity mask when creating new processes which is currently not supported.
Has anyone looked into this in the past by any chance?
- Lenguaje dominante
- Python
- Estrellas
- 434
- Forks
- 38
- Merge medio
- 2 d 14 h
- PR fusionados (30 d)
- 8
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de joblib/threadpoolctl
-
Make it possible to set active/spin wait behavior of LLVM/Intel OpenMP via `kmp_set_blocktime`Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
joblib/threadpoolctl#271 ·
Los mantenedores suelen responder en 1 día
-
Make it possible to inspect active/spin wait behavior of LLVM/Intel OpenMP via `kmp_get_blocktime`Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
joblib/threadpoolctl#270 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
joblib/threadpoolctl#261 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Opt-in API that has a cached `ThreadpoolController`Posiblemente ocupada @itamarst la tomó hace 27 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
joblib/threadpoolctl#254 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Speed up usage of threadpoolctlPosiblemente ocupada @itamarst la tomó hace 35 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 18/100
joblib/threadpoolctl#246 ·
Los mantenedores suelen responder en 1 día
Todos los issues de joblib/threadpoolctl
Issues similares
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
good first issue module-baseline needs triage ux
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
darnitdevorg/darnit#650 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
nyjc-computing/campus#938 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
nf-osi/nf-metadata-dictionary#1027 ·
Los mantenedores suelen responder en 1 día
-
bug documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
qatrackplus/qatrackplus#913 ·
Los mantenedores suelen responder en 3 días