AMS 200: Working on Linux/Unix Machines

Similar documents
Introduction: What is Unix?

User Guide Version 2.0

Introduction to Linux Environment. Yun-Wen Chen

Intermediate Programming, Spring Misha Kazhdan

Lab 1 Introduction to UNIX and C

Helpful Tips for Labs. CS140, Spring 2015

Intro to HPC Exercise

Session 1: Accessing MUGrid and Command Line Basics

Linux/Cygwin Practice Computer Architecture

CS CS Tutorial 2 2 Winter 2018

Linux Tutorial. Ken-ichi Nomura. 3 rd Magics Materials Software Workshop. Gaithersburg Marriott Washingtonian Center November 11-13, 2018

CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C

An Introduction to Unix

CENG 334 Computer Networks. Laboratory I Linux Tutorial

15-122: Principles of Imperative Computation

Lab 1 Introduction to UNIX and C

Getting Started With UNIX Lab Exercises

Tutorial 1: Unix Basics

Practical Session 0 Introduction to Linux

bwunicluster Tutorial Access, Data Transfer, Compiling, Modulefiles, Batch Jobs

bwunicluster Tutorial Access, Data Transfer, Compiling, Modulefiles, Batch Jobs

CS 143A. Principles of Operating Systems. Instructor : Prof. Anton Burtsev

Introduction to the Linux Command Line

CMSC 201 Spring 2018 Lab 01 Hello World

Introduction to Linux for BlueBEAR. January

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

C++ Programming on Linux

CSC111 Computer Science II

Mills HPC Tutorial Series. Linux Basics I

Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18

CMSC 201 Spring 2017 Lab 01 Hello World

CSE 391 Lecture 1. introduction to Linux/Unix environment

Linux Systems Administration Getting Started with Linux

Unit 10. Linux Operating System

CHE3935. Lecture 1. Introduction to Linux

Linux Shell Script. J. K. Mandal

CSE 391 Lecture 3. bash shell continued: processes; multi-user systems; remote login; editors

Linux environment. Graphical interface X-window + window manager. Text interface terminal + shell

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

CSE 391 Lecture 1. introduction to Linux/Unix environment

Lab 3a Using the vi editor

FILE MAINTENANCE COMMANDS

CS Operating Systems, Fall 2018 Project #0 Description

Linux Exercise. pwd answer: We call this directory (into which you get when you log in) your home directory.

Laboratory 1 Semester 1 11/12

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

Linux hep.wisc.edu

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

COSC UNIX. Textbook. Grading Scheme

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

Logging in to the CRAY

Lab 1 1 Due Wed., 2 Sept. 2015

Parallel Programming Pre-Assignment. Setting up the Software Environment

Introduction to Unix - Lab Exercise 0

Getting Started with UNIX

Basic UNIX commands. HORT Lab 2 Instructor: Kranthi Varala

Introduction. File System. Note. Achtung!

Getting started with Hugs on Linux

CS Fundamentals of Programming II Fall Very Basic UNIX

COMS 6100 Class Notes 3

CS 261 Recitation 1 Compiling C on UNIX

Using WestGrid from the desktop Oct on Access Grid

Introduction to Linux. Fundamentals of Computer Science

Linux Survival Guide

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

Development Environment. ICLAB NCTU Institute of Electronics

(7) Get the total energy from the output (1 Hartree = kcal/mol) and label the structure with the energy.

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage

Physics REU Unix Tutorial

Unit 13. Linux Operating System Debugging Programs

Refresher workshop in programming for polytechnic graduates General Java Program Compilation Guide

Unix/Linux Operating System. Introduction to Computational Statistics STAT 598G, Fall 2011

Introduction to the UNIX command line

Short Read Sequencing Analysis Workshop

Linux at the Command Line Don Johnson of BU IS&T

Using the Zoo Workstations

Development Environment & Linux Guide

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

UoW HPC Quick Start. Information Technology Services University of Wollongong. ( Last updated on October 10, 2011)

Getting started with Hugs on Linux

Week Overview. Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages

Unix Workshop Aug 2014

The Unix Shell & Shell Scripts

The Command Shell. Fundamentals of Computer Science

CSCI 2132 Software Development. Lecture 4: Files and Directories

CS 2400 Laboratory Assignment #1: Exercises in Compilation and the UNIX Programming Environment (100 pts.)

STA 303 / 1002 Using SAS on CQUEST

CSE 390a Lecture 3. bash shell continued: processes; multi-user systems; remote login; editors

Unix Introduction to UNIX

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Helsinki 19 Jan Practical course in genome bioinformatics DAY 0

Introduction to Linux Part 1. Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017

Working with Basic Linux. Daniel Balagué

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit

For Dr Landau s PHYS8602 course

New User Tutorial. OSU High Performance Computing Center

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

An Introduction to Cluster Computing Using Newton

Transcription:

