wiki.ifm.liu.se

Documenting the world as we know IT

User Tools

Site Tools


mml:nsc-first

Running your first calculation at NSC

Get NSC account

  1. Register for NSC express here: https://nim.nsc.liu.se/express/login/
  2. Login, and go for “Manage my projects”
  3. Search for project '?' and click 'Request membership'
  4. Go through the options, and make sure to select that you want a login account.

Login on the Materials Modeling Lab cluster

Windows

Linux / Mac OSX

  • Most Linux distribution of Linux comes with ssh pre-installed, otherwise, find openssh-client or corresponding in your distribution's package system and install it.
  • Mac: Modern versions of OSX comes with ssh preinstalled.
  1. Open an ssh connection to the cluster with:
ssh <username>@?.nsc.liu.se

where <username> is replaced by the username you were assigned in the nsc email.

You should set up a passwordless login using SSH keys. A guide on NSC site with a notes on security

Interacting with the NSC Computer

  • Enter command name, press return to execute (be careful)
  • The nsc computers uses 'bash' as a command line system (a “shell”). This is one of the most common shells for Unix/Linux/Mac OSX. Here is a nice beginners guide: http://tldp.org/LDP/Bash-Beginners-Guide/html/
  • One of the most important things to be able to do is to edit simple text files. There are many advanced command line text editors in Unix/Linux (the most well known are vi and emacs). An easy beginner text editor is nano. To edit a text file in nano, just start it like this:
nano <filename>

In the bottom of the window you see various commands. E.g. “^G Get Help” means that pressing ctrl+G shows you the nano help page.

Configuring your account

Set login password

NSC assigned you a temporary password so you could make your first login, however, for security you are expected to change this password on your own login to something sufficiently secure. For this you use the command passwd. Here is an example session on how to do that:

[x_makro@neolith1 ~]$ passwd
Changing password for user x_makro.
Changing password for x_makro
(current) UNIX password: 
New UNIX password: 
Retype new UNIX password: 
passwd: all authentication tokens updated successfully.

Submitting your first job on the cluster

To submit a job to the queue on the cluster, we will be creating a job script. A job script contains a few instructions to the cluster queueing system + a list of shell commands to execute to start the computation. We will not run any computational code at this point, but merely the command echo that prints out a line.

First make a directory, and make it your current working directory:

mkdir my_first_run
cd my_fist_run

Here you edit a text file, e.g.,

nano my_first_run.q

Put the following contents into this file (you can use copy+paste into the terminal to enter this):

#!/bin/bash
#SBATCH -A liu1
#SBATCH -p green
#SBATCH -J MY_FIRST_RUN
#SBATCH -N 1 
#SBATCH -t 0:10:00

echo "Hello world!"
  1. The first row '#!/bin/bash' just states that this is a script using the bash shell.
  2. Row 2-6 give various instructions to the queuing system; that the job is under the liu1 project, should run in the queue called 'green', is titled MY_FIRST_RUN, is running on merely 1 core, and may maximally take 10 minutes of computational time.
  3. After these lines follows the actual script, which just prints out “Hello world!”.

Now submit this script to the queue:

sbatch my_first_run.q

You can check on the status of the job with:

squeue <username>

where <username> is your nsc username.

When the job is finished, you can look in the directory using the command ls and should see the result of the run:

ls
slurm-523395.out   my_first_run.q

(the number will not be the same). Using the command less you can look at the output of the run:

less slurm-523395.out

Where you see some first lines explaining how the job is setup to run, and after that “hello world”. Press 'q' to quit the less command that shows you output.

Congratulations, you have run your first job.

mml/nsc-first.txt · Last modified: 2012-10-24 17:49 by rar