Scientific Computing Laboratory Handbook

This page is under constructions.
  1. INTRODUCTION
  2. UNIX ENVIRONMENT
  3. PRINTING
  4. EDITOR
  5. ELECTRONIC MAIL SERVICES
  6. C PROGRAMMING
  7. FORTRAN
  8. FTP (FILE TRANSFER PROTOCOL)
  9. MODEM
  10. TERMINAL SETTINGS

1. Introduction

The Scientific Computing Laboratory is located at R735 Sir Run Run Shaw Building, Ho Sin Hang Campus, Hong Kong Baptist University. An UNIX computer system is in service. This laboratory is mainly dedicated for MSc students in Scientific Computing, but also serves Science Faculty staff, postgraduate students and authorized third year undergraduate project students of the Science Faculty.

This handbook is written for the users who are working in the S cientific Computing Laboratory. The purpose is to help users to get familiar with the laboratory, to learn AIX (IBM UNIX operating system) and to use the facilities provided by the system.

Convention

Throughout this handbook, the following conventions have been adopted:

Help and Enquires

For user queries or request, please send e-mail to sysadm@sci.hkbu.edu.hk or contact the staff in R734.

User Accounts

MSc students in Scientific Computing, staff, visitors, postgraduate students and authorized third year undergraduate project students in Faculty of Science can apply for user accounts.

Applicants can get application forms in R734 or R735. Applications should be approved by the laboratory co-managers.

User should set their password as soon as they log into their accounts at the first time (see page 5). They should change their password periodically for security purpose.

Users can work in the laboratory or remotely log on the system from other computers, which have been connected to University network system. Users can also access the machines through modem supported by ITSC.

Scientific Computing Laboratory R735 Opening Hours

Monday - Saturday: 9:00 - 22:30
Sunday and Public Holiday: 12:00 - 22:00
Note: MSc students in Scientific Computing have the highest priority to use the computer facilities in R735. For others, the "first come first served" policy is adopted.

Staff-in-charge Schedule

Time Monday Tuesday Wednesday Thursday Friday Saturday
9:00-18:00 R734 R734 R734 R734 R734 *R734

R734 - Staff-in-charge could be contacted at R734.
*R734 - Staff-in-charge could be contacted at R734 when there is a laboratory class.

Policy and Regulations for Scientific Computing Laboratory R735

Hardware

* IBM RS/6000 Model 3BT (Compute Server)
187.2 SPECint92
205.3 SPECfp92
IBM Power 67 MHz CPU
1 GB Hard disk
17" Color Display
3 1/2" Floppy Disk Drive
128MB RAM
x 1
* IBM RS/6000 Model G30+ (File Server)
IBM PowerPC 604 112 Mhz CPU x 2
ASCII Display
CD-ROM Drive
SCSI-2 FAST/WIDE DIFF
1 GB internal hard disk
2 GB and 4.5GB x 2 external hard disk
x 1
* IBM RS/6000 Model C10 (File Server)
90.5 SPECint92
100.8 SPECfp92
IBM Power PC 601 80 MHz CPU
ASCII Display
3 1/2 Floppy Disk Drive
SCSI-2 FAST/WIDE DIFF
2GB SCSI-2 Hard Disk x 2
3 1/2" 2.88MB disk
64 MB RAM
x 1
* IBM RS/6000 Model 41T
88.1 SPECint92
98.7 SPECfp92
80 MHz PowerPC 601 CPU
540 MB Hark Disk
17" Color Display
32MB-256MB RAM
x 12
* IBM RS/6000 Model 41T
88.1 SPECint92
98.7 SPECfp92
80 MHz PowerPC 601 CPU
540 MB Hark Disk
20" Color Display
32MB-64MB RAM
x 4
* Hewlett Packard Entria X-terminal
10 MB RAM
x 6
* Hewlett Packard Envizex X-terminal
10 MB RAM
Audio input device
x 4
* IBM 4039 laser printer x 1
· 4mm Tape Drive x 1
· 644MB CD-ROM Drive x 1
. Colour Scanner x 1

