Difference between revisions of "Getting started"

From mn.kjemi.vaspwiki
Jump to: navigation, search
m
m
Line 30: Line 30:
 
==Login==
 
==Login==
 
===ssh===
 
===ssh===
ssh can be used to login using a terminal app on UNIX, macOS or Windows Subsystem for Linux
+
ssh can be used to login to the cluster with a terminal app on UNIX, macOS or Windows Subsystem for Linux
  
 
<code> ssh [username]@saga.sigma2.no </code>
 
<code> ssh [username]@saga.sigma2.no </code>
  
Hostnames and usernames can be defined by creating or editing the file <code> ~/.ssh/config </code>.
+
Hostnames and usernames can be saved by creating or editing the file <code> ~/.ssh/config </code>.
  
 
This can be done using the text editor vim
 
This can be done using the text editor vim
Line 67: Line 67:
 
==Working in UNIX==
 
==Working in UNIX==
 
===Basic commands===
 
===Basic commands===
Use TAB to autocomplete commands, paths and filenames.
+
Learn to use TAB to autocomplete commands, paths and filenames.
  
Use <code> man [command] </code> to view the manual for any command.
+
Learn to use <code> man [command] </code> to view the manual for any command.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 131: Line 131:
 
|-
 
|-
 
|<code> cat </code>
 
|<code> cat </code>
|Concatenate text files sequentially. Use <code>> [filename] </code> to write to file.
+
|Concatenate text files sequentially. Use <code> > [filename] </code> to write the output to a file.
 
|}
 
|}
  
 
===Filesystem on Saga===
 
===Filesystem on Saga===
Home directory: personal files and scripts due to limited storage space
+
Home directory: mainly for personal files, scripts etc. due to limited storage space
  
 
<code> /cluster/home/[username] </code>
 
<code> /cluster/home/[username] </code>
  
Project folder: run jobs and store large output files
+
Project folder: running jobs and store large output files
  
 
<code> /cluster/projects/[project number] </code>
 
<code> /cluster/projects/[project number] </code>
Line 149: Line 149:
 
<code> dusage </code>
 
<code> dusage </code>
  
Find and remove files in current folder and subfolders
+
Find and remove files matching [filename] in current folder and subfolders
  
 
<code> find . -name "[filename]" -exec rm {} \; </code>
 
<code> find . -name "[filename]" -exec rm {} \; </code>
  
 
===Jobscript===
 
===Jobscript===
 
+
Saga has 40 cores per node [https://www.sigma2.no/systems www.sigma2.no/systems]
  
 
  #SBATCH --job-name=[jobname]
 
  #SBATCH --job-name=[jobname]
Line 169: Line 169:
 
  savefile [filenames]  
 
  savefile [filenames]  
  
The job folder can be accessed while the job is running
+
The working folder can be accessed while a job is running
 
<code> /cluster/work/jobs/[slurm-id] </code>
 
<code> /cluster/work/jobs/[slurm-id] </code>
  
 
<code> /cluster/projects/nn4604k/jobfile </code>
 
<code> /cluster/projects/nn4604k/jobfile </code>
 
  
 
Submit job to queue
 
Submit job to queue
Line 193: Line 192:
  
  
vim can be configured in <code> ~/.vimrc </code>. Turn on line numbers to  
+
vim can be configured in <code> ~/.vimrc </code>. Turn on line numbers to easily jump to a specific line using <code> :[line number] </code>
 
  set number
 
  set number
  
 
===Bash scripting===
 
===Bash scripting===

Revision as of 16:58, 26 September 2021

User access

Go to www.metacenter.no > User Login (Passwords) > 1. Request a user account > HPC

Fill in the form and choose the appropriate project. It is recommended to use your UiO username.

The project manager can give you access to the VASP license through the VASP portal and thereafter informing sigma2@uninett.no to give your user the necessary group affiliations (xvasp and vasp5).

Project Manager Group Resources
NN4604K Jonathan M. Polfus Electrochemistry Saga
NN9136K Lasse Vines LENS Saga
NN9180K Clas Persson Structure Physics Saga

Login

ssh

ssh can be used to login to the cluster with a terminal app on UNIX, macOS or Windows Subsystem for Linux

ssh [username]@saga.sigma2.no

Hostnames and usernames can be saved by creating or editing the file ~/.ssh/config .

This can be done using the text editor vim

vim ~/.ssh/config

Press i to insert text

Host saga
   HostName = saga.sigma2.no
   user [username]

Press escape to exit insert mode, and then :wq to 'write' and 'quit'.

Login is then simplified

ssh saga

Copy files from cluster to current folder (.)

scp saga:[path]/[filename] .

Copy files to the home directory on the cluster

scp [filename] saga:

PuTTY and WinSCP

PuTTY is an ssh client for Windows that can be downloaded from www.putty.org.

WinSCP is an scp client for Windows that can be downloaded from winscp.net.

Working in UNIX

Basic commands

Learn to use TAB to autocomplete commands, paths and filenames.

Learn to use man [command] to view the manual for any command.

Navigating the filesystem
Command Description
ls List files and directories in current directory
mkdir [directoryname] Make a directory
cd [directoryname] Change path to another directory
pwd Display current path
cd .. Change path to parent directory
cp [path]/[filename] . Copy file to current directory
cp [filename] [directoryname] Copy file to another directory
mv [filename] [path] Move file to another directory
mv [filename] [newfilename] Change the name of a file
cp -r [directory] [path] Copy directory to new location
rm [filename] Delete file
rm -r [directoryname] Delete directory and its contents
Reading text files
Command Description
less View text file. Shift-F to view live updates to file
head Display top 10 lines of text file. Options: -n [count] to specify number of lines
tail Display bottom 10 lines of text file. Options: -n [count] to specify number of lines
grep [pattern] Display each line in text file containing text specific text/symbol pattern
cat Concatenate text files sequentially. Use > [filename] to write the output to a file.

Filesystem on Saga

Home directory: mainly for personal files, scripts etc. due to limited storage space

/cluster/home/[username]

Project folder: running jobs and store large output files

/cluster/projects/[project number]

  • NN4604K: create a subfolder [username]

Check disk usage and storage quota for home directory and project folder

dusage

Find and remove files matching [filename] in current folder and subfolders

find . -name "[filename]" -exec rm {} \;

Jobscript

Saga has 40 cores per node www.sigma2.no/systems

#SBATCH --job-name=[jobname]
#SBATCH --account=[project number]
#SBATCH --time=hh:mm:ss
#SBATCH --mem-per-cpu=4600M
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=40

Copy files to temporary job folder

cp [filenames] $SCRATCH

Copy files from job folder when job completes. Savefile will also copy files if the job crashes.

savefile [filenames] 

The working folder can be accessed while a job is running /cluster/work/jobs/[slurm-id]

/cluster/projects/nn4604k/jobfile

Submit job to queue sbatch jobfile

View the queue squeue -u [username]

Aliases and settings

Define shortcuts by adding aliases to ~/.bash_profile

alias l='ls -l'
alias la='ls -l -a'
alias ..='cd ..'
alias nn='cd /cluster/projects/[project number]'
alias q='squeue -u [username]'

Changes will take effect on next login or manually with source ~/.bash_profile .


vim can be configured in ~/.vimrc . Turn on line numbers to easily jump to a specific line using  :[line number]

set number

Bash scripting