Skip to content

Example PBS Script #1260

Closed
Closed

Description

@mrocklin

People using Dask on traditional job schedulers often depend on PBS scripts. It would be useful to include a plain example in the documentation that users to download, modify, and run.

What we do now

Currently we point users to the setup network docs, and in particular the section about using job schedulers with a shared network file system. The instructions there suggest that users submit two jobs, one for the scheduler and one for the workers:

# Start a dask-scheduler somewhere and write connection information to file
qsub -b y /path/to/dask-scheduler --scheduler-file /path/to/scheduler.json

# Start 100 dask-worker processes in an array job pointing to the same file
qsub -b y -t 1-100 /path/to/dask-worker --scheduler-file /path/to/scheduler.json

However this is flawed because the scheduler or workers may start and run independently from each other. It would be better to place them into a single job, where one special node is told to be the dask-scheduler process and all other nodes are told to be the dask-worker processes. Additionally we would like to offer some guidance on tuning the number of CPUs and pointing workers to use local high-speed scratch disk if available.

PBS script options

Many docs on PBS scripts exist online, but each seems to be made by an IT group at a separate super-computer. It is difficult to tease out what is general to all systems and what is specific to a single supercomputer or job scheduler. After reading from a number of pages I've cobbled together the following example.

#!/bin/bash -login
# Configure these values to change the size of your dask cluster
#PBS -t 1-9                 # Nine nodes.  One scheduler and eight workers
#PBS -l ncpus=4             # Four cores per node.
#PBS -l mem=20GB            # 20 GB of memory per node
#PBS -l walltime=01:00:00   # will run for at most one hour

# Environment variables
export OMP_NUM_THREADS=1

# Write ~/scheduler.json file in home directory
# connect with
# >>> from dask.distributed import Client
# >>> client = Client(scheduler_file='~/scheduler.json')

# Start scheduler on first process, workers on all others
if [[ $PBS_ARRAYID == '1' ]]; then
    dask-scheduler --scheduler-file $HOME/scheduler.json;
else
    dask-worker
    --scheduler-file $HOME/scheduler.json \   
    --nthreads $PBS_NUM_PPN \
    --local-directory $TMPDIR \
    --name worker-$PBS_ARRAYID \
    > $PBS_O_WORKDIR/$PBS_JOBID-$PBS_ARRAYID.out \  
    2> $PBS_O_WORKDIR/$PBS_JOBID-$PBS_ARRAYID.err;  
fi

https://wiki.hpcc.msu.edu/display/hpccdocs/Advanced+Scripting+Using+PBS+Environment+Variables
http://www.pbsworks.com/documentation/support/PBSProUserGuide10.4.pdf

Questions

  • What is the difference between ncpus and ppn?
  • How about -t 1-8 and nodes=8?

Does this actually work? I suspect not. I don't have a convenient testing system for this and would appreciate coverage by a few different groups.

