CREATING SYMBOLIC LINKS
A
symbolic link contains no data of its own, points to another file. It
can even contain a reference to a directory. Accessing a symbolic link
is the same as accessing the file. Any updates to the file will be
reflected on to the symbolic link. When the file, the symbolic links
points to is removed the symbolic link will flash in red i.e, its
broken. A broken link is when the host file does not exist.
ATTENTION:work in your $HOME for this exercise
|
|
<bash> ln -s ~/.bashrc bashrc
|
create a link to the
.bashrc file in your $HOME
|
<bash> ls -Fl bashrc
|
view the path of the
symbolic link
|
<bash> ln -s /lockers/aero170 ash
|
create a symbolic
link to /lockers/aero170 and call it ash
|
<bash> ls -Fl ash/
|
see how ash/ pts to
/lockers/aero170
|
<bash> ln -s /afshome/joeusr
hdrive
|
create a symbolic
link to your vincent account
|
<bash> ls -Fl hdrive
|
check the link if it
works
|
<bash>ln -s
/remote/scratch/joeusr scratch
|
create a symbolic
link to your scratch space
|
<bash>file scratch
|
use the file command
to see what type of filesystem scratch is
|
<bash>du -s
|
|
<bash>man ln
|
SSH AND SCP EXERCISE
There comes a time when the user will need to login remotely to a
machine that is a server or for those of you who "dare to code" will
log into a super-computer. Remote servers are machines located in some
other physical location and to use them one needs to ssh into them.
"ssh" is a secure shell login and knowing how to operate into a remote
machines has many advantages. In aero461 you will be subjected to
compute intensive projects which will take hours if not days to
compute. Knowing how to ssh into a compute box and submitting jobs will
be a great benefit and will not encumber others who wish to use a
workstation. Using remote machines also compels you as a user to be
principled and disciplined. Do not leave a job running which you do not
intend to. Use the services wisely and responsibly.
Knowledge is
power in its most pure and sublime form: use it wisely or perish!
Here are the following commands we will practice
- ssh -l username machine.hostname
- scp
username@machine.hostname:~/path/file file
- scp
file username@whopper.eng.edu:~/path/file
- nohup
- nice
ssh
|
|
<bash>ssh -l
joeusr mercury.aere.iastate.edu
|
ssh into machine
mercury.aere.iastate.edu
|
<bash>hostname
|
check the hostname
of the machine
|
<bash>uname -a
|
check the
architecture and operating system of the machine you have ssh'd into
- Linux
h442841.aere.iastate.edu 2.4.21-20.ELsmp #1 SMP Wed Aug 18 20:46:40 EDT
2004 i686 i686 i386 GNU/Linux
|
<bash>exit
|
exit from the remote
machine
|
<bash>ssh
-l joeusr whopper.eng.iastate.edu
|
ssh
into the machine called whopper
|
| <bash>hostname |
re-check its hostname
|
<bash>uname -a
|
check its OS type
- SunOS
whopper.eng.iastate.edu 5.9 Generic_112233-05 sun4u sparc
SUNW,Sun-Fire-480R
|
scp (secure shell copy)
|
|
INSTRUCTION
|
Create a directory
called scp in your scratch
directory. You should have created a symbolic link to scratch prior to this section of
exercises
- <bash>
cd ~
- <bash>
ln -s /remote/scratch/joeusr scratch
- <bash>
mkdir ~/scratch/scp
|
To put
files from host machine into remote machine
|
<bash>scp .bashrc joeusr@mercury.aere.iastate.edu:~/scratch/scp/file_put
|
To get files from
remote machine into host machine
|
<bash>scp
joeusr@earth.aere.iastate.edu:~/scratch/scp/file_put file_get |
RUNNING
CODES ON REMOTE MACHINES
Optimization codes run for a long time and waiting for them while
logged in is a waste of time. The idea is to submit the code and log
out and come back when its done. Job submission requires you to
be responisble and not abuse this service:
sending 20 jobs is not a
good idea and this service can be discontinued if a user abuses it. You
need to remember that others are using these machines too (grad
students are never aware of this reality)!
- If you are writing data to the screen, but do not
care much for it then you should "standard output" it into the /dev/null filter so
that
it does not take up space.
- If the screen output is required then you need to standard output the file to a file.
For iterative schemes this file
can fill up and exceed your quota
and then you will not be able to log
in. Take the following necessary steps:
- send the data to the file which resides in either
- /remote/scratch/joesuser
- /remote/aere/joeuser
- If the screen output is too big and may cause
disk space problems, but required then the data should be sent to
- /tmp
- And when no longer required removed from the
hard drive space in /tmp/
The "nice" option
<OPTIONAL, NOT REQUIRED for whopper and aere machines>
Using the nice command:
ADJUST is 10 by default.
Range
- goes from -20 (highest priority) to 19 (lowest).
- the default is set to 10 so that others can do work
on the machine while your "hog" of a code is rampaging through the
system.
Optimization
flags to Compile
the code with:
Always
compile and link the production code without the -g option :
Use
the -O2 or -O3 flags for
speed up. Use -O2 and check to see if the answer is good. I
recommend using -O2 flag and not -O3 flag. Severe optimization can
affect the results. Never run a large production code with the
-g flag:
it will be slow.
Running the code
Write
this small code in the src/ directory compile it and create the
executable in the bin/ directory. The code to use is given below.
| Do
not copy and paste (you are not a freshman!); code it! |
- <bash>ifc
-w -O2 main.f90 -o ../bin/code.x
|
program main
implicit none
integer,parameter::dp=8
integer,parameter::n=2000
integer,parameter::m=200
integer,parameter::l=200
integer :: i,j,k,ii
real(kind=dp),dimension(1:n,1:m,1:l):: x,y,z ! locally defined explicit shape array from
! parameters defined.
do ii = 1,n
do k = 1,l
do j=1,m
do i=1,n
x(i,j,k)=float(i)*float(j)*float(k)
y(i,j,k)=float(i)*float(j)*float(k)
z(i,j,k)=float(i)*float(j)*float(k)
write(6,'(3f30.16,1x)')x(i,j,k), y(i,j,k),z(i,j,k)
enddo
enddo
enddo
enddo
end program main
SENDING DATA TO
OBLIVION
- <bash>ssh
-l username mercury.aere.iastate.edu
- <bash>cd
into the dir containing the executable
- <bash>nohup nice -10 ./code.x > /dev/null &
- <bash>exit
logout from the machine and then log back in and use the "top" command
to see if code.x is using the cpu resources. Then kill the process
- <bash>ssh
-l username mercury.aere.iastate.edu
- <bash>top
- <bash>kill
#pid
ATTENTION:
make sure you have killed all the code.x codes/code running in the
remote machines.