AMS 200, Oct 20, 2014 AMS 200: Working on Linux/Unix Machines Profs. Nic Brummell (brummell@soe.ucsc.edu) & Dongwook Lee (dlee79@ucsc.edu) Department of Applied Mathematics and Statistics University of California, Santa Cruz 1. Remote login via SSH First of all, you will need to install an SSH (secure shell) client in order to access one of cluster machines (i.e., computing resources such as grape) remotely. * If you re a PC user, you can download PuTTY from (http://www.chiark.greenend.org.uk/ sgtatham/putty/download.html). * If you re a Mac or Linux user, you can simply use a terminal that is already available for you. For example, in Mac, go to Applications Utilities and open Terminal application. In Linux, Terminal can be found under System in general. Next step is to log in yourself to one of the AMS machines. For today, you are logging in to a cluster named grape. To log in to the cluster, you need to use a command ssh using the terminal we just mentioned. In the command line, you type in ssh -X your name@grape.soe.ucsc.edu with your SOE login password. At the step, you re logging into a master node or login node. As you login for the first time to the master node, you are asked to enter a passphrase. You can enter a very secured if you wish, or you can simply press enter. This process is to generate, so-called, SSH keys, which is a way to identify trusted computers, i.e., the rest of compute nodes, without having to enter password every time you run parallel jobs on these compute nodes. Note that running a parallel job means that you run multiple jobs on multiple processors, which actually require you to login to the requested compute nodes with password. This SSH key generation save you from doing this process. Your login is successful if you see something like the following on your terminal: 1

2 2. Basic Linux Commands There are few rules in using command lines in Linux. Several important rules are * Commands are case-sensitive. * Make sure you always logout yourself by typing exit when you re done. * The Linux command lines enables you to create complex functions by combining built in command lines together. This capability gives you countless ways to make your commands work in various different ways.

Exercise 1: Please run matlab by typing in a command matlab on a command prompt. Exercise 2: Please exit your current session and try to login again without having -X option. Please run matlab again. Is there any difference from the case with -X? You can use -Y instead of -X. Answer to 1 & 2: -X or -Y option enables X11 forwarding in SSH, which provides you not only a command line interface from the console, but also a variety of graphical-user-interfaces (GUIs). With the X forwarding option in login, you can enjoy a full set of interface display functions remotely. Here you re introduced to learn very basic Linux command lines. For more comprehensive studies, you can use to display a manual page using the man command, or you can come to ask the instructors for more help and resources. 2.1. Managing Files > ls lists your files > lls -l ls in long format > ls -a ls all files > mv filename1 filename2 remane filename1 to filemane2 > mv filename1 dirname move filename1 to a directory called dirname > cp filename1 filename2 copy filename1 to filename2 > rm filename remove a file > more filename display the contents of a file as much as will fit on your screen > less filename similar to more with the extended navigation capability allowing both forward and backward navigations > wc filename tells you number of lines, words and characters in a file > touch filename creating an empty file (multiple filenames after touch command will create multiple empty files) 3 ls. Exercise 3: See if you can find ls -l and ls -a when you execute man 2.2. Managing Directories > mkdir dirname create a new directory called dirname > cd dirname change directory, meaning you go to a directory called dirname > pwd tells you where you currently are in the directory tree > rmdir an empty directory deletion Exercise 4: Create a directory called dira, then under dira, create an empty file named filenamenull. Exercise 5: Delete the file filenamenull. Also delete the directory dira using rm command. Hint: Please look up man page of rm and find a useful

4 option for directory deletion. 3. Editors The following text editors are available on grape. You can choose whichever you want to use. (1) vim (or vi): To start > vi filename1 To edit enter i and start inserting text until <Esc> hit To delete single character x To delete entire current line dd To exit pressing <Esc> key followed by :x <Return> or :wq <Return> will quit vi saving the content to filename1, whereas pressing <Esc> key followed by :q! <Return> will quit vi without saving the latest change to filename1 See more basic commands for vi in http://www.cs.colostate.edu/helpdocs/vi.html (2) emacs: To start > emacs -nw filename1 To edit unlike vi, you can type in any characters in the editor To save the current buffer press hold down Control key and type in x and s To save the current buffer with different file name press hold down Control key and type in x and w and then enter new file name To exit the buffer press hold down Control key and type in x and c See more basic commands for emacs in http://www.cs.colostate.edu/helpdocs/emacs.html 4. Parallel Computing Please read the pdf file by Prof. Nic Brummell: https://ams.soe.ucsc.edu/sites/default/files/ams cluster grape evennewer 0.pdf 5. Two Examples In both tests, you demonstrate one of the most basic tasks such as printing hello world. 5.1. Running a short program in R Statistic Computing Use your preferred editor to implement the following lines and save it to a file named test.r :

5 print(date()) set.seed(43678) print("hello World") print("random number from standard normal") print(rnorm(1, 0,1)) There are two ways to run your R script. If you want to run the program using an R batch command, type from the Linux shell: > R CMD BATCH test.r Or, you can also run it by first start R (by typing R at the Linux command prompt) and once inside the R program, you can execute your source file with the command: > source( test.r ) In the first approach, you can see your results written out to a default output file test.rout. In the second example, you should be able to see the output on your screen such as [1] "Mon Oct 20 00:43:37 2014" [1] "Hello World" [1] "Random number from standard normal" [1] 0.7932329 5.2. Running a short program in Fortran Scientific Programming Language Again, please use your preferred text editor and implement the following short fortran program: program hello real :: n,m integer :: i,j i = 10 j = 2014 n=real(i) m=159.e0 print *,"i+j=",i+j print *,"n-m=",n-m print *, "Hello World" end program hello You save it to hello.f90. Now you are going to compile it in order to generate an executable binary. On grape, you can do this using gfortran compiler:

6 > gfortran hellow.f90 After compiling your program, you should be able to see an executable binary file with a default name, a.out. Run it by entering a command line: >./a.out Exercise 6: What does your result look like from running hello.f90? Exercise 7: Can you give a different name for the executable instead of the default a.out? Exercise 8: Can you extend the previous serial run of test.r (and/or hello.f90) to a parallel job, say 2 nodes with 8 processors on each node (i.e., a total of 16 parallel tasks)?