Licensed Software

Public Domain Software

TeX Typesetting software
elm, pine Email tools
joe, pico, emacs, asWedit Screen editor
tin USENET news reader/poster
mosaic, netscape World Wide Web browser
xv Graphics Viewer
cxterm, cxtermb5 Chinese xterm (GB or BIG5 encoding)
xarchie public domain software finder
pvm parallel virtual machine
gnuplot interactive function curve plotter
xgraph window based curve plotter

2. UNIX Environment

Introduction to UNIX

The UNIX operating system was first developed by Bell Laboratories. Since then, there are different UNIX systems elaborated by different companies, such as IBM AIX, Apple AUX, HP HP-UX, Sun Solaris and SunOS, DEC ULTRIX and AT&T UNIX. From the user's point of view, these operating systems are very similar to each other.

Log on

There are one compute server, one file server and sixteen client workstations in the system. Users are not allowed to log on to the file server. Users can directly log on to any of the client machines and remote log on to the compute server.

When users log on to a workstation in the laboratory, they will see a user login prompt. Type the user name and password respectively.

	login: username
	password: 

UNIX is a case sensitive operating system. Commands and key words are always in lower case. User name is always in lower case. Make sure the keyboard is not cap locked. If the monitor is off, turn it on. If there is no image display on screen, press a key or move the mouse to invoke the system.

If login process is not accepted, try again in case of mis-typing.

User may remote log on to the system from other machines by the software TELNET. The fully qualified domain addresses of the machines are
abacus.sci.hkbu.edu.hk (sc1.sci.hkbu.edu.hk, abacus) - The compute server
beads.sci.hkbu.edu.hk (sc3.sci.hkbu.edu.hk, beads) - The file server
calculus.sci.hkbu.edu.hk (sc4.sci.hkbu.edu.hk, calculus) - The file server
www.sci.hkbu.edu.hk (sc5.sci.hkbu.edu.hk, ftp.sci.hkbu.edu.hk) - The ftp and WWW server
ada.sci.hkbu.edu.hk (sc11.sci.hkbu.edu.hk, ada) - The client machines
babbage.sci.hkbu.edu.hk (sc12.sci.hkbu.edu.hk, babbage)
cauchy.sci.hkbu.edu.hk (sc13.sci.hkbu.edu.hk, cauchy)
einstein.sci.hkbu.edu.hk (sc14.sci.hkbu.edu.hk, einstein)
fourier.sci.hkbu.edu.hk (sc15.sci.hkbu.edu.hk, fourier)
gauss.sci.hkbu.edu.hk (sc16.sci.hkbu.edu.hk, gauss)
hilbert.sci.hkbu.edu.hk (sc17.sci.hkbu.edu.hk, hilbert)
jacobi.sci.hkbu.edu.hk (sc18.sci.hkbu.edu.hk, jacobi)
kutta.sci.hkbu.edu.hk (sc19.sci.hkbu.edu.hk, kutta)
laplace.sci.hkbu.edu.hk (sc20.sci.hkbu.edu.hk, laplace)
markov.sci.hkbu.edu.hk (sc21.sci.hkbu.edu.hk, markov)
newton.sci.hkbu.edu.hk (sc22.sci.hkbu.edu.hk, newton)
pascal.sci.hkbu.edu.hk (sc23.sci.hkbu.edu.hk, pascal)
runge.sci.hkbu.edu.hk (sc24.sci.hkbu.edu.hk, runge)
stokes.sci.hkbu.edu.hk (sc25.sci.hkbu.edu.hk, stokes)
turing.sci.hkbu.edu.hk (sc26.sci.hkbu.edu.hk, turing)
For instance, type telnet ada.sci.hkbu.edu.hk or telnet sc11.sci.hkbu.edu.hk

