lab11


ATTENTION for latex practice!

create a lab11 directory  and in it create the following two sub-directories in recursive mode (assuming you will also create src bin and iof dirs !!)
  • <bash> mkdir -p report_practice/figures
  • Download or export all eps files from tecplot into the figures/ directory.
  • Create the sample report for the figures practice in the report_practice/ directory
  • You can use kile!

CHECKING DISK USAGE FOR USER AND SYSTEM

By now all users should be aware of the disk space they have consumed. By default 200Meg of disk space is allocated to a user. If the user overflows the allocated disk space then logging and basic writing and saving to file will not work. The system hard drive also has a disk space and checking that is also useful if you have your own machine and want to know how much space is left in the hard drive. Follow the exercises below to understand how to use the commands. When large data files need to stored or written to file it is wise to write them to the following directories that have large disk space, but are not backed up
  1. /remote/aere/joeusr
  2. /remote/scratch/joeusr
where joeusr is your username. If its the 1st time the user is accessing the scratch space then he/she may have to make a directory in scratch
  • <bash> mkdir /remote/scratch/joeuser

command
description
description
<bash> man du
see man pages for the du command and the proper options

<bash> quota -v
current disk usage in the eng account
total disk usage
<bash> du -sh aero361/
current usage by directory aero361/ shown in human readable form (megabytes)
shown in Megabytes
<bash> du -h aero361/
current usage by items in directory aero361/ shown in human readable form (megabytes)
shown in Megabytes
<bash>du -ks aero361/
current usage by directory aero361/ shown in readable form (kbytes) shown in kbytes
<bash>du -k aero361/
current usage by items in directory aero361/ shown in readable form (kbytes) shown in kbytes
<bash>df
the current disk usage in system hard drive and remote serves


GETTING MAPLE TO EXPORT IN LATEX

To get maple to export a latex file of your work the user needs to download certain sty and def files for maple/latex interface into the user's texmf dir. Follow the instructions below and you will have pretty outputs of your maple worksheet in latex form!!
ATTENTION: YOU ARE NOT TO USE MAPLE, ONLY SET IT UP FOR LATEX EXPORT
<bash>cd ~/texmf/tex/latex
cd into the texmf directory and then into the subdirectory that contains all the style, definition and class files.
  • ATTENTION If you do not have a texmf directory then you need to create one. Type the following commands in a shell
    • <bash> cd
    • <bash> mkdir -p texmf/tex/latex
SPECIAL cp command
<bash> cp /usr/local/maple9.5/etc/* .
while in the above dir use the cp command to snatch the items from /usr/local/maple9.5/etc/. To copy item this way you need the period at the end of the command as shown in the left column
<bash> cd ~/texmf/
<bash> mv ls-R ls-R.old
<bash> texhash
  1. Now cd back to just the ~/texmf dir
  2. Rename the present ls-R file as ls-R.old
  3. Recreate the ls-R file by typing texhash at the command prompt

To compile, view and create the latex file into a "ps" file for printing

<bash>latex file.tex
The exported file needs to be compiled. When it compiles it will create a dvi file
<bash>xdvi file.dvi
To view the dvi file
<bash>dvips -f file.dvi > file.ps
Create the postscript file
<bash>lpr file.ps
print the postscript file

USING THE CONVERT UTILITY TO MANIPULATE IMAGE TYPES

The unix "convert" can be used to manipulate the image format from one type to another. The $USER can convert a .ps file to .png file using the "convert command.

Using tecplot bring up a plot for an airfoil in a layout.
Play with the layout to customize to your professional taste
Export the figure in .eps and jpg formats
Go to the directory where the image is located and use the convert command to change it to a pdf format
  • <bash>convert file.eps file.pdf
  • <bash>convert file.eps file.gif
  • <bash>convert file.eps file.jpg
  • <bash>gimp
    • Use gimp to view the files

Check other options in convert and try them
  • <bash> convert --help


ACCESSING THE VINCENT AFS DIRECTORY AND CREATING SYMBOLIC LINKS

The vincent afs/ directory is mounted on all CLUE linux systems. The afs directory is located at /afshome/joeusr. The $USER can access this directory and use it for work just like any other directory in /home/joeusr.
  • <bash> cd /afshome/joeusr
    • create an alias called acropolis that will take you straight to the afshome dir
alias acropolis="cd /afshome/$USER"
  • <bash>acropolis

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
  1. ssh -l username machine.hostname
  2. scp username@machine.hostname:~/path/file file
  3. scp  file username@whopper.eng.edu:~/path/file
  4. nohup
  5. 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.


PRACTICE IMPORTING FIGURES AND MANIPULATING THEIR POSITION AND SIZE IN LATEX


For the rest of the lab period bring up kile, create a generic report stencil from kile and import some figures to get a handle on how to use them in panel report. Get comfortable with kile and some of its advanced features too!
Quick reference for figures in latex :

Insert usepackage{graphicx,rotating,subfigure} in main.tex
  • Importing a figure that is scaled to the width of the page
\begin{figure}[h!tb]
            \centering   
            \includegraphics[width = \textwidth]{FIGURE.EPS}
            \caption{Zonal meshing around the scramjet}
            \label{model_intro}
\end{figure}
  • Importing and scaling the figure
\begin{figure}[h!tb] 
\centering
\scalebox{.7}{\includegraphics{FIGURE.EPS}}
\caption{Zonal meshing around the scramjet}
\label{model_intro}
\end{figure}
  • Importing - scaling and rotating the figure
\begin{figure}[h!tb]
\centering
\includegraphics [scale=0.4,angle=-90]{graph1.eps}
\caption{2nd Order Theta for Case 1 and 2}
\label{Figure1}
\end{figure}
  • 2 figures a and b one below the other

\begin{figure}[h!tb]
\centering
\label{name}
        \subfigure [Initial grid with 13 points in linear distribution   ]
            {\includegraphics[angle=0,scale=0.8] {FIGURE1.eps}} 
       
        \subfigure [Initial grid with 14 points in linear distribution ]
            {\includegraphics[angle=0,scale=0.8] {FIGURE2.eps}} 
\isucaption { details regarding the plots}
\label{name}           
\end{figure}