Work @ CCT

Thursday, September 6, 2007

Movies with shrimps

Today I've finally succeeded compiling Cactus with HDF5. I have the simulation running on numrel03 and by tomorrow morning I should have the h5 files.

You can see the last movie I made - the one with the reduced color range for the water here:
http://www.cct.lsu.edu/~elena/ShrimpsBiomass.gif
I'll try to play a little bit more with the range, because I want to see more colors.

Past movies:
This has the range varying (initially is from -140 to 20). In terms of coloring is more beautiful than ShrimpsBiomass.gif: http://www.cct.lsu.edu/~elena/masura.gif
This is just with the biomass - no water/land: http://www.cct.lsu.edu/~elena/biomass_new.gif

*** command
screen - to open another terminal in the terminal
screen -x -to see the opened terminals or to log into the only one opened

Tuesday, May 29, 2007

How to create movies from 2D data

1. How to create individual frames from 2D data
Using a perl script and gnuplot, generate the individual frames with the command:

./count.pl | gnuplot

(the gnuplot version recommended is 4.2; it seems that the previous versions do not support png format).

This is the perl script "count.pl" we used:

#! /usr/bin/perl -w

use strict;

my $itlast = 364;
javascript:void(0)
print "set pm3d map\n";
print "set size ratio -1\n";
print "set cbrange [0:1]\n";
print "set terminal png\n";
print "set title 'Shrimp Biomass'\n";
for (my $iter = 1; $iter <= $itlast; ++ $iter) {
printf "set output 'bmnew.%04d.png'\n", $iter;
printf "splot 'bmnew_2D.asc' index $iter\n";
}

The above script is for generating a frame for each day for the total cohort of 4.000.000 shrimps.

2. How to combine individual frames into a movie
- first, convert the png into tiff; there are two ways to do it: either use mogrify ( mogrify -format tiff *.png ), or convert.
- second, combine the frames into a movie called shrimp.mpg:
ffmpeg -f mpeg2video -pass 1/2 -b 20M -i bmnew.0%d.tiff shrimp.mpg

The small movie shrimp.mpg is ready to be visualized!
Enjoy it at www.cct.lsu.edu/~elena/index/shrimp.mpg or as a small gif file at www.cct.lsu.edu/~elena/biomass_new.gif

Tuesday, May 1, 2007

Useful commands for work with references

* look for the keyword and performance in the Cactus.bib file.
grep keyword Cactus.bib | grep performance


* count how many times the word performance given as a keyword appears in the bibtex file
grep keyword Cactus.bib | grep performance | wc -l

* sort a bibtex file for Performance papers (the keyword for these is performance) and pipe the result into a new file Performance bib:
bibgrep keyword:performance Cactus.bib > Performance.bib


* list the entries by year in descending order:
./bibtex2html -r -d Performance.bib

Wednesday, April 4, 2007

Variables made parameters in Cactus

1. Remove the declaration of the variable

2. In the param.ccl from ~/Cactus/arrangements/CactusShrimp/Shrimp/ declare the variables you want to make as Cactus parameters

i.e.

PRIVATE:
( !!Access level)

INT endday "The last day of the simulation or the number of days"
(!!The parameter type and name)

{
1:365::"range for the endday"
(!! The range or the allowed values)

} 80
(!!default value)

3. In the parameter file specify the value of the variable (~/Cactus/exe/shrimp.par):

i.e. - add this line:
Shrimp::endday=12

4. In the main file ( inside the code) :

- include the following library:
#include "cctk_Parameters.h"

- in the subroutines where the variable is used, add:
DECLARE_CCTK_PARAMETERS
(that would be after the implicit none)

Tuesday, April 3, 2007

Integrating the Shrimp code into Cactus

1. Download Cactus

-download the script that is used to checkout Cactus:
wget http://www.cactuscode.org/download/GetCactus

-change the permision:
chmod 755 GetCactus

-execute:
./GetCactus

--------------------------------------------------------------------

Directory for Cactus installation [Cactus] :

Anonymous Flesh checkout? (y)es, n)o, h)elp) [yes] : yes

Checkout Flesh from
[1] Last stable release
[2] Standard development version (bug fixes/unstable)
Choose version: (1-2, h)elp, q)uit) [1] : 1


Verbose checkout (y)es, n)o, h)elp) [no] : no

--------------------------------------------------------------------

2. Create a new thorn

cd Cactus

gmake newthorn

________________________________________________________________________
Creating a new thorn
Thorn name
--> Shrimp

The following arrangements are available:
Pick one, or create a new one.
arrangement
--> CactusShrimp

Thorn Author Name
--> Elena C.

Email Address
--> elena@cct.lsu.edu

Add another author? Y/N
--> n

Creating new arrangement CactusShrimp
Creating thorn Shrimp in CactusShrimp
All done.
Please remember to fill out the README and doc/documentation.tex files.
________________________________________________________________________


- copy the shrimp files in the "src" directory and rename the file with the code from .f90 to .F90
- finally, these files should be in src:

Bolivar2003.prn fineelmtrim.txt make.code.defn
CBelevations.prn GITemps2003.txt Shrimp_02_08_07_clean_UNIX.F90
EGelevations.prn Grand Isle 2003.txt var1.i

Note:
- the difference between the extensions .f90 and .F90 is about the "no preprocessing" Fortran 90 free form
- the file has to be rename, otherwise later there will be problems

3. Prepare the F90 file for compilation