Common Desktop Environment (CDE) -- a graphical user interface

CDE is a graphical user interface provided commonly in recent UNIX system. The workstation console is already running CDE. With this interface, user can control the computer system using mouse point-and-click. Toolbar has been setup. Users can right mouse button to pop up workspace menu to run most of the software installed in the Laboratory.

Logging Out

If you are using CDE, right click on the background by mouse to pop up the workspace menu. Choose Logout to quit. Remember to confirm the logout process. If you are working in text mode, just type exit to logout.

Shells

When you log on to a UNIX system, a shell program is automatically run. Shell prompts you for input and receives your command entries. It processes your command line and gives you feedback. Three most popular command shells are Bourne Shell, C Shell and Korn Shell. The default shell in AIX is Korn shell.

The command prompt is different among different shells. % is for C shell. $ is for Bourne shell and Korn shell. The prompt can be set and changed by the system administrator or the user.

User Password

While your user name is known to everyone, your password should be known only to yourself. Don't distribute your passwords to your friends and relatives. If we discover a user share his account with others, we will disable that account immediately.

When you firstly log on the UNIX system, you will have either no password or an arbitrary password assigned by the system administrator. Neither of them really offers any security. You should change your password by issuing the command passwd. Type

	passwd
	Type your old password
	Old passwd: 
	Type your new password
	New passwd: 
	Type your new password again for verification
	Verify: 
Then, your password is changed to be the new one.

Password Guidelines

User and System Information

To determine which login name is being used, type
	whoami
The system displays information similar to the following:
	sysadm
To display the login name, the terminal name, and the time of the login, type
	who am i
The system displays information similar to the following:
	sysadm		pts/0		Nov 11 09:30
The login name is sysadm, the name of the terminal is pts/0, and this user logged in at 9:30 a.m. on Nov 11.

To display who is log on, type

	who
or
	finger
To search for information about a user, type
	finger username
or
	finger surname-of-that-user
To display your terminal, type
	tty
The system displays information similar to the following:
	/dev/hft0

Current Date and Time

You can request the system to show you the current date and time. Type
	date

Display Manual Pages Online (A Help Service)

The command man helps the users to understand the use of all the UNIX commands.
	man command      
	man -k command      
Display a command manual.
Press space bar to continue to next page. Press q to leave manual page.

For instance, you can type the command man man. Then, the online manual will appear.

To read the next page, press the space bar, type

	man man
To read all the commands related to the keyword man, type
	man -k man

Pathname

The UNIX System allows you to specify a file name including its directory path. This type of name for a file is called a pathname.

A pathname that traces the path from the root to a file is called a full pathname. A full pathname provides a complete and unambiguous name for a file.

In a full pathname, the first slash(/) refers to the root of the file system. The last slash separates a file name from the directory names. The other slashes separate the sub-directory names.

Note: The directory separator is denoted by "/" instead of "\" as in DOS.

A single dot "." is used to refer to the current directory (the directory which you are working at).

Double dots ".." are used to refer to the parent directory of the current directory.

"../.." refers to the parent of the parent of the current directory.

Commands Overview

Some commands can be entered simply by typing one word. It is also possible to combine commands so that the output from one command becomes the input for another command. This known as pipelining.

Flags further define the actions of commands. A flag is a modifier used with the command name on the command line, usually preceded by a dash.

List Files and Directories

	ls [ options ] name 
Print a list of files and sub-directories under the specified directory. It is equivalent to the MS DOS command dir. If no name is specified, the default is the current directory. Wild cards can be used within the specified name.

List the contents of the current directory.

		ls
List the full contents of the current directory including the dot files.
		ls -la
List the contents of the root directory.
		ls /
List the contents of the directory /student under root directory.
		ls /student
List the contents of the parent directory of the current directory.
		ls ..

Concatenate and Display File Contents

		cat [ options ] file...
Create a file my_file1.
		cat > my_file1
		Testing!
		This is my file.
		
