Repository navigation
Description
Hi everyone,
I play with a PBS cluster but each time I start a cluster, it takes more than 10 minutes to initiate.
Each node have 28 processors and I start 10 nodes = 280 workers (mono-thread)
My code is quite simple
cluster = PBSCluster()
cluster.start_workers(10)
client = Client(cluster)
Then, I use a home-made function to monitor how many workers are actually started
def wait_client_ready(client):
"""
Wait for the client to be ready (all workers started)
"""
import time, sys
Nnodes = len(client.cluster.jobs)
total_Nw = client.cluster.worker_processes*Nnodes
Nw = 0.
while(len(client._scheduler_identity.get('workers', {}))<total_Nw):
p = len(client._scheduler_identity.get('workers', {}))/total_Nw
time.sleep(2)
if p>=Nw:
Nw = int(p*10)/10
print('{} % of the workers started'.format(int(p*100)))
Nw+=0.1
print('100 % of the workers started: {} workers'.format(total_Nw))
The first three lines are instantaneous and qstat on the frontal of my HPC shows that PBS gave me the 10 nodes I required (running status).
Then, the starting procedure of the workers is very slow: My monitoring function shows a relatively fast apparition of the first 50 % of the workers and then it takes a very long time to have the remaining 50 % (especially the last 10 %)
Here is my yaml config file:
pbs:
name: dask-worker
# Dask worker options
cores: 28
processes: 28
memory: 120GB
interface: ib0
death-timeout: 900 # should be large if many workers are launched
local-directory: null
# PBS resource manager options
queue: mpi_1
project: SKIM
walltime: '48:00:00'
extra: ""
env-extra: []
resource-spec: select=1:ncpus=28:mem=120GB
job-extra: ['-m n']
Any idea of what could slow down the starting procedure of the workers ?
Activity
guillaumeeb commentedon Nov 12, 2018
Okay so this is quite important, it does not seem to be PBS related, that would have been my first guess!
The only thing special about your config is that you're forking a lot of processes. I guess your tasks are GIL bounded?
Several things I would recommand:
One last point, you should use the cluster object in your waiting method. And directly use
cluster.scheduler.workers.lanougue commentedon Nov 13, 2018
I do not understand this point since I do not have sent any task at this point of the code. I am just waiting for the wokers to be all available.
Looking at the log of the workers, I have nothing strange to report.
This is something I will look into now since my version is quite old now.
Ok, (If I remember well, this waiting function was not working anymore on the last version of dask/distributed. I will update it)
Thanks
lanougue commentedon Nov 13, 2018
I updated my conda environement and I get the following result for the lastest version of Dask (0.20.1) / Distributed (1.24.0) with this minimalist code:
Then I manually monitor the "cluster" variable to check the number of running workers as a function of time and here are the results:
It takes a few seconds to start the first worker and more than 25 seconds to start the last one !
@mrocklin suggested here issus that it could be unrelated to dask/jobqueue and more linked to the system.
@guillaumeeb = If possible, I would be curious if you can report the results you have with your cluster in such minimalist case.
If yours is much faster, I will see what my system administrators can do.
Thanks
guillaumeeb commentedon Nov 13, 2018
Why do you launch 28 processes on 28 cores, is it really needed? You could use python threads too if compatible with your workflow.
Could you share the logs? Do you only see things like :
I've done the test on my system with
and
Once the PBS job is running, things are quite instantaneous, 10 seconds to get scheduled by PBS, and then all is up:
Seems like you have trouble starting many processes...
One thing that troubles me in your setup is
This seems wrong. You should definitly use a local directory.
I also remember @apatlpo was having some problem on your cluster (if I'm not mistaken), see #30.
lanougue commentedon Nov 14, 2018
I want to use as many processes as I can since my code is autoscaled as a function of the number of processes. For me, the highest the number of workers the faster is the code. I don't have any memory issue for the workers since they only use about 10% of their respective memory. I tried to use threads but it does not work well for me:
I don't have these problems with independant processes.
Yes, I have this kind of logs:
The only permanent warning I have is
Could it be linked to this warning ?
Yes, it seems so ! I will soon have acces to CNES cluster (huge project in collaboration) so I will be able to test this procedure on both clusters. We'll probably be in touch soon again.
Ok, thanks for the advice. I will discuss about that with him
guillaumeeb commentedon Feb 4, 2019
@lanougue any update on this? I still believe this is somehow linked to your cluster, where you able to test it elsewhere?
lanougue commentedon Feb 5, 2019
Hi @guillaumeeb ,
I still have this issue (about 7 or 8 min to wake up 15 nodes with 28 workers on each = 420 workers).
For the moment, while waiting for the workers, I am doing other useful calculations on the main stream.
I was about to migrate to CNES cluster but I found a workaround with the other problem (memory issue while writing on disk) so, at that time, I'm still living with the problem of slow starting procedure of the workers.
I definitely have to do some tests on CNES cluster. I will report back here when it will be done
lanougue commentedon Mar 12, 2019
Hi @guillaumeeb,
I did a simple test with @apatlpo on CNES cluster and it worked like a charm (very fast initialization procedure). My problem seems to be linked to our cluster.
I will try to change --local-directory to another file system as mentioned in #rapidsai/dask-cuda#11
Add warning if creating scratch directories takes a long time
guillaumeeb commentedon Mar 12, 2019
Yep, always use
--local-directoryon an HPC Cluster and point that to a node local storage!Glad it worked fine on CNES cluster 😁
mrocklin commentedon Mar 12, 2019
Note that there is also a
local-directoryentry in the configuration, if you want to apply it there for your system.lanougue commentedon Mar 12, 2019
Ok, my mistake was to forgot to try harder the first suggestion of @guillaumeeb. In my config file jobqueue.yaml the local-directory field was set to "null" as noticed by @guillaumeeb. This seems to slow down the starting procedure of the workers but workers don't crash and the code can finally continu.
I tried to set local-directory to some fixed location on one of the HPC disk but most of the workers die with errors (failed to start...).
My salvation was to set local-directory to $TMPDIR and it is finally working fine now ! (it seems so obvious now...)
Thanks to all for the help.
Add warning if creating scratch directories takes a long time (#2561)
Add warning if creating scratch directories takes a long time (dask#2561
manugarri commentedon Jul 5, 2019
not sure if this belongs here but running on EMR my workers take 5-7 minutes to start, is that an expected time? For what im reading in this thread, it seems that adding
local-directoryto my conf wont work (since the emr only has temporary ebs storage I believe)mrocklin commentedon Jul 5, 2019
manugarri commentedon Jul 5, 2019
my bad, will post it there.