Search code examples
memoryresourcescshlsf

Bad resource requirement syntax Error


I am trying to use the memory resource allocation command available in LSF. A normal format of the command is :

bsub -R "rusage [mem=1000]" sleep 100s

When I launch this command directly from terminal,it works. When i lsunch this command from a script, it fails.

Here is my script:

#! /bin/csh -f

set cktsim_memory = $1
set tmp = "|rusage [mem = $cktsim_memory]|" #method2
set tmp = `echo $tmp | sed 's/ =/=/g'` #method2
set tmp = `echo $tmp | sed 's/|/"/g' `
set bsub_option = ""
set bsub_option = ( "$bsub_option" "-R" "$tmp") #method2
set cmd = "bsub $bsub_option sleep 100s"
echo $cmd
$cmd

Its run output is:

>./cktsim_memory_test 100
bsub -R "rusage [mem= 100]" sleep 100s
Bad resource requirement syntax. Job not submitted.
>bsub -R "rusage [mem= 100]" sleep 100s
Job <99775> is submitted to default queue <medium>.

As you can see in the terminal output above- when the bsub command launched from script, it fails, when the same command run from terminal it is ok...

Please help me debug the issue.


Solution

  •     set cktsim_memory = $1
    set temp = "'rusage [mem = $cktsim_memory]'" #method2
    set temp = `echo $temp | sed 's/ =/=/g'` #method2
    set bsub_option = ( "$bsub_option" "-R" "$temp")