question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple cores per process/thread

See original GitHub issue

We have a use case where we would like to dask.distributed to parallelize a python-bound C++ program that would work best if it could consume 8-32 threads depending on the problem size and will manage threading internally. Normally, a Dask worker is run on a node that has 32 cores with the worker using 2 processes at 1 thread each so that we can give each process 16 cores.

Looking at the code currently, it seems that nthreads = ncores / nprocesses without exceptions, is there a canonical way to change this so that we can orchestrate our normal Dask worker operation with dask-jobqueue?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:65 (41 by maintainers)

github_iconTop GitHub Comments

2reactions
dgasmithcommented, Dec 15, 2018

This thread has moved through several design concepts, let me try to recap:

  • Staying with the dask-worker language and defaults is likely optimal:
  --nthreads INTEGER     Number of threads per process. Defaults to number of
                         cores
  --nprocs INTEGER       Number of worker processes to launch.  Defaults to one.
  • Resources per task should be handled through the resources client/worker commands as jobqueue/dask-worker does not have much of an understanding of a task.
  • A proposed PR would simply allow the full specification of dask-worker parameters.
  • Any PR should keep functionality where worker nthreads = ncores / nprocs by default.

We can approach this in a few ways:

  • worker_nthreads = None or worker_threads_per_process = None which sets worker nthreads and default behavior if None.
  • @louisabraham suggestion of having kwargs to exactly mimic dask-worker with nthreads/nprocs (would require deprecating the current processes keyword)
  • one_thread_per_process = False/True, False is current behaviour while True sets nthreads=1.

I would very much vote for the nthreads/nprocs suggestion even if another warning needs to be thrown. This will keep the code logic and user understanding exactly the same as launching a dask-worker.

1reaction
jchoderacommented, Dec 14, 2018

I still would encourage API access to all relevant bits of your canonical dask-worker along with keeping the same name and meaning for these options, this would include nthreads.

This would indeed be great!

Read more comments on GitHub >

github_iconTop Results From Across the Web

CPU Core, Multi-Core, Thread, Core vs Threads, Hyper ...
In parallel execution, the tasks to be performed by a process are broken down into sub-parts, and multiple CPUs (or multiple cores) process ......
Read more >
c# - How do I spawn threads on different CPU cores?
There you can find a function to enumerate a process' threads as a collection of ProcessThread objects. This class has methods to set ......
Read more >
Multi-core and multi-threading performance ... - Scali's OpenBlog
For the OS, a thread is a unit of workload which can be scheduled to execute on a single core. This scheduling appears...
Read more >
Process vs Thread vs Core - YouTube
Learn about a process vs thread vs core including concurrent vs parallel program execution, logical vs physical cores, how threads run in a ......
Read more >
If a CPU is a dual core with 4 threads, does that mean it can ...
So, you get one process running per core. That's two processes running on a dual core. One level up, each core has 2...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found