Skip to content

Memory specification on SGECluster #219

Closed

Description

@ericmjl

On an SGE cluster, requested memory is specified by using the -l flag. The exact keyword that gets used to assign memory can change from configuration to configuration; as such, it would be difficult to assume a standard string name. For example, some clusters use m_mem_free=2G, some use mem_free=2G, and others may have a different configuration.

With the SGECluster object, however, it appears that the amount of memory specified has to be passed into the memory= kwarg alongside the resource_spec string, which means that it is possible for a user to have discordant memory requested.

cluster = SGECluster(queue='our.q',
                     walltime="259200",
                     processes=1,
                     cores=1,
                     # this appears to be for Dask usage only
                     memory='4GB',
                     # this is what actually gets used by the SGE schedule
                     resource_spec='m_mem_free=2G',  
                    )

This gives the following job script:

#!/bin/bash

#!/usr/bin/env bash
#$ -N dask-worker
#$ -q default.q
#$ -l m_mem_free=2G
#$ -l h_rt=259200
#$ -cwd
#$ -j y

. /home/maer3/github/research/cadd-ns-nav1.1/custom_env.sh

/home/maer3/anaconda/envs/nav/bin/python -m distributed.cli.dask_worker tcp://10.145.61.204:40499 --nthreads 1 --memory-limit 4.00GB --name dask-worker--${JOB_ID}-- --death-timeout 60

As far as I can see, I have requested for 2 GB of RAM from the scheduler (per worker), while the --memory-limit 4.00GB is reflected from the memory kwarg.

Am I understanding correctly that a dask worker will think that it has 4GB of RAM, even though in reality it only was assigned 2GB here? Does this also mean, then, that if the worker is filled at 2GB of usage, the dashboard will only show 50% utilization (which would be incorrect)?

The other UI/UX issue here is that of the API - there is duplication here in specifying the memory & resource_spec kwargs separately. The best idea I have at the moment is to improve the documentation as it currently stands, such that it reflects this necessity. Might there be a better way to reduce this duplication?

Activity

  1. lesteve commented on Jan 15, 2019

    @lesteve
    Member

    Am I understanding correctly that a dask worker will think that it has 4GB of RAM, even though in reality it only was assigned 2GB here? Does this also mean, then, that if the worker is filled at 2GB of usage, the dashboard will only show 50% utilization (which would be incorrect)?

    • dask workers use memory: they will think they have 4GB of RAM. This is relevant for dask memory management.
    • resource_spec is used only by the scheduler. The impact depends on your scheduler configuration. mem_req is required on my cluster and I think it is purely declarative: it is only used to find a node where there is supposed to be enough RAM available according to what all the running jobs have their mem_req set to. mem_req will not be used as a hard memory limit to kill your job if its memory usage goes over mem_req.

    The other UI/UX issue here is that of the API - there is duplication here in specifying the memory & resource_spec kwargs separately. The best idea I have at the moment is to improve the documentation as it currently stands, such that it reflects this necessity. Might there be a better way to reduce this duplication?

    Agreed about the duplication but I don't see a straightforward way to fix it because of the variety of configurations that GE and derivatives seems to have (not an expert at all I am just discovering this as we go ...).

    Doc improvements would be very welcome! One caveat is that this is a bit SGECluster-specific: my understanding is that memory will be passed to the scheduler by other dask-jobqueue *Cluster (I checked and that's the case for SLURMCluster and PBSCluster).

    I would suggest either:

    • you find a good place to add this SGECluster caveat in .rst docs
    • you tweak the SGECluster docstring to explain that memory is only used for dask memory management. We are using docrep to reuse docstrings from JobQueueCluster in derived classes. There may be a way to tweak part of the SGECluster docstring with docrep, not sure.
  2. ericmjl commented on Jan 15, 2019

    @ericmjl
    ContributorAuthor

    @lesteve thanks for your response!

    you find a good place to add this SGECluster caveat in .rst docs

    I believe this is the lightest-weight way to inform users of this issue. I will close my other PR - it's irrelevant for this - and submit a new one.

    Most users, including myself, will probably copy/paste and tweak the example on the Example Deployments page, so that will definitely have to be changed; additionally, a line in the docstring is probably the other place I will make a PR.

  3. guillaumeeb commented on Jan 16, 2019

    @guillaumeeb
    Member

    You should also document the way to specify the requested CPU. SGECluster currently relies entirely on resource_spec kwarg for resource limitation/provisionning. But maybe you plan to propose or discuss about this in another issue?

    Things would probably be easier if we implemented #133, users would then be able to customize launch script header to fit their cluster.

  4. lesteve commented on Jan 16, 2019

    @lesteve
    Member

    You should also document the way to specify the requested CPU.

    Good point, maybe in a different issue. AFAIK this is even a greyer area. My understanding on our SGE cluster is that if you want to use multiple cores you are encouraged to do something like qsub -pe serial <nb_cores> (AFAIK this is purely declarative nothing prevents you from not using this option and still use multiple cores).

    Note this is something separate than resource_spec (resources_spec use -l) so you have to use job_extra in SGECluster ... also serial is the name of what SGE calls "parallel environment" that could well vary between different SGE clusters.

    I would be very happy to hear about @ericmjl's experience with CPU booking on his SGE-like (UnivaGE IIRC) cluster ...

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