Print the content of the file to screen
		cat my_file1
Redirect the content of a file to another.
		cat my_file1 > my_file2
Print the contents of one or more files page by page
		more file ...
Press Spacebar to read the next page.
Press Enter to read the next line.
Press q to quit.

Create Directory

			mkdir directory-name
			mkdir temp
			mkdir demonstration

Copy File and Directory

		cp [ options ] file1 file2
		cp [ options ] file1... directory
		cp [ options ] directory1... directoryn
You may copy a file to another, a list of files to a directory or a directory to another directory.
		cp my_file1 temp_file1
		cp my_file1 demo/my_file1
Copy All files under directory demo recursively to the directory demo1.
		cp -R demo demo1

Move (Rename) File or Directory

	mv [options] name1 name2
Rename a directory.
                mv demonstration demo
Rename a file.
		mv my_file3 your_file1
Move a file to a directory
		mv your_file1 demo

Remove File or Directory

		rm [options] name
Remove/Delete you_file1
		rm your_file1
Remove your directory temp and all the files inside the directory
		rm -r temp

Change Current Directory

		cd [options] directory-name
When you are log on, you are inside your home directory. You may change your current directory to other directories.

Change the current directory to demo.

		cd demo
Change the current directory to your home directory.
		cd
Change the current directory to the parent directory.
		cd ..

Print Working Directory

Display the working (current) directory on screen.
		pwd

Locate a Command or Program

	whereis command
Find all the files that contain the name Mail, type
	whereis Mail
The system displays information similar to the following:
	Mail:	/bin/Mail	/usr/bin/Mail	/lib/Mail.rc	/usr/ucb/Mail 
			/usr/lib/Mail.rc
List previously entered commands
		history
Show user processes.
		ps
Show all processes in the system.
		ps -ef

3. Printing

There are two print queues to the IBM laser printer model 4039 installed in the laboratory. Queue pcl is the default print queue for text printing. Queue ps is for PostScript printing.

		lpr [Options] file 
		lpr -Pprintqueue file 
Print text file
		lpr -Ppcl postscript_file.ps
Or
	lptxt postscript_file.ps
Print PostScript file
		lpr -Pps postscript_file.ps
Or
	lpps postscript_file.ps
See the status of all the printers
	lpstat
Remove a print job from a print queue
	lprm -Pprintqueue jobnumber

4. Editor

vi

Before you try the vi editor, you may first read the online manual.
	man vi
vi is one of the most common editors run under the UNIX system. This is the editor bundled in all UNIX systems.
	vi filename
This command starts vi running, reads a file into a file buffer, and displays the file contents.
There is always a message at the bottom of the editor window. You should notice it from time to time.

If the file has already been created, this message will appear:

	"filename" ? lines, ? characters
If the file is new, the message will be:
	"filename" [new file]
There are two modes in the vi editor: command mode and input mode. In the command mode, keys entered from the keyboard is taken as a command. It allows you to move around in the file, or to change parts of it.

In the input mode, characters entered from the keyboard is interpreted as text input intended to be placed in the current position of the file.

When you run the command vi, you will first be in the command mode. Type i to enter the input mode. Press <Esc> to enter the command mode.

The followings are some useful vi commands:

Text Insertion
a Append text after the cursor position.
i Insert text before the cursor position.
o Open a new line below the current line.
<Esc> Stop text operation and return to the command mode.
Text Copy
yy Copy the current line to the file buffer.
2yy Copy 2 current lines (other number can also be used) to the file buffer.
p Copy the content of the file buffer to the position after the current line.
P Copy the content to the position before the current line.
Text Deletion
dw Delete the current word.
x Delete the current character.
dd Delete the current line.
p Put back the text from the previous delete.
Text Replacement
r<Char> Replace the current character to a specified character.
R<string><Esc> Replace string on the current line.
Recover the last change
u Recover the last change.
Paging
<Ctrl f> Page forward one screen.
<Ctrl b> Page back one screen.
<Ctrl d> Page down half screen.
<Ctrl u> Page up half screen.
<Ctrl l> Reprint current screen (screen refresh).
Cursor Positioning
j Move cursor down one line
k Move cursor up one line
h Move cursor one character left.
l Move cursor one character right.
Read and write file
:r filename Read a file into the file buffer at the current position.
:w filename Write the contents to a file.
:1;3w filename Write line 1 to line 3 to a file.
Exiting vi
:wq Write changes to the current file and quits the edit session.
:q Quit if there is no change.
:q! Force to quit and abandon any change.

