[email protected] writes:

> There's also the very useful Python hostlist package for translating
> from this format and back to it.

The URL for the mentioned hostlist package is:

    http://www.nsc.liu.se/~kent/python-hostlist/

>> $ scontrol show hostlist tux1,tux3,tux4
>> tux[1,3-4]
>> $ scontrol show hostnames tux[1,3-4]
>> tux1
>> tux3
>> tux4

A few examples:

        # hostlist tux1 tux2,tux3
        tux[1-3]
        # echo -e "tux1\ntux2"|hostlist -n -
        2
        # hostlist -e "tux[1-2]"
        tux1
        tux2
        # hostlist -d "tux[1-10]" "tux[5-7]"
        tux[1-4,8-10]

Another useful example, say some application require hosts specified in
the format host1:ncpus,host2:ncpus: then I can just use the following
in the batch script:

        hostlist --append=":$(SLURM_TASKS_PER_NODE)" --separator="," -e 
"$(SLURM_JOB_NODELIST)"

        # hostlist --append=":8" --separator="," -e "tux[1-3]"
        tux1:8,tux2:8,tux3:8


Another option is the "nodeset" command from ClusterShell. I think it
can do about the same things as our hostlist util, but I have not had
time to look into it:

    http://sourceforge.net/apps/trac/clustershell

Regards,
Pär Andersson
NSC

Reply via email to