Note:
The video version of this segment of the tutorial is here.
Review your progress from Step 4
Navigate to the guide directory on /share. It should contain a PDF file called weather.pdf, a R script weather.R, a submit script submit.sh, and some output/error files generated by LSF. A second browser tab should be open to the R documentation. If not,
open a new tab to the HPC home page, then navigate to the R documentation.
Debugging on Hazel
When developing code or batch scripts, it is often useful to interact with a program at the command line while directly on a node. It is inconvenient to make a small change to a code or script and wait in the LSF queue for hours, only to find a minor typo that crashes your job within seconds. Running applications on a login node - even for only a couple seconds to test a script - is prohibited; for this type of problem, you can reserve a short debugging session on a compute node in
interactive mode.
Exercise 5.1: Run R interactively from a compute node
All of the required instructions are in the documentation on using R.
You should already have a terminal window open, and you should be logged in on Hazel. Confirm that your current working directory is the guide directory on /share.
Open an additional window (in Terminal or MobaXterm) on your local desktop. Display the contents of the file weather.R so that you may see the contents while you are working in the original window on Hazel.
Request an interactive session on a compute node on Hazel. Request 1 core and 10 minutes time.
Hint: The command given in the R documentation to request an interactive compute node can be used exactly as is, but because the example is not memory intensive, you may omit the -x.
Type hostname
to confirm that you are no longer on a login node.
Optional 5.1.1: What is the name of your node? Recall this for Optional exercise 5.1.2.
We will run the same code as we ran through the batch scheduler. Rename the PDF output file as weather_batch.pdf
Start the command line R application, and - using your mouse and/or key commands - copy and paste the contents of the sample R script weather.R into the terminal at the R prompt.
Note that you are still in an interactive R session. If there were errors, you could fix them and generate the output without having to start over. To test this, change the name of the output file while still at the R command line by typing file.rename("weather.pdf","weather2.pdf")
. This command renames the file it just created, and it returns TRUE if successful.
Exit R by typing quit()
. Do not save the workspace (type [n]
).
The R code should have produced a PDF file called weather2.pdf containing temperature output. Display the contents of your directory to confirm that the file weather2.pdf has been created, and type file weather2.pdf
to confirm that it is a valid PDF file.
Exit the interactive session on the compute node.
Optional 5.1.2: Type lshosts | grep [name of your node]
. How many cores are on that node? See this example from the LSF FAQ
Go to Step 6