Create a testing file my_file4.

	vi my_file4
	i
	    - Go to the text mode.  Insert text to the new file.
	This is my file.
	This is the second line.
	<Esc>
	    - Go to the command mode.
	:wq
	    - Save and quit vi.
You may use the command cat to display the contents of the file my_file4.
	cat my_file4
Try vi again to append a line to the file.
	vi my_file4
	j
	j
	  - Move cursor 2 lines down.
	a
	   - Go to the text mode.  Append text to the current position.
	This is the third line.
	<Esc>
	   - Go to the command mode.
	:wq
	   - Save and quit vi.
Use the command cat to display the contents of your file again:
	cat my_file4

5. Electronic Mail Services

When you log on the system, you may receive a message:
	You have new mail!!!
That means someone has sent you an e-mail (electronic mail). You can read your message and reply under the electronic mail services.

Read Mail

To read your e-mail, type
	mail
	   ...
	   messages
	   ...
	&
Note that the prompt of mail service is & instead of $. Type ? for help. To read message headers, type
	& h
Choose a message to read and enter its number.
	& 1
If it is a long mail, press spacebar to read the next page.

Send Mail

You can send a message to one or more persons at the same time. Just list the usernames after the command mail, type your subject and then the contents.
	mail person1 ... 
	mail person1@machine-name ... 
	mail person1@address ... 

Send internal mail

You can directly e-mail to local users of sci.hkbu.edu.hk domain without specifying any path information.

What follows is an example to send an e-mail to a student c0000001. Type the subject heading. Type the message body. Press to finish the mail and send a copy to another student c0000002.

	mail c0000001
	Subject:  testing
	It is a test on the mail service.
	 ...
	
	Cc: c0000002
Try to send an e-mail to yourself for exercise.

E-mail to Internet

For sending e-mail to an Internet machine, you have to specify the full mail address in your command line.

Send an e-mail to a person in Yale University.

	mail username@yale.edu

E-mail from other domains

Our full mail address is sci.hkbu.edu.hk.

If someone wants to send an e-mail to you, he should type

	mail username@sci.hkbu.edu.hk

Send a file

	mail person1 ... < file

Read message headers

Type h after the mail prompt to read message headers.
		& h
	  

Reply mail

Type r and the message number you want to reply. Reply the first message.

		& r 1

Finish Mail Service

Type q or <Ctrl d> to leave the mail service. Then, you will be returned to the $ prompt:
	& q

Redirect Mails from IBM to other machines

Create a file .forward and store the e-mail address where you want to redirect to.
	vi .forward
	i
	username%bc750.bitnet@yale.edu
	
	:wq
Or
	vi .forward
	i
	username@math.hkbu.edu.hk
	
	:wq
Or
	vi .forward
	i
	username@comp.hkbu.edu.hk
	
	:wq
A summary of mail Commands

	+              	Print the next message                     
	        	Print the next message                     
	-              	Print the previous message                 
	#              	Print the number of the current message    
	d              	Delete message                             
	dp             	Delete message & print the next one        
	dq             	Delete message & quit                      
	exit 		Exit the mail system and abandon the changing
	h              	Display headers of the current messages 
	m person       	Mail this message to person                
	p              	Print the current message again            
	q or <Ctrl d> 	Put undeleted mail back to /var/spool/mail 
	u N            	Undelete message N (N is the message no.)  
	r users        	Reply to users; then delete the message    
	s file         	Save the message to a file                 
	?              	Print summary of mail commands