- we choose to integrate into Cactus the optmized/tuned version of the shrimp code

- here are the changes we made in order to put into Cactus:

-#include "cctk.h"
-#include "cctk_Arguments.h"
!! including the necessary libraries

!!make the main program a subroutine:
-subroutine Shrimp_main(CCTK_ARGUMENTS)
- implicit none
-
- DECLARE_CCTK_ARGUMENTS

!! and don't forget to close the subroutine instead of the program;
-end subroutine Shrimp_main-

!! change all the INCLUDE 'name' to #include "name"
i.e.
-#include "var1.i"



4. Modify make.code.defn from Cactus/arrangements/CactusShrimp/Shrimp/src/

# Main make.code.defn file for thorn Shrimp
# $Header$

# Source files in this directory
SRCS = Shrimp_02_08_07_clean_UNIX.F90

# Subdirectories containing source files
SUBDIRS =



5. Modify the schedule.ccl from Cactus/arrangements/CactusShrimp/Shrimp/

# Schedule definitions for thorn Shrimp
# $Header$

SCHEDULE Shrimp_main AT EVOL
{
LANG: FORTRAN
} "Main function of the Shrimp code"


6. Modify the interface.ccl to

# Interface definition for thorn Shrimp
# $Header$

implements: Shrimp #name of the thorn
inherits:

7. Create a file with the thorns to be used in the compilation

cd ~/Cactus/
vim file

-in our case, the file contains only CactusShrimp/Shrimp
i.e.
less file
CactusShrimp/Shrimp

8. Use an option file for compilation (i.e. the options-numrel-intel file from Enrique)

9. Compile the code

gmake shrimp_conf-config THORNLIST=file options=options-numrel-intel

10. You should have the following message returned at the end :

________________________________________________________________________
All done !
________________________________________________________________________


11. Create a parameter file in Cactus/exe

less shrimp.par
ActiveThorns="Shrimp"
Cactus::cctk_itlast = 80

12. This is important and it might be omitted.

- the external files used by the code should be inside the exe directory as well.
- therefore the following should be there:

Bolivar2003.prn checkhab.out GITemps2003.txt var1.i
cactus_shrimp_conf EGelevations.prn Grand Isle 2003.txt
CBelevations.prn fineelmtrim.txt shrimp.par


13. From inside the exe directory run the code:

- cactus_shrimp_conf should be there

mpirun -np 1 cactus_shrimp_conf shrimp.par

Enjoy!!!

Monday, March 5, 2007

Profiling

Profiling a Fortran code:

990 ifort -o Shrimp.out Shrimp_02_08_07_clean_UNIX.f90 -O3 -pg
991 ./Shrimp.out
992 gprof Shrimp.out > Shrimp.gprof

Friday, December 29, 2006

Problems with Fortran compiler on Darwin and othe bench stuff...

Today I had problems with compiling the Cactus benchmark on a Darwin machine.

Something useful I found on the CactusCode Developer's list:
http://www.cactuscode.org/pipermail/users/2005-March/001391.html

-off-topic:Someone sent me today this link:
http://www.dilbert.com/comics/dilbert/archive/images/dilbert2006152711228.gif

Here I have my final gnuplot script:

#This script contains the commands to generate the plot for the BSSN_PUGH benchmark results.

#This is the dataset we used and which goes in BSSN_PUGH_100l.dat
#machine wall time #processors
#Bassi_sp 567.268 1
#numrel02 728.128 1
#catbert 853.416 1
#xws2 965.440 1
#santaka 1140.422 1
#helix2 1436.51 1


#Set the range for the axes
set xrange [-0.5:6]
set yrange [0:1500]

#Set the width of the boxes for the histogram
set boxwidth 0.15 absolute
set style fill solid 1.00 border -1

#Set the labels on the x axis and rotate them
set xtics ("Bassi" 0.00000, "numrel02" 1.0000, "catbert" 2.00000, "xws2" 3.00000, "santaka" 4.00000, "helix2" 5.00000)
#set xtics rotate by -45
plot "BSSN_PUGH_100l.dat" u :2 w boxes

#Set the title and the axes labels
set title "Wall Time Comparison for Different Machines"
set ylabel "Wall Time in Seconds"
set xlabel "Machine and Architecture"

#Plot the graph and save the output to a file
plot "BSSN_PUGH_100l.dat" u :2 w boxes
set terminal png color small
set output "BSSN_PUGH_100l.png"
plot "BSSN_PUGH_100l.dat" u :2 w boxes


...I finished the Presentation web page. Now it looks really nice. I uploaded the .bib, -bib.html and the .html files.
Here is the link... but I don't know if it's working for those that don't have an account:
http://www.cactuscode.org/Documentation/Presentations/

I also made the News item that I owed to Gab and Tom Goodale about the BSSN_PUGH scaling on BGW.
http://www.cactuscode.org/News/bssnpughonbgw
For this I had an Excel file and (Excel) graph, but I wrote a gnuplot script for this too, to plot the scaling results.

Today I also cleaned the KrancLatex CVS. It took me more than one hour... but I'm done for this year ... or at least for this payperiod.

Things to do:
-ask Peter or Yaakoub or the cactusmain group about Nemeaux and/or greengrass
-find if there is any repository for Presentations, if not create one
-convert the sdd into pdf
-eventually upload the ppts and the sdds.
-figure out how to label with bullets instead of numbers
-do the same things for Bench_whisky_Carpet, as for Bench_BSSN_PUGH

Labels: , , , , ,