The following example uses helloworld.r.
# My first program in R Programming
myString <- "Hello, World!"
print ( myString)
For example, the following job requests that the queue "interactive" runs the job using
interactive mode and specifies R_workload as the resource where R is installed.
[user@host R]$ bsub -R R_workload -q interactive -I /usr/local/bin/Rscript /home/user/R/helloworld.r >>/home/user/R/output.txt
<<Waiting for dispatch ...>>
<<Starting on hostA>>
[user@host R]$ bjobs
JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME SUBMIT_TIME
185 user PEND interactiv user *loworld.r Apr 3 04:56
[user@host R]$ bjobs
No unfinished job found
[user@host R]$ cat output.txt
Job <185> is submitted to queue <interactive>.
[1] "Hello, World!"
[user@host R]$
When the job is running, get the running status of the R application from the output file:
/home/user/R/output.txt
Use the bsub -R R_workload -Is command to submit the R to LSF as an
interactive job. The command will start and launch the job in R interactive mode.
[user@host R]$ bsub -R R_workload -q interactive -Is /usr/local/bin/R
Job <192> is submitted to queue <interactive>.
<<Waiting for dispatch ...>>
<<Starting on hostA>>
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
[Previously saved workspace restored]
> myString <- "Hello, World!"
> print ( myString)
[1] "Hello, World!"
> q()
Save workspace image? [y/n/c]: n
[user@host R]$
Use the application profile to submit the R jobs. The commands are similar as above, but use the
-app option instead of -R:
bsub -app R_Application -q interactive -I /usr/local/bin/Rscript /home/user/R/helloworld.r >>/home/user/R/output.txt
or
bsub -app R_Application -q interactive -Is /usr/local/bin/R
If you forget your application profile name, view it using the bapp
command:
[user@host R]$$ bapp
APP_NAME NJOBS PEND RUN SUSP
R_Application 0 0 0 0
[user@host R]$ R]$