bwunicluster Tutorial Access, Data Transfer, Compiling, Modulefiles, Batch Jobs Frauke Bösert, SCC, KIT 1
Material: Slides & Scripts https://indico.scc.kit.edu/indico/event/263/ @bwunicluster/forhlr I/ForHLR II: /pfs/data1/software_uc1/bwhpc/kit/workshop/2016-12-06 How to read the following slides Abbreviation/Colour code Full meaning $ command -option value $ = prompt of the interactive shell The full prompt may look like: user@machine:path$ The command has been entered in the interactive shell session <integer> <string> foo, bar <> = Placeholder for integer, string etc Metasyntactic variables 2
Login <UserID> username prefix Host <host> bwunicluster: uc1.scc.kit.edu = <prefix_username> = your user account at your university. = organization's token KIT: ka but NO ka_ for bwunicluster/forhlr I&II Uni Stuttgart: st, Uni Hohenheim: ho, HS Esslingen: es, Uni Freiburg: fr bwfilestorage: bwfilestorage-login.lsdf.kit.edu Linux / macos open terminal: $ ssh <UserID>@<host> Windows use SSH-Client, e.g. PuTTY connect to <host>: Login as: <UserID> 3
Revision: basic linux commands Cheat sheet: http://ryanstutorials.net/linuxtutorial/cheatsheet.php $ pwd show path of working directory $ mkdir <dirname> make directory $ cd <dirname> change directory $ ls list directory content $ cp <sourcefile> <targetfile> copy file $ mv <sourcefile> <targetfile> move file $ rm <filename> remove file $ nano <filename> edit file $ man <command> show command s manual 4
Exercise 1: Login+Linux TASK/ToDo: 10 10 min min Login to bwunicluster Exit login 1. Generate folder with today s date (use syntax YYYY-MM-DD) unter $HOME 2. Generate empty file with name moab1_ + today s date Hint: use command touch For use of touch read manual via command man touch 3. Move file to $HOME/<YYYY-MM-DD>; Rename file by adding the extension.sh 4. Find under /opt/bwhpc/kit/workshop/2016-12-06 (man find) the PDF of the talk starting with the string 04_2016-12-06 ; Copy it to your folder generated under 1. 5. Go to folder $HOME/<YYYY-MM-DD> and open the PDF with evince it will fail: find the option of the SSH command in the manual man ssh look at Enables X11 forwarding Re-login to bwunicluster with the SSH + new option and open PDF with evince 5
Exercise 1: Login+Linux Solution (1) TASK/ToDo: 10 10 min min Login to bwunicluster 1. Generate folder with today s date (use syntax YYYY-MM-DD) unter $HOME $ mkdir -pv $HOME/2016-12-06 2. Generate empty file with name moab1_ + today s date $ touch moab1_2016-12-06 3. Move file to $HOME/<YYYY-MM-DD> ; Rename file by adding the extension.sh $ mv moab1_2016-12-06 $HOME/2016-12-06 $ cd $HOME/2016-12-06 $ mv moab1_2016-12-06 moab1_2016-12-06.sh 4. Find PDF of the talk starting with the string 04_2016-12-06 ; Copy it to your folder generated under 1. $ find /opt/bwhpc/kit/workshop/2016-12-06 -name "04_2016-12-06*" $ cp /opt/bwhpc/kit/workshop/2016-12-06/slides/04_2016-12-06_bwhpc_course_- _bwunicluster_tutorial.pdf $HOME/2016-12-06 6
Exercise 1: Login+Linux Solution (2) TASK/ToDo: 10 10 min min Exit login $ exit Re-login with X-forwarding $ ssh -X <userid>@uc1.scc.kit.edu Go to folder $HOME/<YYYY-MM-DD> and open the PDF with evince $ cd $HOME/2016-12-06 $ evince 04_2016-12-06_bwHPC_course_-_bwUniCluster_Tutorial.pdf 7
Data Transfer From localhost to cluster: use scp (secure copy) or sftp (secure file transfer program) Read manual for options/syntax questions (man scp, man sftp) From Linux to Linux Systems you can also use rsync Linux / OS X Open terminal at your computer: $ scp <sourcefile> <username>@<host>:<targetfile> or $ sftp <username>@<host>:<targetdir> $ put <sourcefile> Windows use SCP/SFTP-Client, e.g. WinSCP connect to <username>@<host> copy data by drag&drop mechanism 8
From $HOME to Workspaces Compute nodes read&write in workspaces much faster than in $HOME directory. DO NOT COMPUTE IN $HOME!! $HOME: For: Source code Workspaces: HowTo: compare previous talk slide no 9 For: Program input (e.g. initial and boundary conditions) Program output 9
Exercise 2: Data Transfer TASK/ToDo: 10 10 min min 1.Download 04_2016-12-06_bwHPC_course_suppl.tar.gz from https://indico.scc.kit.edu/indico/event/263/material/0/ to your course computer 2.Copy *tar.gz to $HOME/<YYYY-MM-DD> at bwunicluster 3.Login to bwunicluster 4.Generate workspace with lifetime of 10 days and name workshop 5.Copy *tar.gz to your workspace 6.Unpack the archive *tar.gz in your workspace Hint: for unpack use command + options: tar xvbfz 10
Exercise 2: Data Transfer - Solution TASK/ToDo: 10 10 min min 1.Download 04_2016-12-06_bwHPC_course_suppl.tar.gz 2.Copy *tar.gz to $HOME/<YYYY-MM-DD> at bwunicluster $ scp 04_2016-12-06_bwHPC_course_suppl.tar.gz <userid>@uc1.scc.kit.edu:~/2016-12-06 3.Login to bwunicluster $ ssh <userid>@uc1.scc.kit.edu 4.Generate workspace with lifetime of 10 days and name workshop $ ws_allocate workshop 10 5.Copy *tar.gz to your workspace $ cp -vp ~/2016-12-06/04_2016-12-06_bwHPC_course_suppl.tar.gz $(ws_find workshop) 6.Unpack the archive *tar.gz in your workspace $ cd $(ws_find workshop) $ tar xvbfz 04_2016-12-06_bwHPC_course_suppl.tar.gz 11
Module Environment Users require different software in different versions. Software is installed and can be used by loading corresponding modules. $ module avail show all installed software packages $ module avail compiler show all available compilers $ module load <modulepath> load a module in list $ module unload <modulepath> remove a module from list $ module list show all loaded modules $ module show <modulepath> show environment variables of module $ module help <modulepath> show usage information of module 12
Exercise 3: Editors/Create script TASK/ToDo: 10 10 min min 1. Choose: a) vim cheat sheet: http://vim.rtorr.com/ b) nano cheat sheet: http://alturl.com/wbtrk c) emacs login to bwunicluster via X-forwarding, i.e., ssh -X cheat sheet: http://www.rgrjr.com/emacs/emacs_cheat.html 2. Insert in file moab1_2016-12-06.sh, save it, print content to screen #!/bin/bash #!/bin/bash which which icc icc module module load load compiler/intel compiler/intel which which icc icc 3. Change file permission to make moab1_2016-12-06.sh executable 4. Run script 13
Exercise 3: Editors/Create script - Solution TASK/ToDo: 10 10 min min 2. Insert in file moab1_2016-12-06.sh, save it, print content to screen $ cd $HOME/2016-12-06 $ vim moab1_2016-12-06.sh $ cat moab1_2016-12-06.sh 3. Change file permission to make moab1_2016-12-06.sh executable $ chmod u+x moab1_2016-12-06.sh 4. Run script $./moab1_2016-12-06.sh 14
Environment variables in job scripts Details: http://www.bwhpc-c5.de/wiki/index.php/batch_jobs#environment_variables_for_batch_jobs MOAB variables and own environment variables Using MOAB Variables Defining own variables Header #MSUB -o $(JOBNAME).o$(JOBID) #MSUB -v EXEC=./hello Execution Part echo Job ${MOAB_JOBNAME} is running (ID=${MOAB_JOBID}) export EXEC=./hello 15
Keep track of a job Submit job script $ msub <jobscript> If a job (script) is accepted the <jobid> appears at screen. $ checkjob <jobid> show job details $ showq list all my running, idling and blocked jobs by <jobid> $ showq -n list all my running, idling and blocked jobs by <jobname> $ showq -c list my completed jobs $ canceljob <jobid> cancel job 16
Exercise 4: Batch job TASK/ToDo: 10 10 min min 1. Copy moab1_2016-12-06.sh to the subfolder in your workspace containing hello.c 2. Go to your workspace; load intel compiler 3. Compile existing code and execute hello.x Hint for compiling: $ icc -o hello.x hello.c 4. Replace all in moab1_2016-12-06.sh with the following lines & save it #!/bin/bash #!/bin/bash #MSUB #MSUB -l -l nodes=1:ppn=1,walltime=00:01:00 nodes=1:ppn=1,walltime=00:01:00 #MSUB #MSUB -l -l mem=100mb mem=100mb #MSUB #MSUB -l -l advres=workshop.8 advres=workshop.8 #MSUB #MSUB -N -N firstjob firstjob./hello.x./hello.x sleep sleep 10 10 5. Submit script to queueing system + watch progress 17
Exercise 4: Batch job - Solution TASK/ToDo: 10 10 min min 1. Copy moab1_2016-12-06.sh to subfolder of your workspace containing hello.c $ cd $HOME/2016-12-06 $ cp -pv moab1_2016-12-06.sh $(ws_find workshop)/2016-12-06/exercises/04 2. Go to that subfolder in your workspace; load intel compiler $ cd $(ws_find workshop)/2016-12-06/exercises/04 $ module load compiler/intel 3. Compile existing code and execute hello.x $ icc -v -o hello.x hello.c $./hello.x 4. Replace all in moab1_2016-12-06.sh with the following lines & save it $ vim moab1_2016-12-06.sh 5. Submit script to queueing system + watch progress $ msub moab1_2016-12-06.sh $ showq 18