Activity

  1. apatlpo commented on Jul 17, 2017

    @apatlpo
    Contributor

    Hi,
    I actually have access to a cluster that uses PBS scripts and would very much like to compute distributed xarray computations on it.
    Your code does not work for me right now for multiple reasons, the main one being that dask-distributed is not installed on the cluster. Do you think I could install it locally? or will that require sys admins to step in?
    aurelien

  2. martindurant commented on Jul 17, 2017

    @martindurant
    Member

    I believe PBS_ARRAYID is indexed from zero, although this will not matter - we ensure to create exactly one scheduler either way.
    During sprints, a mini-script very much like this one did succeed in setting up a cluster and running a joblib-derrived workflow.

  3. mrocklin commented on Jul 17, 2017

    @mrocklin
    MemberAuthor

    @apatlpo you can install dask using pip or conda. If you have a local python installation (such as would be created with anaconda) then you should be able to follow the instructions here without help from your system administrator: http://distributed.readthedocs.io/en/latest/install.html

  4. martindurant commented on Jul 17, 2017

    @martindurant
    Member

    One obvious possibility is to have the (conda) python distribution in a directory accessible to all machines. Also, code in knit exists to build an environment to a description or wrap an existing one and place it in a particular location.
    The PATH would need to be set to see wherever python ends up, or call python by absolute path.

    (pip install against a system python will work too, using the --user flag)

  5. apatlpo commented on Jul 17, 2017

    @apatlpo
    Contributor

    I believe the conda install went successfully.

    After a very quick playing around before dinner time, it's not working yet but
    here is what I've got for my PBS script:

    #!/bin/bash -login
    # Configure these values to change the size of your dask cluster
    ##PBS -t 1-9                 # Nine nodes.  One scheduler and eight workers
    ##PBS -l ncpus=4             # Four cores per node.
    ##PBS -l mem=20GB            # 20 GB of memory per node
    #PBS -q mpi
    #PBS -l select=2:ncpus=28:mpiprocs=28:mem=120G
    #PBS -l walltime=01:00:00
    
    # will run for at most one hour
    
    export PATH="$HOME/.miniconda2/envs/daskdist/bin:$PATH"
    echo $PATH
    
    env
    
    echo 'PBS_NODEFILE start ( '
    cat $PBS_NODEFILE
    echo ') PBS_NODEFILE ends '
    
    # Environment variables
    export OMP_NUM_THREADS=1
    
    echo 'PBS_ARRAYID'
    echo $PBS_ARRAYID
    echo 'PBS_NUM_PPN'
    echo $PBS_NUM_PPN
    echo 'TMPDIR'
    echo $TMPDIR
    echo 'PBD_JOBID'
    echo $PBD_JOBID
    
    # Start scheduler on first process, workers on all others
    if [[ $PBS_ARRAYID == '1' ]]; then
        dask-scheduler --scheduler-file $HOME/scheduler.json;
    else
        dask-worker \
        --scheduler-file $HOME/scheduler.json \
        --nthreads $PBS_NUM_PPN \
        --local-directory $TMPDIR \
        --name worker-$PBS_ARRAYID \
        > $PBS_O_WORKDIR/$PBS_JOBID-$PBS_ARRAYID.out \
        2> $PBS_O_WORKDIR/$PBS_JOBID-$PBS_ARRAYID.err;
    fi
    
    

    the output is:

    Warning: no access to tty (Bad file descriptor).
    Thus no job control in this shell.
    /home1/datahome/aponte/.miniconda2/envs/daskdist/bin:/home1/datahome/aponte/.miniconda2/envs/petsc/bin:/usr/pbs/bin/:/home1/datahome/aponte/.miniconda2/bin:/opt/sgi/sbin:/opt/sgi/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/c3/bin:/opt/pbs/default/bin:/opt/pbs/default/sbin:/usr/lpp/mmfs/bin:/sbin:/bin
    MKLROOT=/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/mkl
    CPLUS_INCLUDE_PATH=/appli/mpt/2.15-p11386/include
    MODULE_VERSION_STACK=3.2.10
    LESSKEY=/etc/lesskey.bin
    MANPATH=/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/man/common:/appli/mpt/2.15-p11386/man:/opt/pbs/default/man:/opt/sgi/share/man:/opt/intel/mic/man:/usr/local/man:/usr/share/man:/opt/c3/man:/opt/pbs/default/man:/opt/sgi/share/man
    NNTPSERVER=news
    NETCDF_CONFIG=/appli/NETCDF/4.3.3.1-mpt-intel/bin/nf-config
    HOSTNAME=r1i7n3
    XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
    INTEL_LICENSE_FILE=28518@vdatarmor-lic
    TERM=linux
    HOST=r1i7n3
    SHELL=/bin/csh
    PROFILEREAD=true
    HISTSIZE=1000
    savehist=1000
    PBS_JOBNAME=xarray.job
    TMPDIR=/dev/shm/pbs.138488.datarmor0
    LIBRARY_PATH=/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/mkl/lib/intel64:/appli/mpt/2.15-p11386/lib
    FPATH=/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/mkl/include:/appli/NETCDF/4.3.3.1-mpt-intel/include:/appli/mpt/2.15-p11386/include
    MORE=-sl
    PBS_ENVIRONMENT=PBS_BATCH
    MPI_LAUNCH=mpiexec_mpt
    MIC_LD_LIBRARY_PATH=/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/mkl/lib/mic:/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/compiler/lib/mic:/opt/intel/mic/myo/lib:/opt/intel/mic/coi/device-linux-release/lib
    PBS_O_WORKDIR=/home1/datahome/aponte/xarray/run
    NCPUS=28
    GROUP=lpo
    PBS_TASKNUM=1
    USER=aponte
    LD_LIBRARY_PATH=/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/mkl/lib/intel64_lin:/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/mkl/lib/intel64:/appli/NETCDF/4.3.3.1-mpt-intel/lib:/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/compiler/lib/intel64:/opt/intel/mic/coi/host-linux-release/lib:/opt/intel/mic/myo/lib:/appli/mpt/2.15-p11386/lib
    LS_COLORS=no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.xz=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:
    CSHRCREAD=true
    PBS_O_HOME=/home1/datahome/aponte
    WORKDIR=/work/aponte/
    XNLSPATH=/usr/X11R6/lib/X11/nls
    CPATH=/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/mkl/include:/appli/NETCDF/4.3.3.1-mpt-intel/include:/appli/mpt/2.15-p11386/include
    OSCAR_HOME=/opt/oscar
    HOSTTYPE=x86_64
    DATAWORK=/home1/datawork/aponte
    FROM_HEADER=
    PBS_MOMPORT=15003
    PAGER=less
    CSHEDIT=emacs
    MPI_LIBS=-L/appli/mpt/2.15-p11386/lib -lmpi
    XDG_CONFIG_DIRS=/etc/xdg
    PBS_O_QUEUE=mpi
    NLSPATH=/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/mkl/lib/intel64:/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/compiler/lib/intel64:/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/debugger_2016/gdb/intel64
    MINICOM=-c on
    NETCDF_MODULE=4.3.3.1-mpt-intel2016
    MODULE_VERSION=3.2.10
    MAIL=/var/spool/mail/aponte
    PBS_O_LOGNAME=aponte
    PATH=/home1/datahome/aponte/.miniconda2/envs/daskdist/bin:/home1/datahome/aponte/.miniconda2/envs/petsc/bin:/usr/pbs/bin/:/home1/datahome/aponte/.miniconda2/bin:/opt/sgi/sbin:/opt/sgi/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/c3/bin:/opt/pbs/default/bin:/opt/pbs/default/sbin:/usr/lpp/mmfs/bin:/sbin:/bin
    CONDA_PATH_BACKUP=/usr/pbs/bin/:/home1/datahome/aponte/.miniconda2/bin:/opt/sgi/sbin:/opt/sgi/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/c3/bin:/opt/pbs/default/bin:/opt/pbs/default/sbin:/usr/lpp/mmfs/bin:/sbin:/bin
    CPU=x86_64
    PBS_O_LANG=en_US.UTF-8
    PBS_JOBCOOKIE=0000000052AAD434000000002938C2FF
    CONDA_PREFIX=/home1/datahome/aponte/.miniconda2/envs/petsc
    C_INCLUDE_PATH=/appli/mpt/2.15-p11386/include
    INPUTRC=/etc/inputrc
    PWD=/home1/datahome/aponte
    _LMFILES_=/appli/modulefiles/mpt/2.15:/appli/modulefiles/intel-fc-16/16.0.4.258:/appli/modulefiles/NETCDF/4.3.3.1-mpt-intel2016:/appli/modulefiles/intel-cmkl-16/16.0.4.258
    PBS_EXEC=/opt/pbs/default
    LANG=en_US.UTF-8
    PBS_NODENUM=0
    HYB_LAUNCH=mpiexec_mpt omplace
    PYTHONSTARTUP=/etc/pythonstart
    MODULEPATH=/usr/share/modules/modulefiles:/appli/modulefiles
    LOADEDMODULES=mpt/2.15:intel-fc-16/16.0.4.258:NETCDF/4.3.3.1-mpt-intel2016:intel-cmkl-16/16.0.4.258
    TZ=GMT
    PBS_JOBDIR=/home1/datahome/aponte
    MPI_FLAVOR=MPT
    PS1=(petsc)
    history=1000
    C3_RSH=ssh -oConnectTimeout=10 -oForwardX11=no
    PBS_O_SHELL=/bin/csh
    MPI_VERSION=2.15-p11386
    PBS_JOBID=138488.datarmor0
    ENVIRONMENT=BATCH
    GPG_TTY=not a tty
    SHLVL=2
    HOME=/home1/datahome/aponte
    NETCDF_DIR=/appli/NETCDF/4.3.3.1-mpt-intel/
    LANGUAGE=en_US.UTF-8
    LESS_ADVANCED_PREPROCESSOR=no
    OSTYPE=linux
    LS_OPTIONS=-N --color=tty -T 0
    PBS_O_HOST=datarmor3.ib0.ice.ifremer.fr
    CONDA_PS1_BACKUP=
    WINDOWMANAGER=
    VENDOR=unknown
    MPI_ROOT=/appli/mpt/2.15-p11386
    G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252
    LESS=-M -I -R
    MACHTYPE=x86_64-suse-linux
    LOGNAME=aponte
    XDG_DATA_DIRS=/usr/local/share:/usr/share:/opt/oscar/share:/opt/pbs/share
    PBS_QUEUE=mpi_2
    MODULESHOME=/usr/share/Modules/3.2.10
    CONDA_DEFAULT_ENV=petsc
    LESSOPEN=lessopen.sh %s
    OMP_NUM_THREADS=28
    PBS_O_MAIL=/var/mail/aponte
    MPI_TYPE_DEPTH=100
    LESSCLOSE=lessclose.sh %s %s
    PBS_O_SYSTEM=Linux
    G_BROKEN_FILENAMES=1
    SCRATCH=/home1/scratch/aponte
    PBS_NODEFILE=/var/spool/PBS/aux/138488.datarmor0
    COLORTERM=1
    PBS_O_PATH=/appli/NETCDF/4.3.3.1-mpt-intel/bin:/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/compilers_and_libraries_2016.4.258/linux/bin/intel64:/appli/intel/parallel_studio/parallel_studio_xe_2016_update4/debugger_2016/gdb/intel64:/appli/mpt/2.15-p11386/bin:/opt/sgi/sbin:/opt/sgi/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/games:/opt/c3/bin:/appli/pbs/default/bin:/appli/pbs/default/sbin:/usr/lpp/mmfs/bin:/sbin:/bin:/appli/services/bin:.:/home1/datahome/aponte/bin
    BASH_FUNC_module()=() {  eval `/usr/share/Modules/$MODULE_VERSION/bin/modulecmd bash $*`
    }
    _=/usr/bin/env
    PBS_NODEFILE start (
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n3.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    r1i7n5.ib0.ice.ifremer.fr
    ) PBS_NODEFILE ends
    PBS_ARRAYID
    
    PBS_NUM_PPN
    
    TMPDIR
    /dev/shm/pbs.138488.datarmor0
    PBD_JOBID
    
    /home1/datahome/aponte/.miniconda2/envs/daskdist/lib/python2.7/site-packages/distributed/utils.py:114: RuntimeWarning: Couldn't detect a suitable IP address for reaching '8.8.8.8', defaulting to '127.0.0.1': [Errno 101] Network is unreachable
      % (host, default, e), RuntimeWarning)
    Traceback (most recent call last):
      File "/home1/datahome/aponte/.miniconda2/envs/daskdist/bin/dask-worker", line 6, in <module>
        sys.exit(distributed.cli.dask_worker.go())
      File "/home1/datahome/aponte/.miniconda2/envs/daskdist/lib/python2.7/site-packages/distributed/cli/dask_worker.py", line 231, in go
        main()
      File "/home1/datahome/aponte/.miniconda2/envs/daskdist/lib/python2.7/site-packages/click/core.py", line 722, in __call__
        return self.main(*args, **kwargs)
      File "/home1/datahome/aponte/.miniconda2/envs/daskdist/lib/python2.7/site-packages/click/core.py", line 697, in main
        rv = self.invoke(ctx)
      File "/home1/datahome/aponte/.miniconda2/envs/daskdist/lib/python2.7/site-packages/click/core.py", line 895, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home1/datahome/aponte/.miniconda2/envs/daskdist/lib/python2.7/site-packages/click/core.py", line 535, in invoke
        return callback(*args, **kwargs)
      File "/home1/datahome/aponte/.miniconda2/envs/daskdist/lib/python2.7/site-packages/distributed/cli/dask_worker.py", line 167, in main
        raise ValueError("Need to provide scheduler address like\n"
    ValueError: Need to provide scheduler address like
    dask-worker SCHEDULER_ADDRESS:8786
    /var/spool/PBS/mom_priv/jobs/138488.datarmor0.SC: line 45: --scheduler-file: command not found
    /var/spool/PBS/mom_priv/jobs/138488.datarmor0.SC: line 46: --nthreads: command not found
    

    If you have any suggestions I'll give it a try, thanks

  6. mrocklin commented on Jul 17, 2017

    @mrocklin
    MemberAuthor

    it looks like it's treating each of the individual lines in the dask-worker command as a separate commend. Looking at my text from above it looks like I forgot a trailing slash after dask-worker (which I have now added in an edit. You might want to try adding that that slash after dask-worker.

  7. apatlpo commented on Jul 17, 2017

    @apatlpo
    Contributor

    The code is not crashing after few minutes with the trailing slash but there is not output.
    How can I tell if everything went well?

    Note also that in the preceding error code, the variables PBS_ARRAYID, PBS_NUM_PPN were empty.
    Shouldn't this be a problem?

  8. martindurant commented on Jul 17, 2017

    @martindurant
    Member

    Can you also try printing $PBS_ARRAY_INDEX ?
    You should probably have some .out and .err files with logging information. Similar > output should be added to the scheduler command too. If things are working correctly, there should be no output as such, but you should be able to connect to the scheduler from a python shell with

    import os
    from dask.distributed import Client
    Client(scheduler_file=os.path.join(os.path.expanduser('~'), 'scheduler.json'))

    (note that you echo $PBD_JOBID instead of $PBS_JOBID)

  9. guillaumeeb commented on Jul 17, 2017

    @guillaumeeb
    Member

    Hi everybody, and thank you Matthew for this script. I was just planning to make such a tool script for our HPC cluster at CNES. I will start from yours and try to make it work on our supercomputer. I hope I will be able to look at it this week.

    But here is a few things I can tell you after a first look:

    • options (e.g ppn, ncpus) may differ accross PBS versions, PBS Pro last version is number 13. For this version the correct option is ncpus.
    • It seems you are trying to use the job array functionnality provided by PBS. There is one big flaw for it in our case: it is kind of a job of jobs, where each child job can be run independently! So PBS may launch each child job one at a time if resources are available one by one (e.g. if only four cores are availables in the cluster with your example, the first job of the array will start alone).

    Looking at @apatlpo solution, here is what I can say:

    • You are not using the job array functionality, only a simple PBS job, which is why you don't see the expected env variables, and will never start a scheduler. But this may be the good final solution.
    • mpiproc directive in PBS options seems useless.
    • Instead of $PBS_NUM_PPN, you should use the NCPUS env variable,
    • You are printing PBD_JOB_ID instead of PBS_JOB_ID.
    • You are selecting 2 resources of 28 cores each, so this means you plan to launch only two process that will each use 28 cores, I will start with more processes and less cores for Dask Distributed.
    • In the end, as you are not using a job array, your shell script is only launched once on the PBS Mother node.

    Okay so on a second thought, the idea of using job arrays seemed promising, but I believe the flaw I underline makes it not usable. In order to be able to launch several process, so several workers, in only one PBS job, we will need to use something like pbsdsh command, which allows to launch a given command on every resource asked to PBS. I have done this for launching Spark clusters using PBS, and this is probably well suited also for Dask. I will try to improve your proposal with this solution, and share the result here.

  10. martindurant commented on Jul 17, 2017

    @martindurant
    Member

    @guillaumeeb : I thought for an array, you can specify "I need X tasks, of which Y must run concurrently", although I don't know the syntax for this.

  11. guillaumeeb commented on Jul 17, 2017

    @guillaumeeb
    Member

    @martindurant: You may be right, I will check that tomorrow and tell you, This would be a really nice and clean solution.

  12. guillaumeeb commented on Jul 17, 2017

    @guillaumeeb
    Member

    Another thought, what about the DRMAA proposed contributions on the Setup Network page, like https://github.com/dask/dask-drmaa? It seems a very elegant solution to be able to spawn a Dask cluster on PBS directly from a Python API. As anybody played with this?

  13. mrocklin commented on Jul 17, 2017

    @mrocklin
    MemberAuthor

    In my experience users ask far more often for PBS scripts than for help with DRMAA. I'm inclined to meet them with what they already know and use.

    That being said, adding DRMAA to the documentation seems like a fine idea to me.

  14. guillaumeeb commented on Jul 17, 2017

    @guillaumeeb
    Member

    I am also far more used to PBS scripts :). I don't even know if DRMAA tools can work with our PBS Scheduler version. Another thing I need to check. Starting with the script sounds much more simple to me, and still a very good and usable option.

  15. apatlpo commented on Jul 18, 2017

    @apatlpo
    Contributor

    As anticipated by Guillaume, the script does seem to work, here is the relevant part of the output log:

    PBS_NODEFILE start (
    r1i5n3.ib0.ice.ifremer.fr
    r1i5n4.ib0.ice.ifremer.fr
    r1i5n5.ib0.ice.ifremer.fr
    r1i5n6.ib0.ice.ifremer.fr
    r1i5n7.ib0.ice.ifremer.fr
    r1i5n8.ib0.ice.ifremer.fr
    r1i5n9.ib0.ice.ifremer.fr
    r1i5n10.ib0.ice.ifremer.fr
    r1i5n11.ib0.ice.ifremer.fr
    r1i5n12.ib0.ice.ifremer.fr
    r1i5n13.ib0.ice.ifremer.fr
    r1i5n14.ib0.ice.ifremer.fr
    r1i5n15.ib0.ice.ifremer.fr
    r1i5n16.ib0.ice.ifremer.fr
    ) PBS_NODEFILE ends
    PBS_ARRAYID
    
    PBS_NUM_PPN
    
    TMPDIR
    /dev/shm/pbs.138688.datarmor0
    PBS_JOBID
    138688.datarmor0
    PBS_ARRAY_INDEX
    
    NCUPS
    2
    /home1/datahome/aponte/.miniconda2/envs/daskdist/lib/python2.7/site-packages/distributed/utils.py:114: RuntimeWarning: Couldn't detect a suitable IP address for reaching '8.8.8.8', defaulting to '127.0.0.1': [Errno 101] Network is unreachable
      % (host, default, e), RuntimeWarning)
    =>> PBS: job killed: walltime 3639 exceeded limit 3600
    Terminated
    

    Note that I have modified the number script and am now using upon Guillaume suggestion:
    #PBS -l select=14:ncpus=2:mem=120G

    Let me know if you want me to try something else.

  16. 98 remaining items

  17. lzamparo commented on Sep 26, 2017

    @lzamparo

    distributed.nanny - INFO - Start Nanny at: 'tcp://10.230.2.208:45940'
    distributed.worker - INFO - Start worker at: tcp://10.230.2.208:37416
    distributed.worker - INFO - Listening to: tcp://10.230.2.208:37416
    distributed.worker - INFO - http at: 10.230.2.208:43611
    distributed.worker - INFO - nanny at: 10.230.2.208:45940
    distributed.worker - INFO - Waiting to connect to: tcp://10.230.2.65:8786
    distributed.worker - INFO - -------------------------------------------------
    distributed.worker - INFO - Threads: 72
    distributed.worker - INFO - Memory: 324.44 GB
    distributed.worker - INFO - Local Directory: worker-yt_936mo
    distributed.worker - INFO - -------------------------------------------------
    distributed.worker - INFO - Registered to: tcp://10.230.2.65:8786
    distributed.worker - INFO - -------------------------------------------------
    distributed.worker - INFO - Connection to scheduler broken. Reregistering
    distributed.worker - INFO - Trying to connect to scheduler: tcp://10.230.2.65:8786
    distributed.worker - INFO - Close compute stream
    distributed.dask_worker - INFO - Exiting on signal 2
    Traceback (most recent call last):
    File "", line 1, in
    File "/home/zamparol/anaconda3/lib/python3.5/multiprocessing/forkserver.py", line 164, in main
    rfds = [key.fileobj for (key, events) in selector.select()]
    File "/home/zamparol/anaconda3/lib/python3.5/selectors.py", line 441, in select
    fd_event_list = self._epoll.poll(timeout, max_ev)
    KeyboardInterrupt
    distributed.dask_worker - INFO - End worker
    distributed.nanny - INFO - Closing Nanny at 'tcp://10.230.2.208:45940'

    This example worker log suggests two problems:

    1. dask is seeing all resources on the node, rather than merely what was assigned to the job (looks like I should have specified resource caps on the dask-worker command line)
    2. The worker lost connection to the scheduler, and seemingly didn't manage to reconnect. The scheduler didn't report that the connections were dropped either, so I don't know what to check further.
  18. mrocklin commented on Sep 27, 2017

    @mrocklin
    MemberAuthor

    Yes, see --nthreads and --memory-limit in particular.

    It did connect though, which shows that they found each other. Is your client on a machine that is able to see the scheduler? Perhaps everything connected except for that?

  19. lzamparo commented on Sep 27, 2017

    @lzamparo

    @mrocklin yes, all of the client machine, scheduler, and worker nodes are on the same network, so visibility should not be an issue.

  20. lzamparo commented on Sep 27, 2017

    @lzamparo

    Also, I looked at the docs for dask-worker but didn't see any way to specify the number of CPU cores, is it in fact via --nthreads?

  21. guillaumeeb commented on Oct 30, 2017

    @guillaumeeb
    Member

    Hi everybody,

    Found time to work again on this script this morning. Thanks to some examples found in https://github.com/opendatacube github project and the work of a coworker ont it. I used a conda environment like what is done by @mrocklin in pangeo-data/pangeo#2. Here is what I've got:

    
    #!/bin/bash
    #PBS -N sample_dask_pbs
    #PBS -l select=9:ncpus=4:mem=20G
    #PBS -l walltime=01:00:00
    
    # Qsub template for CNES HAL
    # Scheduler: PBS
    
    # This writes a scheduler.json file into your home directory
    # You can then connect with the following Python code
    # >>> from dask.distributed import Client
    # >>> client = Client(scheduler_file='~/scheduler.json')
    
    #Environment sourcing
    ENV_SOURCE="source ~/.bashrc; export PATH=/home/eh/eynardbg/miniconda3/bin:$PATH; source activate pangeo"
    rm -f $PBS_O_WORKDIR/scheduler.json
    
    #Options
    export OMP_NUM_THREADS=1
    NCPUS=4 #Bug in NCPUS variable in our PBS install
    MEMORY_LIMIT="18e9"
    #INTERFACE="--interface ib0 "
    INTERFACE=""
    
    # Run Dask Scheduler
    echo "*** Launching Dask Scheduler ***"
    pbsdsh -n 0 -- /bin/bash -c "$ENV_SOURCE; dask-scheduler $INTERFACE --scheduler-file $PBS_O_WORKDIR/scheduler.json  > $PBS_O_WORKDIR/$PBS_JOBID-scheduler-$PBS_TASKNUM.out 2> $PBS_O_WORKDIR/$PBS_JOBID-scheduler-$PBS_TASKNUM.err;"&
    
    #Number of chunks
    nbNodes=`cat $PBS_NODEFILE | wc -l`
    
    echo "*** Starting Workers on Other $nbNodes Nodes ***"
    for ((i=1; i<$nbNodes; i+=1)); do
        pbsdsh -n ${i} -- /bin/bash -c "$ENV_SOURCE; dask-worker $INTERFACE --scheduler-file $PBS_O_WORKDIR/scheduler.json --nthreads $NCPUS --memory-limit 16e9 --local-directory $TMPDIR --name worker-${i} > $PBS_O_WORKDIR/$PBS_JOBID-worker-${i}.out 2> $PBS_O_WORKDIR/$PBS_JOBID-worker-${i}.err;"&
    done
    
    echo "*** Dask cluster is starting ***"
    sleep 3600
    

    This seems to work from the client perspective:

    In [6]: client
    Out[6]: <Client: scheduler='tcp://10.120.40.169:8786' processes=8 cores=32>
    

    I tried to use different network interfaces because I have problem when loading Dask web UI: this takes a lot of time and most of the time it never works. Don't know why yet, if somebody has a hint...

  22. guillaumeeb commented on Jan 7, 2018

    @guillaumeeb
    Member

    Hi everyone,

    A quick word to share with you work that has been done on Dask (and also Spark) on PBS at @CNES. PBS scripts to launch Dask are available in this repo: https://github.com/guillaumeeb/big-data-frameworks-on-pbs.

    Cheers.

  23. rabernat commented on Jan 8, 2018

    @rabernat

    @guillaumeeb, fantastic! Thanks for sharing your progress.

    Would you and the CNES folks be interested in collaborating on a project benchmarking the performance of dask vs spark on common analysis workflows?

  24. gmaze commented on Jan 8, 2018

    @gmaze

    Hi @rabernat @guillaumeeb, at Ifremer we would be interested in looking at such benchmarking !
    Note that I also raised a question with regard to machine learning methods on xarray/dask vs pyspark/MLlib here , some of our classic analysis could be part of the benchmark

  25. mrocklin commented on Jan 8, 2018

    @mrocklin
    MemberAuthor

    +1 on Dask/Spark benchmarking. This is a frequently asked question.

  26. guillaumeeb commented on Jan 20, 2018

    @guillaumeeb
    Member

    @rabernat (and @gmaze @mrocklin), don't know if you got my email? We would be glad at CNES to collaborate on such a project. We should just define together how we could contribute, on which use cases, and on which place to discuss about it (e.g. Pangeo? Another Dask or Distributed issue?)

    Any idea yet?

  27. rabernat commented on Jan 21, 2018

    @rabernat
  28. alvarouc commented on Mar 2, 2018

    @alvarouc
    Contributor

    @lzamparo Did you figure out your issue? I was experiencing the sample problem. I noticed that at the client I should put the scheduler address directly instead of the scheduler file and it worked.
    That is
    c = Client('111.99.99.9:8786')
    instead of
    c = Client(scheduler_file='/path/to/scheduler.json')

  29. lzamparo commented on Mar 5, 2018

    @lzamparo

    @alvarouc Thanks for following up. I never did fix this for a bunch of reasons. Good to hear you found a workaround. I presume you still interrogate the /path/to/scheduler.json file to get the IP, and manually craft the string for the Client constructor?

  30. mrocklin commented on Jun 21, 2018

    @mrocklin
    MemberAuthor

    This has been resolved by the dask-jobqueue project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions