Repository navigation
Conversation
|
Hmm, I wonder if this is really a good idea, it simplifies our current use case for Slurm but I don't think there's equivalent functionality with other schedulers (where the scheduler figures out the value of |
There was a problem hiding this comment.
If I understand correctly your need, I would advise you to just add a keyword arg for number of nodes (nodes below).
You don't need to override --cpus-per-task or --tasks-per-node then. All you would need to do (if I'm not mistaken, I'm not working with Slurm, but I believe it will work from your gist example) is the folowing:
cluster = SLURMCluster(
queue='batch',
processes=24,
threads=1,
nodes=2,
interface='ib0',
walltime='00:05:00',
)dask-worker command is actually spawning the 24 worker processes for you, you don't have to rely on Slurm to do it, and so don't have to launch mono process tasks.
It's okay for me to have this only in Slurm, from what I can tell, only Slurm proposes such an easy way of spawning the same task on multiple nodes (PBS relies on MPI or pbsdsh command for that)...
| # Init resources, always 1 task on 1 node (doing it this | ||
| # way rather than with the equivalent '-n 1' gives the user | ||
| # the flexibility to override these settings with job_extra) | ||
| header_lines.append('#SBATCH -N 1') |
There was a problem hiding this comment.
Why not use a optional keyword arg which defaults to 1 for the number of node?
|
By the way, you gist example seems to be saying that mpi4py is much simpler than Dask 🙂... |
|
Hmm, I think I'm still failing to make the use case clear. You are totally right about the node keyword argument but I think you are missing the point on overriding dask-jobqueue/dask_jobqueue/slurm.py Line 93 in d1cd730 but I want to set this independently of the dask-worker and make it dependent on the requirements of the tasks I expect to run. When I create a subprocess from my dask task that uses srun, SLURM automatically assumes I want all the resources in the current allocation (unless I tell it otherwise). So when a task is running, I have the single dask-worker using a single thread on one node but overseeing my MPI-enabled task which is running across all the X nodes allocated in the job. I was just using mpi4py to mock up a quick self-contained example. Maybe the output from this helps to clarify things: Of course the actual MPI-enabled tasks I want to use is much more complex than the simple example (and I want to hundreds/thousands of them). So, in short as an example, I want 12 dask-workers that oversee an allocation of 8 nodes each (total 96 nodes) where I want to run 1000 MPI-enabled tasks that each require 8 nodes. I hope that is clear(er) and I'm open to being told I'm doing something silly (I'm new to dask in general). What I have is working at the moment so I'm happy, but if there are tips for a better approach I'd appreciate them. Also, thanks in general for spending time looking at this. |
Okay, I did not notice the srun here, I thought that you wanted to run a given number of arbitrary task on a given set of nodes, which is simpler in Dask than in MPI.
If I understand correctly you want to spread MPI distributed jobs from dask workers? This is not clear to me in your example, your command should look something like One dask-worker is not made to oversee mutiple nodes. |
You can use srun instead of mpirun/mpiexec (in fact on our system you can't use anything else) and it assumes the value of
I want to (ultimately) create something that is not tied to a particular scheduler nor a particular task. We thought that leveraging the task management infra provided by dask would help us do that well (and we are happy with things so far). The solution of how to run individual tasks across the set of nodes can be generic, you'd just need to have things configurable for the particular resource you have access to. I must admit to not being fully familiar with what Slurm has to offer but from what I know about job arrays I don't think that there's a way I can dynamically manage the tasks I would like to send based on the previous outcomes.
I don't need dask to actually manage multiple nodes, I just need it to manage the forked srun process, SLURM/MPI takes care of the rest (in particular, when dask-worker exits Slurm cleans up). |
|
Hmm, this is a quite complex use case, using Dask to monitor and launch mpi executable with processes spawned by Slurm.
As you said earlier, I don't believe you will be able to do something similar with another jobqueue scheduler... Nevertheless, your PR is still acceptable and can be usefull to others, but I would as said above use a keyword arg for the number of nodes. And I believe you can use the This will leads to something like cluster = SLURMCluster(
name='mpi_tasks',
queue='batch',
processes=1,
threads=1,
interface='ib0',
walltime='00:05:00',
job_cpu=1,
job_nodes=2,
job_extra=['--tasks-per-node=24']
) |
|
Just to be sure, with the PR, if I call cluster = SLURMCluster(
processes=24,
threads=1,
job_nodes=2
)Will this result in the command launched on the 2 Slurm reserved nodes? |
|
Yeah, I had the same reservation that was why I put back the old behaviour by default. No it won't, and I don't like the fact that people might assume it does. For that to happen you would need to launch it with srun/mpiexec/mpirun I'm not sure I'm a fan of |
|
Hmmm, I assumed it does 🙂. Could we use srun within the Slurm implementation into the command to run, by overloading some jobqueue.py function? If we don't have this behaviour, then this PR is much less interesting from my point of view, sorry for the burden of developing all this... |
|
Joining the party late here:
In my view, this simplicity is a core strength of jobqueue so we need to be careful not to step on any of these core features. |
|
Thanks @jhamman for sharing this opinion. I believe from previous discussion with @mrocklin that he shares your views. I was interested with this so we can have a single tool, but obviously this would be feasible only with slurm, and it is not really useful. For this PR, I propose to only made the changes needed at first. As long as it does not impact current slurm behavior and does not add complexity, I see no strong reason to reject it. |
|
@jhamman I'm on board with the smaller jobs, the use case is that the tasks themselves require multiple nodes (we're not deploying dask across the nodes in the job, we're spawning the task there). I understand that this is perhaps an unusual/unexpected use case, I'm ok with not merging this PR (it was a useful exercise for me anyway). The changes were just so to save a few lines of code in the wrapper, but I think consistency across the schedulers probably trumps that and I know that I can work around what is there. |
|
So what do you want to do with this one? As said previously, I'm ok to merge the changes from the first two commits here, if you can revert to that state. I prefer leaving room for people to customize dask-jobqueue to fit their need if possible. |
|
I think I would just close this, the discussion has been useful but from the |
|
Okay, thanks for the work and discussion here! |
The current slurm implementation sets
which is fine but there is a more flexible equivalent implementation (which allocates a single task on a single node)
This is more flexible because it allows overriding these settings through
job_extraso that jobqueue can allocate multi-node jobs.I tried to explain our use case (poorly) in #62 , but I have a gist now that hopefully does that a bit better.