The selection string specifies the characteristics a host must have to match the resource requirement. It is a logical expression built from a set of resource names. The selection string is evaluated for each host; if the result is non-zero, then that host is selected. When used in conjunction with a cu string, hosts not belonging to compute unit are not considered.
The selection string can combine resource names with logical and arithmetic operators. Non-zero arithmetic values are treated as logical TRUE, and zero (0) as logical FALSE. Boolean resources (for example, server to denote LSF server hosts) have a value of one (1) if they are defined for a host, and zero (0) if they are not defined for the host.
The resource names swap, idle, login, and cpu are accepted as aliases for swp, it, ls, and r1m respectively.
The ut index measures CPU utilization, which is the percentage of time spent running system and user code. A host with no processes running has a ut value of 0 percent; a host on which the CPU is completely loaded has a ut of 100 percent. You must specify ut as a floating-point number between 0.0 and 1.0.
For the string resources type and model, the special value any selects any value and local selects the same value as that of the local host. For example, type==local selects hosts of the same type as the host submitting the job. If a job can run on any type of host, include type==any in the resource requirements.
If no type is specified, the default depends on the command. For bsub, lsplace, lsrun, and lsgrun the default is type==local unless a string or Boolean resource is specified, in which case it is type==any. For lshosts, lsload, lsmon and lslogin the default is type==any.
bsub accepts multiple -R options for the select section in simple resource requirements.
You can specify multiple resource requirement strings instead of using the && operator. For example:
bsub -R "select[swp > 15]" -R "select[hpux]"
LSF merges the multiple -R options into one string and dispatches the job if all of the resource requirements can be met. By allowing multiple resource requirement strings and automatically merging them into one string, LSF simplifies the use of multiple layers of wrapper scripts.
% bsub -R "select [swp > 15 && maxmem > 100] rusage[mem = 100] " myjob
You must use single quote characters (') around string-type shared resources. For example, use lsload -s to see the shared resources defined for the cluster:
lsload -sRESOURCE VALUE LOCATIONos_version 4.2 pc36os_version 4.0 pc34os_version 4.1 devlinux4cpu_type ia pc36cpu_type ia pc34cpu_type unknown devlinux4
Use a select string in lsload -R to specify the shared resources you want to view, enclosing the shared resource values in single quotes. For example:
These operators can be used in selection strings. The operators are listed in order of decreasing precedence.
A shared resource may be used in the resource requirement string of any LSF command. For example, when submitting an LSF job that requires a certain amount of shared scratch space, you might submit the job as follows:
The above assumes that all hosts in the cluster have access to the shared scratch space. The job is only scheduled if the value of the "avail_scratch" resource is more than 200 MB and goes to a host with at least 50 MB of available swap space.
It is possible for a system to be configured so that only some hosts within the LSF cluster have access to the scratch space. To exclude hosts that cannot access a shared resource, the defined(resource_name) function must be specified in the resource requirement string.
would exclude any hosts that cannot access the scratch resource. The LSF administrator configures which hosts do and do not have access to a particular shared resource.
An exclusive resource may be used in the resource requirement string of any placement or scheduling command, such as bsub, lsplace, lsrun, or lsgrun. An exclusive resource is a special resource that is assignable to a host. This host will not receive a job unless that job explicitly requests the host. For example, use the following command to submit a job requiring the exclusive resource bigmem:
Jobs will not be submitted to the host with the bigmem resource unless the command uses the -R option to explicitly specify "bigmem".
To configure an exclusive resource, first define a static Boolean resource in lsf.shared. For example:
Assign the resource to a host in the Host section of lsf.cluster.cluster_name. Prefix the resource name with an exclamation mark (!) to indicate that the resource is exclusive to the host. For example:
When LSF_STRICT_RESREQ=Y is configured in lsf.conf, resource requirement strings in select sections must conform to a more strict syntax. The strict resource requirement syntax only applies to the select section. It does not apply to the other resource requirement sections (order, rusage, same, span, or cu). When LSF_STRICT_RESREQ=Y in lsf.conf, LSF rejects resource requirement strings where an rusage section contains a non-consumable resource.
<expression> ::= <relation1> { <logical or> <relation1>}<relation1> ::=<relation2> { <logical and > <relation2>}<relation2> ::= <simple expression> [ <relation op> <simple expression> ]<simple expression> ::= <term> { <adding op> <term> }<term> ::= <factor> { <multiple op> <factor> }<factor> ::= [<unary op>] <primary><primary> ::= <numeric> | <string> | ( <expression> )| <name or function call><logical or> ::= ||<logical and>::=&&<relation op> ::= <= | >= | == | != | < | > | =<adding op> ::= + | -<unary op> ::= - | !<multiple op> ::= * | /<name or function call> ::= <name> [( <argument list> )]<argument list> ::= <empty> | <argument> {, <argument> }<argument> ::= <expression><name> ::= [a-zA-Z_][a-zA-Z_0-9]*<numeric> ::= <int> [. [0-9]*]<int> ::= [1-9][0-9]* | 0<string> ::= <single quote> {<string chars>} <single quote> | <double quote> {<string chars>} <double quote><string chars> ::= <printable ascii characters except single/double quote><single quote> ::= '<double quote> ::= "<empty>=
The strict syntax is case sensitive.
Operators '=' and '==' are equivalent.
= == != < > <= >=
defined( mg )
type==any rusage[mem=1024]select[type==any] rusage[mem=1024]select[type==any]rusage[mem=1024]
select[mem>0] select[maxmem>0]
Escape characters (like '\n') are not supported in string literals.
A colon (:) is not allowed inside the select string. For example, select[mg:bigmem] is not correct.
inf and nan can be used as resource names or part of a resource name.
Single or double quotes are only supported around the whole resource requirement string, not within the square brackets containing the selection string. For example, in lsb.queues, RES_REQ='swp>100' and RES_REQ="swp>100" are correct. Neither RES_REQ=select['swp>100'] nor RES_REQ=select["swp>100"] are supported.
An explicit select section starts from the section keyword and ends at the begin of next section, for example: the select section is select[selection_string]. An implicit select section starts from the first letter of the resource requirement string and ends at the end of the string if there are no other resource requirement sections. If the resource requirement has other sections, the implicit select section ends before the first letter of the first section following the selection string.
All explicit sections must begin with a section keywords (select, order, span rusage, or same). The resource requirement content is contained by square brackets ([) and (]).
An implicit select section must be the first resource requirement string in the whole resource requirement specification. Explicit select sections can appear after other sections. A resource requirement string can have only one select section (either an explicit select section or an implicit select section). A section with an incorrect keyword name is not a valid section.
bsub -R "(r15s * 2 + r15m) < 3.0 && !(type == IBMAIX4) || fs" myjob
If swap space is equal to 0, the following means TRUE; if swap space is not equal to 0, it means FALSE:
Select hosts of the same type as the host submitting the job:
Select hosts that are not the same type as the host submitting the job:
This example has different meaning from the previous example:
Use the BSUB_CHK_RESREQ environment variable to check the compatibility of your existing resource requirement select strings against the stricter syntax enabled by LSF_STRICT_RESREQ=Y in lsf.conf.
Set the BSUB_CHK_RESREQ environment variable to any value enable bsub to check the syntax of the resource requirement selection string without actually submitting the job for scheduling and dispatch. LSF_STRICT_RESREQ does not need to be set to check the resource requirement selection string syntax.
bsub only checks the select section of the resource requirement. Other sections in the resource requirement string are not checked.
bsub -R "select[type==local] select[hname=abc]" sleep 10Error near "select": duplicate section. Job not submitted.echo $?255
bsub -ar -n "1,100" -R "select[type == X86_64]" myjob
Every time the job grows in slots, slots are requested on hosts of the specified type.