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
{{ message }}
Repository navigation
bug: dask_worker runs forever using multiple threads per process #5132
then the above program finishes in seconds. Weird thing is: in this case, dashboard shows that CPU usage is above 100%, i.e., dask-worker are threaded.
Does anyone know why it happens, or whether this is a potential bug? Thanks in advance.
changed the title [-]bug: program runs forever using multiple threads per dask_worker[/-][+]bug: dask_worker runs forever using multiple threads per process[/+]on Jul 22, 2019
Thanks for the explanation. I was assuming Numba would pick "nthreads" of the belonging Dask worker and fork exactly "nthreads" threads. It sounds like Numba and Dask use different threading mechanism/layer, and even if a Dask worker uses only one thread, Numba can still fork multiple threads under that Dask thread. Please let me know if I miss any key concept here.
It sounds like Numba and Dask use different threading mechanism/layer, and even if a Dask worker uses only one thread, Numba can still fork multiple threads under that Dask thread.
Yes, that is correct. The standard threading API libraries use doesn't make it easy to share threadpools between different projects (e.g. dask, numba, openblas, etc...). Often if you have parallelism at one level you want to limit parallelism at other levels to prevent contention.
I believe this question has been answered, closing. Feel free to reopen if you continue to have issues.
Activity
[-]bug: program runs forever using multiple threads per dask_worker[/-][+]bug: dask_worker runs forever using multiple threads per process[/+]jcrist commentedon Jul 23, 2019
You're using
njitwithparallel=True, which results in numba using threads behind the scenes. In this case, you're parallelizing on multiple levels (multiple dask workers, each with multiple threads, running numba functions that also use multiple threads). This can oversubscribe your cores, leading to contention and slowdowns, and also uses more CPUs than you intended. I recommend either using single threaded numba or single-threaded dask, and not mixing them. To set the number of threads in numba see http://numba.pydata.org/numba-doc/latest/reference/envvars.html?highlight=numba_default_num_threads#envvar-NUMBA_NUM_THREADS, or just remove theparallel=Trueinnjit.llodds commentedon Jul 24, 2019
Thanks for the explanation. I was assuming Numba would pick "nthreads" of the belonging Dask worker and fork exactly "nthreads" threads. It sounds like Numba and Dask use different threading mechanism/layer, and even if a Dask worker uses only one thread, Numba can still fork multiple threads under that Dask thread. Please let me know if I miss any key concept here.
jcrist commentedon Jul 24, 2019
Yes, that is correct. The standard threading API libraries use doesn't make it easy to share threadpools between different projects (e.g. dask, numba, openblas, etc...). Often if you have parallelism at one level you want to limit parallelism at other levels to prevent contention.
I believe this question has been answered, closing. Feel free to reopen if you continue to have issues.