Introduction to Python University of Oxford Department of Particle Physics
Total Page:16
File Type:pdf, Size:1020Kb
Particle Physics Cluster Infrastructure Introduction University of Oxford Department of Particle Physics October 2019 Vipul Davda Particle Physics Linux Systems Administrator Room 661 Telephone: x73389 [email protected] Particle Physics Computing Overview 1 Particle Physics Linux Infrastructure Distributed File System gluster NFS /data Worker Nodes /data/atlas /data/lhcb NFS HTCondor /home Batch Server Interactive Servers physics_s/eduroam Network Printer Managed Laptops Managed Desktops Particle Physics Computing Overview 2 Introduction to the Unix Operating System Unix is a Multi-User/Multi-Tasking operating system. Developed in 1969 at AT&T’s Bell Labs by Ken Thompson (Unix) Dennis Ritchie (C) Unix is written in C programming language. Unix was originally a command-line OS, but now has a graphical user interface. It is available in many different forms: Linux , Solaris, AIX, HP-UX, freeBSD It is a well-suited environment for program development: C, C++, Java, Fortran, Python… Unix is mainly used on large servers for scientific applications. Particle Physics Computing Overview 3 Linux Distributions Source: https://www.muylinux.com/2009/04/24/logos-de-distribuciones-gnulinux/ Particle Physics Computing Overview 4 Particle Physics Linux Infrastructure Particle Physics uses CentOS Linux on the cluster. It is a free version of RedHat Enterprise Linux. Particle Physics Computing Overview 5 Basic Linux Commands Particle Physics Computing Overview 6 Basic Linux Commands o ls - list directory contents ls –l - long listing ls -a - list all files including hidden file beginning with a dot “.”. ls -ld * - list details about a directory and not its contents ls –lh - give human readable file sizes ls –lS - sort files by file size ls –lt - sort files by modification time o cd – change directory $ cd /data/atlas/ o pwd - print name of working directory $ pwd o ~ (tilde) $ cd ~ Particle Physics Computing Overview 7 Basic Linux Commands o cp – copy file $ cp file1.txt file2.txt o mv – rename file/directory $ mv somefilename.txt file.txt o mkdir – create directory $ mkdir mydata o rm – delete file $ rm myfile o cat - concatenate files and print on the standard output $ cat ~/somefilename.txt Particle Physics Computing Overview 8 Basic Linux Commands otar - tape archive $ tar cvfp mydata.tar mydata/ ogzip - compress files $ gzip mydata.tar ountar and ungzip $ gzip -cd mydata.tar.gz | tar xvf – $ tar xvfz mydata.tar.gz Particle Physics Computing Overview 9 Basic Linux Commands o Disk usage $ df -h /data/snoplus Filesystem Size Used Avail Use% Mounted on pplxfs30.physics.ox.ac.uk:/data/snoplus 48T 38T 11T 79% /data/snoplus o File space usage $ du -sh ~/ 15G /home/davda/ tree - list contents of directories in a tree-like format. $ tree –L 3 –d ~/ | less $ tree –L 3 ~/ | less o find - search for files in a directory hierarchy $ find ~/ -name "*.py" Particle Physics Computing Overview 10 Basic Linux Commands o which - shows the full path of (shell) commands $ which ls /usr/bin/ls o whereis - locate the binary, source, and manual page files for a command $ whereis ls ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz o locate - find files by name $ locate stdio.h Particle Physics Computing Overview 11 Linux Command Line Training Linux Command Line Training: https://www.linkedin.com/learning/learning-linux-command-line-2 Particle Physics Computing Overview 12 Environment Modules Particle Physics Computing Overview 13 Environment Modules CentOS comes with a set of core packages such as gcc, python, glibc etc. The version of each core package is locked to the version of the OS. For example, if later versions of gcc are required, the following options are available: Download and compile in your home area and update all paths manually. OR Use Environment modules. Environment modules allow you to load different versions of gcc, python, root etc. If you require any software which is not available as a module, please let us know. Particle Physics Computing Overview 14 How to use Environment Modules $ module avail ----------------- /network/software/el7//modules ----------------------------- editors/vim/8.1 gcc/8.1.0 genie/genie intel/2015 pygist/2.2 root/5.34.36_pythia6 texlive/2019forthon/0.8.35 geant4/10.4.2 git/2.21.0 lhapdf5/5.9.1 root/5.34.36 texlive/2018 warp/single ----------------- /etc/modulefiles ------------------------------------------- mpi/mpich-3.2-x86_64 Particle Physics Computing Overview 15 How to use Environment Modules $ module show gcc/8.1.0 ------------------------------------------------------------------- /network/software/el7//modules/gcc/8.1.0: module-whatis adds gcc 8.1.0 package to your environment prepend-path PATH /network/software/el7/compilers/gcc/8.1.0/bin prepend-path LD_LIBRARY_PATH /network/software/el7/compilers/gcc/8.1.0/lib64 prepend-path MANPATH /network/software/el7/compilers/gcc/8.1.0/share/man prepend-path LD_LIBRARY_PATH /network/software/el7/compilers/gcc/8.1.0/common/lib setenv CC gcc setenv MPICH_CC gcc setenv FC gfortran setenv MPICH_FC gfortran setenv F90 gfortran setenv MPICH_F90 gfortran setenv F77 gfortran setenv MPICH_F77 gfortran setenv CPP cpp setenv MPICH_CPP cpp setenv CXX g++ Particle Physics Computing Overview 16 How to use Environment Modules $ gcc –version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ module load gcc/8.1.0 $ gcc –version gcc (GCC) 8.1.0Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ module unload gcc/8.1.0 Particle Physics Computing Overview 17 PP Batch Systems Particle Physics Computing Overview 18 What is HTCondor? HTCondor is a batch management system for compute-intensive jobs. Like other batch systems, HTCondor provides: job queueing mechanism scheduling policy resource monitoring resource management. HTCondor is very useful when you have an application that has to run a large number of times on different input data. HTCondor is installed on the PP CentOS 7 interactive nodes to make it possible to run a large number of computational processes, on different machines. For a more detailed overview on HTCondor, please see https://research.cs.wisc.edu/htcondor/description.html Particle Physics Computing Overview 19 HTCondor Batch System Worker Nodes Jobs are submitted from pplxint10 and pplxint11 /home and /data areas are HTCondor Batch Server mounted on all worker nodes. Interactive Servers There are ~400 logical CPUs on worker nodes to run jobs. Users Particle Physics Computing Overview 20 HTCondor Quick Start Guide Login to either pplxint10 or pplxint11. These are configured to submit jobs, to the HTCondor batch system. Particle Physics Computing Overview 21 HTCondor Simple Test Script Create an executable on hello.py one of the interactive #!/usr/bin/python nodes. import platform Test your executable on host=platform.node() print "Hello World - ", host an interactive node. print "finished" Particle Physics Computing Overview 22 HTCondor Creating a Submit Description File For example, a simple submit file to run hello.py in the batch queue. myjob.submit In order to run a job on one of ####################################### the worker nodes, create a # HTCondor Submit Description File. # Author: submit file which sets # Date: environment variables for the # Description: batch queue. ####################################### executable = hello.py universe = vanilla output = output/results.output.$(Process) error = error/results.error.$(Process) log = log/results.log.$(Process) queue 1 Particle Physics Computing Overview 23 HTCondor Submit file executable: The script or command that HTCondor runs. output: Where the STDOUT of the command or script should be written to. This can be a relative or absolute path. Please note that the directory “output” will not be created, and will error if the directory does not exist. error: Where the STDERR of the command or script would be written to. The same rules apply as for output. log: This is the output of HTCondor's logs for the job. It will show the submission times, execution host and times, and on termination, it will show the stats. Please note it is not logging for the executable, hello.py, in our example queue: This schedules the job. It becomes more important (along with the interpolation) when the queue is used to schedule multiple jobs, by taking an integer as a value. Particle Physics Computing Overview 24 HTCondor Submitting a Job A job is added to the HTCondor queue, by using “condor_submit” command for it to be run. Simply run the command: $ condor_submit myjob.submit Submitting job(s). 1 job(s) submitted to cluster 70. Note: Before submitting any jobs, always test, in order to make sure that both your submit file and executable work properly. Please bear in mind that submitting untested files and/or jobs will waste time and resources if they fail. Particle Physics Computing Overview 25 HTCondor Submitting a Job condor_submit <submit_file>: Submits jobs to the HTCondor queue, according to the information specified in submit_file. Useful options: -dry-run <dest_file> : this option parses the submit file and saves all the related information (name and locations of input and output files after expanding