Repository navigation
Closed
Description
I am currently trying to setup a jobqueue cluster in a HPC environment in which available network interfaces on the compute nodes (where Dask workers live) and the login nodes (where the scheduler lives) are not the same.
Available network interfaces
- on the compute nodes there are
lo,ib0, but noib1and noeth{0,1} - whereas on the login nodes there are
lo,ib1,eth0, andeth1
Starting a jobqueue cluster with a basic workflow of
import dask_jobqueue
import dask.distributed as dask_distributed
jobqueue_cluster = dask_jobqueue.SLURMCluster(cores=6, memory='24GB',
project='esmtst', queue='devel',
interface='ib0')
client = dask_distributed.Client(jobqueue_cluster)
jobqueue_cluster.scale(jobs=1)causes the following error
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-b93ee7f2ce8e> in <module>
----> 1 jobqueue_cluster = dask_jobqueue.SLURMCluster(cores=6, memory='24GB',
2 project='esmtst', queue='devel',
3 interface='ib0')
/p/project/cesmtst/hoeflich1/miniconda3/envs/Dask-jobqueue_v2020.02.10/lib/python3.8/site-packages/dask_jobqueue/core.py in __init__(self, n_workers, job_cls, loop, security, silence_logs, name, asynchronous, interface, host, protocol, dashboard_address, config_name, **kwargs)
446 worker["group"] = ["-" + str(i) for i in range(kwargs["processes"])]
447
--> 448 self._dummy_job # trigger property to ensure that the job is valid
449
450 super().__init__(
/p/project/cesmtst/hoeflich1/miniconda3/envs/Dask-jobqueue_v2020.02.10/lib/python3.8/site-packages/dask_jobqueue/core.py in _dummy_job(self)
473 except AttributeError:
474 address = "tcp://<insert-scheduler-address-here>:8786"
--> 475 return self.job_cls(
476 address or "tcp://<insert-scheduler-address-here>:8786",
477 name="name",
/p/project/cesmtst/hoeflich1/miniconda3/envs/Dask-jobqueue_v2020.02.10/lib/python3.8/site-packages/dask_jobqueue/slurm.py in __init__(self, queue, project, walltime, job_cpu, job_mem, job_extra, config_name, *args, **kwargs)
39 job_extra = dask.config.get("jobqueue.%s.job-extra" % config_name)
40
---> 41 super().__init__(*args, config_name=config_name, **kwargs)
42
43 header_lines = []
/p/project/cesmtst/hoeflich1/miniconda3/envs/Dask-jobqueue_v2020.02.10/lib/python3.8/site-packages/dask_jobqueue/core.py in __init__(self, scheduler, name, cores, memory, processes, nanny, interface, death_timeout, local_directory, extra, env_extra, header_skip, log_directory, shebang, python, job_name, config_name, **kwargs)
195 if interface:
196 extra = extra + ["--interface", interface]
--> 197 kwargs.setdefault("host", get_ip_interface(interface))
198 else:
199 kwargs.setdefault("host", "")
/p/project/cesmtst/hoeflich1/miniconda3/envs/Dask-jobqueue_v2020.02.10/lib/python3.8/site-packages/distributed/utils.py in get_ip_interface(ifname)
181 if ifname not in net_if_addrs:
182 allowed_ifnames = list(net_if_addrs.keys())
--> 183 raise ValueError(
184 "{!r} is not a valid network interface. "
185 "Valid network interfaces are: {}".format(ifname, allowed_ifnames)
ValueError: 'ib0' is not a valid network interface. Valid network interfaces are: ['lo', 'ib1', 'eth0', 'eth1']Workaround as suggested in #207 (comment) doesn't work, because Dask distributed doesn't like interface and host to be set at the same time.
Activity
lesteve commentedon Feb 13, 2020
Maybe it worked in the past for some combination of
dask-jobqueueanddistributedbut not anymore.I think the best fix would be to have a
scheduler_optionsparameter as mentioned in #355 (comment).guillaumeeb commentedon Feb 21, 2020
@kathoef thanks for raising this issue. This is a major problem. If @hawk-sf is not up to it in #355, would you be willing to contribute a fix for this issue?
kathoef commentedon Feb 25, 2020
Thank you for having pointed this out @lesteve! Last week (by digging through the code in Dask jobqueue and Dask distributed, and with the help of the system admins on login and compute node network locations) I was finally able to make it work. The workaround is to avoid the interface keyword and to set all IP addresses explicitly:
Thank you @guillaumeeb and yes, I could probably do that. (Not before next week, though.)
lesteve commentedon Mar 4, 2020
FYI in #384, I have a PR to allow to do that. You should be able to do something like this:
In any case @kathoef if you could double-check this works on your cluster that would be much appreciated. You need to install
dask-jobqueuefrom the PR branch, for examplepip install git+https://github.com/lesteve/dask-jobqueue@add-scheduler-optionskathoef commentedon Mar 4, 2020
Yes, great! I will try this out tomorrow.
lesteve commentedon Mar 6, 2020
@kathoef have you had the chance to try my snippet on your cluster? I would greatly appreciate if you took the time to do that. Or maybe you could ping someone else that is using
dask-jobqueueon your cluster?If you are busy with other things, I would completely understand, no worries at all! I'll try to remind you in a week or so.
kathoef commentedon Mar 6, 2020
I am at it now, actually! And I'll report on it before I leave into the weekend. :)
quasiben commentedon Mar 6, 2020
The
ib0interface is an Infiniband connection correct? Is this what you are ultimately after, using Infiniband ?lesteve commentedon Mar 6, 2020
I don't know @kathoef's cluster but I think the convention is that
ib<something>is an Infiniband interface indeed.In my experience, I have used
ib<something>indask-jobqueuejust because there is this vague feeling that Infiniband is faster.I have to admit, I haven't really tested whether that was the case and I don't have any good insights whether at least some things will be faster (e.g. data transfer between Dask scheduler and Dask workers). If you have any insights on this @quasiben that would be greatly appreciated!
quasiben commentedon Mar 6, 2020
@lesteve I think to take advantage of Infiniband you would either need to write explicit c extensions for IB verbs/RDMA or use something like UCX/UCX-Py. I would not have expected that us
interface=ib0would work at all -- in fact, I would've expected this to fail. Did this at least work for you ?lesteve commentedon Mar 6, 2020
Yep
interface='ib0'works for me and many others. For exampleib0is used in quite a few of real-world examples: https://jobqueue.dask.org/en/latest/configurations.htmlquasiben commentedon Mar 6, 2020
Hmm, perhaps things work because most devices are configured for EoIB (Ethernet over IB) which maybe gets you some gains? I'll ask some folks I work with for their thoughts and report back.
You can also see IB transfers if you watch directories like the following:
At your note that things worked, I modified a small client/server test with python sockets connected to an Infiniband device and saw no transfers.
server
Client
kathoef commentedon Mar 6, 2020
I have checked it now! I had to make an additional change to make it work, however. The code still fails with the error I had posted initially, i.e. the scheduler network location is set from an interface name that only exists in the compute node scope of the Dask workers.
I have commited and pushed my solution here: https://github.com/kathoef/dask-jobqueue/tree/add-scheduler-options-kathoef (It looked save to me to delete the else-statement that sets an empty host, but please check that.)
lesteve commentedon Mar 7, 2020
Thanks a lot for checking, I appreciate you taking the time late on a Friday!
OK that is weird that you get the same error or maybe I got something wrong in my PR. That would be great if you could:
python -c 'import dask_jobqueue; print(dask_jobqueue.__version__)'(the idea is to make sure that you are using my branch)(no hurry and no pressure to do it before Monday though)
lesteve commentedon Mar 7, 2020
Thanks for the info @quasiben! This networking stuff is something I am really fuzzy about, but I would definitely like to learn a bit more about.
guillaumeeb commentedon Mar 7, 2020
@quasiben
Yep, that's exactly that. You'll get close to Infinity Band bandwith, but not full RDMA power and low latencies, as you said :
That's why we are interested of potential gains we would have with using UCX.
ib0orib1are generally IPoverIB interface as you said. Adancing with #371 would be great!@lesteve thanks for all your recent work!
kathoef commentedon Mar 9, 2020
Thank you for your very quick reply @lesteve! Actually I have checked quite carefully if the correct jobqueue code was used. The code still fails (for the HPC system I use) because:
The function
get_ip_interface()called here tries to retrieve the IP address of an interface using psutils here that does not exist in the scope of the login nodes where the Dask worker job script is generated. I'd like to highlight again that the only existing network interface on login nodes isib1and on compute nodes isib0, respectively, and that IP address retrieval works only if code is executed in the correct (system hardware) scope.According to these changes the host argument is now obsolete, and should not be used anymore outside of the scheduler dictionary argument? If that's the case then I think it would indeed be totally fine to simply delete the code lines as I have done here in extension to your solution.
lesteve commentedon Mar 10, 2020
OK I think I got it thanks for your message @kathoef! Until now I could not figure out why the workers
interfacewould be used on the node where the scheduler runs.The problem is that
.dummy_jobis called insideJobQueueCluster.__init__so that happens on the node the scheduler runs and.dummy_jobuses the workersinterface... note.dummy_jobis only here for.job_script()which is useful for debugging.I need to think more how to find a work-around for this ... it may be worth for me to try to reproduce the problem in a docker-compose setup so that I can debug more easily.
kathoef commentedon Mar 11, 2020
I think actually it would be a little bit of an overkill to debug this with a Docker compose setup. If it is helpful and if you don't mind (and as I have indeed capacity for such tasks this week!) I could try to develop a simple pytest solution that covers the network interface setup of my HPC cluster.
Actually, I have the feeling (at least for the 0.7.0 code, I haven't had the time to do this for the code in #384) that currently what I would call "scopes" are, or might be, "violated" at several places, and that some things could be cleaned up in that regard. I could try to come up with a list of suggestions on that matter? (For which a rather fresh perspective might be helpful.)
kathoef commentedon Mar 11, 2020
Also, it would be really nice if the new scheduler options could be set in a configuration file. I am also working on jobqueue defaults for HPC centers our group and others are working on and if I understand it correctly, currently on the HPC cluster we discuss here, one would always have to explicitely set the scheduler options in the cluster set up call. From a user perspective, however, it would be great if it was possible to do
and have everything specific to the machine hardware set up done in the background. Can/Should this be added in #384 or at a later point?
lesteve commentedon Mar 11, 2020
Not sure what you mean by "violated scopes", but there is certainly room for improvement and help on
dask-jobqueuewould be more than welcome indeed! Something you have to bear in mind is that testingdask-jobqueueis not trivial, each cluster have their own quirks so that sometimes there is some code that is not tested but is useful. If you have suggestion on how to improve testing, this would be more than welcome as well!We already have a
docker-composesetup to testdask-jobqueueon Travis (see https://github.com/dask/dask-jobqueue/tree/master/ci for more details), which is why I was mentioningdocker-compose. I am guessing (but I don't know for sure) that adding a network interface to the worker docker image that does not exist on the scheduler docker image is not that hard.That would make sense. I am not planning to include it in #384 to keep it simple. But I would welcome a PR on this! My thoughts on this: probably this should be nested inside the
slurmsection in~/.config/dask/jobqueue.yaml, i.e. something like:dask.configmay just be able to tackle this just fine.kathoef commentedon Mar 16, 2020
Thanks for commenting my thoughts, @lesteve and @guillaumeeb! And sorry for getting back later than I had hoped... in the following you find some thoughts on how I would test for the behaviour that is necessary on the HPC cluster I am working on, and how I would implement that.
I have pushed the tests for what I would call intended network interface argument behaviour here. These fail for Dask jobqueue 0.7.0 and for PR #384, because both codes make the (invalid!) assumption that the Dask worker interface can be used to also set the network location of the scheduler, which for PR #384 still happens e.g. here.
The test passes if either host or interface in the
scheduler_optionsare explicitely set, because in this case the Dask workerinterfaceis not anymore passed and set as scheduler network location. However, I think requiring the user to explicitely setscheduler_optionsto allow arbitrary Dask worker interface names is not a straightforward implementation of this feature.Generally, if no network interfaces are set, the scheduler and the workers operate via the local default network devices (see e.g.
ip rornetstat -ron Linux systems), which I think should remain the default behaviour for the scheduler object, ifscheduler_optionsare not set.lesteve commentedon Mar 16, 2020
@kathoef could you test #384 again with my snippet #382 (comment) ?
I think I removed the problematic code that was expecting the worker interface to exist on the scheduler even when using
scheduler_options.Thanks for your tests, I had a quick look at them and they help to clarify what you have in mind. You are correct that they will fail with #384.
interfacesets the interface to use both on the scheduler and the workers. The reason behind it is that in the majority of clusters, there is a common network interface that you can use both on the login node and the compute nodes. If there is not such a common network interface, the approach of #384 is to sayinterfaceis both for scheduler and workers but if you don't have such a common interface on your cluster, you can override theinterfacefor the scheduler by usingscheduler_options.I kind of agree it doesn't feel ideal, but I am afraid I don't see a better way forward at the moment. Changing the meaning of
interfaceto mean "worker-only interface" would potentially break existing code.lesteve commentedon Mar 23, 2020
@kathoef I completely understand if you have other priorities! I merged #384 and it would be great if you could confirm my snippet above works for you. Just for completeness you need to install the
masterbranch for example with:kathoef commentedon Mar 26, 2020
Sorry for the late reply, I have tested the code with your snippet, and it works on my cluster without problems now. 👍
This is true! However, I think, because Dask jobqueue is a high-level tool, and not a low-level base library, that introducing breaking changes is not excessively critical, as long as intended usage patterns are well documented (and error messages are indicative). I personally would always favour solutions that disentangle components, thus increasing the clarity/linearity of code/information flow. (Also, generally, code that is not written, does not fail.)
But I can also see why to decide differently on this aspect. Thanks for your work on adding the scheduler options feature, @lesteve! I will continue your work with #400 now. :)
lesteve commentedon Mar 26, 2020
Great, thanks for the confirmation!
Don't hesitate to ping me if you get stuck! By the way Dask-Jobqueue 0.7.1 was released this morning and it has the
scheduler_optionsfeature. It is on PyPI not on conda-forge yet.