Ex 7.) Submitting an interactive job

You are here:
Estimated reading time: 1 min

Introduction

In this exercise we will run some simple “R” commands interactively on a compute node. Please read the related article HERE on how to run interactive jobs on SCIAMA-4.

Exercise

First we need to allocate resources (here 1 task/core by default) on a compute node and run a shell on it:

sinteractive -q training.q

The terminal should respond similar to :-
Waiting for JOBID 1689183 to start
...............

Your terminal is blocked until the resources become available. Use the squeue command in another terminal/ssh login and identify your interactive job and verify the partition it is queued for.

Once the requested resources are available, a new shell opens on one of the requested node. Make sure to use srun to run any process, especially those using multiprocessing like MPI.

Ensure you have the “R” module selected in this shell:-

module list

If not select the R package :

module load R/3.6.3

In the terminal run the R program. Execute the following commands (a file with these command can be found in the training/scripts directory) :-

Square <- function(x)
{ return(x^2) }
print(Square(4))
print(Square(x=4)) # same thing
quit()

You should see output similar to :-

R version 3.4.1 (2017-06-30) — “Single Candle”
Copyright (C) 2017 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.

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]

Square <- function(x)
+ { return(x^2) }
> print(Square(4))
[1] 16
> print(Square(x=4)) # same thing
[1] 16
> quit()
Save workspace image? [y/n/c]: n

 

Exit from the interactive shell by typing exit or EOF/EOT interrupt via CTRL-D.

Was this article helpful?
Dislike 0
Views: 206