Other e-mail software
	elm
	pine
We have two other popular e-mail software, elm and pine, downloaded from public domain site. You may like to try them as well

6. C Programming

cc and xlc (ansi-c) is the C compilers under the AIX system.

	cc [ options ] source-file...
	xlc [ options ] source-file...
To understand all the options, type
	cc 
or
	xlc 
Read the online manual for understanding the details.
	man cc
	man xlc
You can use any editor to prepare a program. Let us use the vi editor to write a program to print out a message "Hello!":
 
	vi source.c
	a
	  - Remember a is to append a file.
	#include 
	main()
	{
		printf("\nHello!\n"); 	
	}
	
	:wq
Compile your source program. An executable file a.out is produced if no output file name is specified.
	cc source.c
If you run the executable file a.out, a statement "Hello!" will be printed.
	a.out
The following commands compile the source program source.c to produce an executable program hello by -o option. Then, try to run the executable file hello.
  	cc -o hello source.c
Run hello, and a statement "Hello!" will then be printed on the screen.
	hello

7. Fortran

f77 and xlf (ansi-fortran) is the Fortran compilers under the AIX system.
	f77 [ options ] source-file...
	xlf [ options ] source-file...
To understand all the options, type
	f77
or
	xlf 
Read the online manual for understanding the details.
	man f77
	man xlf

8. FTP (File Transfer Protocol)

This is the Internet standard high-level protocol for transferring files from one computer to another.
  
	ftp somewhere.domain
	ftp ada.sci.hkbu.edu.hk
or	ftp sc11.sci.hkbu.edu.hk
At the ftp> prompt, you can type a number of commands.

ftp Commands

ftp> dir
	List current directory.

ftp> cd remote-directory
	Change remote working directory.

ftp> lcd local-directory
	Change local working directory.

ftp> get remote-file local-file
	Get a file from a remote computer to the local computer.

ftp> mget r*
	Get all files starting with "r", from remote to local. 

ftp> put local-file remote-file
	Put a file from the local computer to a remote computer.

ftp> mput l*
	Put all files starting with "l", from local to remote.

ftp> ascii
	Set file transfer to ASCII mode (default mode).  Only ASCII 
	characters will be transferred.

ftp> binary
	Set file transfer to binary.  All characters will be passed.

ftp> quit
	Exit from ftp service.

9. Modem

There are some modem lines served by ITSC. User may have to apply directly to ITSC for user account and password.
      3411 4933   
  1. Dial in one of the modem lines
  2. When user gets through, type in user name and password. Then a prompt similar to the following
    	BUCS05>
    
    may appear if you can connect to the terminal server.
  3. To know the hosts available, type
    	show hosts
    
    To read the help messages, type
    	help
    
  4. Type
            telnet sc11.sci.hkbu.edu.hk
    or      telnet sc12.sci.hkbu.edu.hk
            ...
            telnet sc26.sci.hkbu.edu.hk
    
    to connect to one of the 16 client workstations in room R735.
  5. Type exit to quit the AIX operating system. Type logout to quit the terminal server.

10. Terminal Settings

Terminal Type Descriptions

vt100 DEC vt100 text terminal.
PC terminal is always emulated to vt100 under telnet program.
lft lft is the default IBM text terminal.
xterm X windows terminal
aixterm AIXwindows terminal

Terminal Key Function Key Explanation
erase Ctrl-? Delete a character
kill Ctrl-u Delete a command line
werase Ctrl-w Delete a word
quit Ctrl-\ Quit
stop Ctrl-z Stop a process
resume Ctrl-q Resume a process
eof Ctrl-d End of file

Change Terminal Settings

Set the character erase key to <Backspace>. Type
	stty erase <Backspace>
Set the word erase key to <Del>. Type
	stty werase <Del>