Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel2

...

To submit a precompiled binary to run on TerremotoInsomnia, the script will look just as it does in the Hello World example. The difference is that you will call your executable file instead of the shell commands "echo", "sleep", and "date".

...

https://columbiauniversity.atlassian.net/wiki/display/rcs/Terremoto+-+Job+Examples#Terremoto-JobExamples-Singularity

Singularity 

Singularity is a software tool that brings Docker-like containers and reproducibility to scientific computing and HPC. Singularity has Docker container support and enables users to easily  run different flavors of Linux with different software stacks. These containers provide a single universal on-ramp from the laptop, to HPC, to cloud.

Users can run Singularity containers just as they run any other program on our HPC clusters. Example usage of Singularity is listed below. For additional details on how to use Singularity, please contact us or refer to the Singularity User Guide.

Downloading Pre-Built Containers

Singularity makes it easy to quickly deploy and use software stacks or new versions of software. Since Singularity has Docker support, users can simply pull existing Docker images from Docker Hub or download docker images directly from software repositories that increasingly support the Docker format. Singularity Container Library also provides a number of additional containers.

You can use the pull command to download pre-built images from an external resource into your current working directory. The docker:// uri reference can be used to pull Docker images. Pulled Docker images will be automatically converted to the Singularity container format. 

...

Here's an example of pulling the latest stable release of the Tensorflow Docker image and running it with Singularity. (Note: these pre-built versions may not be optimized for use with our CPUs.)

...

Singularity - Interactive Shell 

The shell command allows you to spawn a new shell within your container and interact with it as though it were a small virtual machine:

...

Code Block
Singularity tensorflow.simg:~> python
>>> import tensorflow as tf
>>> print(tf.__version__)
1.13.1
>>> exit()

When done, you may exit the Singularity interactive shell with the "exit" command.

Singularity tensorflow.simg:~> exit

Singularity: Executing Commands

The exec command allows you to execute a custom command within a container by specifying the image file. This is the way to invoke commands in your job submission script.

...

Singularity: Running a Batch Job

Below is an example of job submission script named submit.sh that runs Singularity. Note that you may need to specify the full path to the Singularity image you wish to run.

Code Block
#!/bin/bash
# Singularity example submit script for Slurm.
#
# Replace <ACCOUNT> with your account name before submitting.
#
#SBATCH -A <ACCOUNT>           # Set Account name
#SBATCH --job-name=tensorflow  # The job name
#SBATCH -c 1                   # Number of cores
#SBATCH -t 0-0:30              # Runtime in D-HH:MM
#SBATCH --mem-per-cpu=4gb      # Memory per cpu core

module load singularity
singularity exec tensorflow.simg python -c 'import tensorflow as tf; print(tf.__version__)'

Then submit the job to the scheduler. This example prints out the tensorflow version.

$ sbatch submit.sh

How To use GeoChemFoam in a Singularity Container

...

For additional details on how to use Singularity, please contact us or refer to the Singularity User Guide.

Example of R run

For this example, the R code below is used to generate a graph ''Rplot.pdf'' of a discrete Delta-hedging of a call. It hedges along a path and repeats over many paths. There are two R files required:

...

This program will leave several files in the output directory: slurm-<jobid>.out, Rplots.pdf, and routput (the first one will be empty).

Installing R Packages on

...

Insomnia

HPC users can Install R packages locally in their home directory or group's scratch space (see below).

...

Local Installation

After logging in to TerremotoInsomnia, start R:

Code Block
$ module load R

$ R

...

Since R will know where to look for libraries, a call to library(sm) will be successful (however, this line is not necessary per se for the install.packages(...) call, as the directory is already specified in it).


Note: we found that the solution to the following error that occasionally comes up in R installations:

ERROR: 'configure' exists but is not executable

is setting the following environment variable before the invocation of R:

export TMPDIR=/local

Matlab

Matlab (single thread)

We created a new Matlab example called "simpleML" (ML = MatLab).

The sample matlab code was used from this page:
https://www.mathworks.com/help/matlab/ref/magic.html

M = magic(5) returns an 5-by-5 matrix constructed from the integers 1 through 25
sum(M) will print the sum of the elements in each column


To run this Matlab example on Free Tiercluster, you will need to create 2 files in your directory (square5.m and simpleML.sh)

$ nano square5.m

**********copy and paste this without " any stars **** "

% Creates a 5x5 Magic square
M = magic(5);
M
sum(M)
exit


*********

And to submit it you would use this file (you also need to create it or copy +paste it in your directory)simpleML.sh

$ nano simpleML.sh


No Format
#!/bin/sh
#
# Simple Matlab submit script for Slurm.
#
#
#SBATCH -A astro # The account name for the job.
#SBATCH -J simpleML # The job name.
#SBATCH -t 2:00:00 # The time the job will take to run.
#SBATCH --mem-per-cpu=10gb # The memory the job will use per cpu core.
#SBATCH --job-name=simpleML
#SBATCH -o slurm.%N.%j.out # STD OUT
#SBATCH -e slurm.%N.%j.err # STD ERR
#SBATCH --nodes=1
#SBATCH --ntasks=1


module load matlab

matlab -nodisplay < square5.m


#End of script

...

Code Block
$ sbatch simpleML.sh

You will get a job number that you submitted the job and that job is in the queue.

Once your job is finished, you will get an output with slurm Job ID in the same directory.

If you use:
$ ls

You will see slurm.t108.1498555.out

If you want to check it you can use:

$cat slurm.t108.1498555.out

and you should see a 5 x 5 matrix and an answer that represents the sum of the elements in each column

>> >> >>
M =

17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9

>>
ans =

65 65 65 65 65

Matlab (multi-threading)

Matlab has built-in implicit multi-threading (even without applying its Parallel Computing Toolbox, PCT), which causes it to use several cores on the node it is running on. It consumes the number of cores assigned by Slurm.The user can activate explicit (PCT) multi-threading by specifying the number of cores desired also in the Matlab program.

...

This is one way to set up and run a jupyter notebook on TerremotoInsomnia. As your notebook will listen on a port that will be accessible to anyone logged in on a submit node you should first create a password.

...

Code Block
$ ssh -L 8080:10.43.4.206:8888 UNI@terremotoUNI@insomnia.rcs.columbia.edu

8. Open a browser session on your desktop and enter the URL 'localhost:8080' (i.e. the string within the single quotes) into its search field. You should now see the notebook.

...

The spark-slurm script on Free Tieris slightly modified version of the github spark-slurm script.


Set your environment:

...

To connect to the spark master WebUI, you can launch google-chrome from a login node. You will need to use Xwindows. If using Windows operating system, install and run Xming and then use Putty and enable SSH Xwindows forward before connecting.

...