[Swift-commit] r3907 - in text/parco10submission: . code
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Sat Jan 8 16:42:43 CST 2011
Author: wilde
Date: 2011-01-08 16:42:43 -0600 (Sat, 08 Jan 2011)
New Revision: 3907
Added:
text/parco10submission/code/
text/parco10submission/code/glass.swift
text/parco10submission/code/glassRunCavities.swift.ORIG
text/parco10submission/code/modis.swift
Modified:
text/parco10submission/paper.tex
Log:
Moved example scripts to a code/ dir and include them from \InputVerbatim directives.
Added: text/parco10submission/code/glass.swift
===================================================================
--- text/parco10submission/code/glass.swift (rev 0)
+++ text/parco10submission/code/glass.swift 2011-01-08 22:42:43 UTC (rev 3907)
@@ -0,0 +1,82 @@
+type Arc;
+type Restart;
+type Log;
+
+type GlassIn{
+ Restart startfile;
+}
+
+type GlassOut{
+ Arc arcfile;
+ Restart restartfile;
+ Restart startfile;
+ Restart final;
+ Log logfile;
+}
+
+app (GlassOut o) glassCavityRun(
+ GlassIn i, string rad, string temp, string steps,
+ string volume, string fraca, string energyfunction,
+ string centerstring, string arctimestring)
+{
+ glassRun "-a" @filename(o.final) "--lf" @filename(i.startfile)
+ "--temp" temp "--stepsperparticle" steps "--volume" volume
+ "--fraca" fraca "--energy_function" energyfunction
+ "--cradius" rad "--ccoord" centerstring arctimestring
+ stdout=@filename(o.logfile);
+}
+
+CreateGlassSystem()
+{
+ string temp=@arg("temp","2.0");
+ string steps=@arg("steps","10");
+ string esteps=@arg("esteps","100");
+ string ceqsteps=@arg("ceqsteps","100");
+ string natoms=@arg("natoms","200");
+ string volume=@arg("volume","200");
+ string rlist=@arg("rlist","rlist");
+ string clist=@arg("clist","clist");
+ string fraca=@arg("fraca","0.5");
+ string radii[] = readData(rlist);
+ string centers[] = readData(clist);
+ int nmodels=@toint( @arg("n","1") );
+ int nsub=@toint( @arg("nsub","1") );
+ string savearc=@arg("savearc","FALSE");
+ string arctimestring;
+ if(savearc=="FALSE") {
+ arctimestring="--arc_time=10000000";
+ }
+ else{
+ arctimestring="";
+ }
+ string energyfunction=@arg("energyfunction","softsphereratiosmooth");
+
+ GlassIn modelIn[][][] <ext;exec="GlassCavityOutArray.map",
+ rlist=rlist, clist=clist, steps=ceqsteps, n=nmodels,
+ esteps=esteps, temp=temp, volume=volume,
+ e=energyfunction, natoms=natoms, i="true">;
+ GlassOut modelOut[][][][] <ext; exec="GlassCavityContinueOutArray.map",
+ n=nmodels, nsub=nsub, rlist=rlist, clist=clist,
+ ceqsteps=ceqsteps, esteps=esteps, steps=steps, temp=temp, volume=volume,
+ e=energyfunction, natoms=natoms>;
+
+ foreach rad,rindex in radii {
+ foreach centerstring,cindex in centers {
+ foreach model in [0:nmodels-1] {
+ foreach job in [0:nsub-1] {
+ string fname =
+ @filename(modelOut[rindex][cindex][model][job].final)
+ if (fname != "NULL") {
+ modelOut[rindex][cindex][model][job] =
+ glassCavityRun( modelIn[rindex][cindex][model],
+ rad, temp, steps, volume, fraca, energyfunction,
+ centerstring, arctimestring);
+ }
+ }
+ }
+ }
+ }
+}
+
+
+CreateGlassSystem();
Added: text/parco10submission/code/glassRunCavities.swift.ORIG
===================================================================
--- text/parco10submission/code/glassRunCavities.swift.ORIG (rev 0)
+++ text/parco10submission/code/glassRunCavities.swift.ORIG 2011-01-08 22:42:43 UTC (rev 3907)
@@ -0,0 +1,120 @@
+type file;
+type Text;
+
+type Arc;
+type Restart;
+type Log;
+
+type GlassOut{
+ Arc arcfile;
+ Restart restartfile;
+ Restart startfile;
+ Restart final;
+ Log logfile;
+}
+
+type GlassIn{
+ Restart startfile;
+}
+
+// Lib functions (to be moved to imported file
+
+app (file o) echoi (int i) { echo i stdout=@o;}
+app (file o) echof (float f) { echo f stdout=@o;}
+app (file o) echob (boolean b) { echo b stdout=@o;}
+app (file o) echos (string s) { echo s stdout=@o;}
+
+(string s) itostr (int i)
+{
+ file f;
+ f = echoi(i);
+ s = readData(f);
+}
+
+(string s) ftostr (float n)
+{
+ file f;
+ f = echof(n);
+ s = readData(f);
+}
+
+(int n) strtoi (string s)
+{
+ file f;
+ f = echos(s);
+ n = readData(f);
+}
+
+(float n) strtof (string s)
+{
+ file f;
+ f = echos(s);
+ n = readData(f);
+}
+
+app (file o) sprintfsApp (string fmt, string e[])
+{
+ sprintfs fmt e stdout=@o;
+}
+
+(string s) sprintfs (string fmt, string e[])
+{
+ file f;
+ f = sprintfsApp(fmt,e);
+ s = readData(f);
+}
+
+//glassSim app declarations
+//app (int result) multiply(int a,int b)
+//{
+// file f;
+// multiply a b stdout=@filename(f);
+// result=readData(f);
+//}
+
+app (GlassOut o) glassCavityRun(GlassIn i,string rad,string temp,string steps,string volume,string fraca,string energyfunction,string centerstring,string arctimestring)
+{
+ glassRun "-a" @filename(o.final) "--lf" @filename(i.startfile) "--temp" temp "--stepsperparticle" steps "--volume" volume "--fraca" fraca "--energy_function" energyfunction "--cradius" rad "--ccoord" centerstring arctimestring stdout=@filename(o.logfile);
+}
+
+CreateGlassSystem()
+{
+ string temp=@arg("temp","2.0");
+ string steps=@arg("steps","10");
+ string esteps=@arg("esteps","100");
+ string ceqsteps=@arg("ceqsteps","100");
+ string natoms=@arg("natoms","200");
+ string volume=@arg("volume","200");
+ string rlist=@arg("rlist","rlist");
+ string clist=@arg("clist","clist");
+ string fraca=@arg("fraca","0.5");
+ string radii[] = readData(rlist);
+ string centers[] = readData(clist);
+ int nmodels=strtoi( @arg("n","1") );
+ int nsub=strtoi( @arg("nsub","1") );
+// int njobs=nsub*nmodels;
+ string savearc=@arg("savearc","FALSE");
+ string arctimestring;
+ if(savearc=="FALSE") {
+ arctimestring="--arc_time=10000000";
+ }
+ else{
+ arctimestring="";
+ }
+ string energyfunction=@arg("energyfunction","softsphereratiosmooth");
+ GlassIn modelIn[][][] <ext;exec="GlassCavityOutArray.map",rlist=rlist,clist=clist,steps=ceqsteps,n=nmodels,esteps=esteps,temp=temp,volume=volume,e=energyfunction,natoms=natoms,i="true">;
+ GlassOut modelOut[][][][] <ext;exec="GlassCavityContinueOutArray.map",n=nmodels,nsub=nsub,rlist=rlist,clist=clist,ceqsteps=ceqsteps,esteps=esteps,steps=steps,temp=temp,volume=volume,e=energyfunction,natoms=natoms>;
+ foreach rad,rindex in radii {
+ foreach centerstring,cindex in centers {
+ foreach model in [0:nmodels-1] {
+ foreach job in [0:nsub-1] {
+ if( !(@filename(modelOut[rindex][cindex][model][job].final)=="NULL") ){
+ modelOut[rindex][cindex][model][job]=glassCavityRun(modelIn[rindex][cindex][model],rad,temp,steps,volume,fraca,energyfunction,centerstring,arctimestring);
+ }
+ }
+ }
+ }
+ }
+}
+
+CreateGlassSystem();
Added: text/parco10submission/code/modis.swift
===================================================================
--- text/parco10submission/code/modis.swift (rev 0)
+++ text/parco10submission/code/modis.swift 2011-01-08 22:42:43 UTC (rev 3907)
@@ -0,0 +1,84 @@
+type file;
+type MODIS; type image;
+type landuse;
+
+# Define application program interfaces
+
+app (landuse output) getLandUse (imagefile input, int sortfield)
+{
+ getlanduse @input sortfield stdout=@output ;
+}
+
+app (file output, file tilelist) analyzeLandUse
+ (MODIS input[], string usetype, int maxnum)
+{
+ analyzelanduse @output @tilelist usetype maxnum @filenames(input);
+}
+
+app (image output) colorMODIS (MODIS input)
+{
+ colormodis @input @output;
+}
+
+app (image output) assemble
+ (file selected, image img[], string webdir)
+{
+ assemble @output @selected @filename(img[0]) webdir;
+}
+
+app (image grid) markMap (file tilelist)
+{
+ markmap @tilelist @grid;
+}
+
+# Constants and command line arguments
+
+int nFiles = @toint(@arg("nfiles","1000"));
+int nSelect = @toint(@arg("nselect","12"));
+string landType = @arg("landtype","urban");
+string runID = @arg("runid","modis-run");
+string MODISdir= @arg("modisdir","/home/wilde/bigdata/data/modis/2002");
+string webDir = @arg("webdir","/home/wilde/public_html/geo/");
+
+
+
+# Input Dataset
+
+image geos[] <ext; exec="modis.mapper",
+ location=MODISdir, suffix=".tif", n=nFiles >;
+
+# Compute the land use summary of each MODIS tile
+
+landuse land[] <structured_regexp_mapper; source=geos, match="(h..v..)",
+ transform=@strcat(runID,"/\\1.landuse.byfreq")>;
+
+foreach g,i in geos {
+ land[i] = getLandUse(g,1);
+}
+
+# Find the top N tiles (by total area of selected landuse types)
+
+file topSelected<"topselected.txt">;
+file selectedTiles<"selectedtiles.txt">;
+(topSelected, selectedTiles) = analyzeLandUse(land, landType, nSelect);
+
+# Mark the top N tiles on a sinusoidal gridded map
+
+image gridMap<"markedGrid.gif">;
+gridMap = markMap(topSelected);
+
+# Create multi-color images for all tiles
+
+image colorImage[] <structured_regexp_mapper;
+ source=geos, match="(h..v..)",
+ transform="landuse/\\1.color.png">;
+
+foreach g, i in geos {
+ colorImage[i] = colorMODIS(g);
+}
+
+# Assemble a montage of the top selected areas
+
+image montage <single_file_mapper; file=@strcat(runID,"/","map.png") >; # @arg
+montage = assemble(selectedTiles,colorImage,webDir);
+
Modified: text/parco10submission/paper.tex
===================================================================
--- text/parco10submission/paper.tex 2011-01-08 22:10:00 UTC (rev 3906)
+++ text/parco10submission/paper.tex 2011-01-08 22:42:43 UTC (rev 3907)
@@ -1286,92 +1286,9 @@
\pagebreak
{\bf \small Swift example 1: MODIS satellite image processing script}
-\begin{Verbatim}[fontsize=\scriptsize,frame=single,framesep=2mm,gobble=7, numbers=left]
- 1 type file;
- 2 type MODIS; type image;
- 3 type landuse;
- 4
- 5 # Define application program interfaces
- 6
- 7 app (landuse output) getLandUse (imagefile input, int sortfield)
- 8 {
- 9 getlanduse @input sortfield stdout=@output ;
- 10 }
- 11
- 12 app (file output, file tilelist) analyzeLandUse
- 13 (MODIS input[], string usetype, int maxnum)
- 14 {
- 15 analyzelanduse @output @tilelist usetype maxnum @filenames(input);
- 16 }
- 17
- 18 app (image output) colorMODIS (MODIS input)
- 19 {
- 20 colormodis @input @output;
- 21 }
- 22
- 23 app (image output) assemble
- 24 (file selected, image img[], string webdir)
- 25 {
- 26 assemble @output @selected @filename(img[0]) webdir;
- 27 }
- 28
- 29 app (image grid) markMap (file tilelist)
- 30 {
- 31 markmap @tilelist @grid;
- 32 }
- 33
- 34 # Constants and command line arguments
- 35
- 36 int nFiles = @toint(@arg("nfiles","1000"));
- 37 int nSelect = @toint(@arg("nselect","12"));
- 38 string landType = @arg("landtype","urban");
- 39 string runID = @arg("runid","modis-run");
- 40 string MODISdir= @arg("modisdir","/home/wilde/bigdata/data/modis/2002");
- 41 string webDir = @arg("webdir","/home/wilde/public_html/geo/");
- 42
- 43
- 44
- 45 # Input Dataset
- 46
- 47 image geos[] <ext; exec="modis.mapper",
- 48 location=MODISdir, suffix=".tif", n=nFiles >;
- 49
- 50 # Compute the land use summary of each MODIS tile
- 51
- 52 landuse land[] <structured_regexp_mapper; source=geos, match="(h..v..)",
- 53 transform=@strcat(runID,"/\\1.landuse.byfreq")>;
- 54
- 55 foreach g,i in geos {
- 56 land[i] = getLandUse(g,1);
- 57 }
- 58
- 59 # Find the top N tiles (by total area of selected landuse types)
- 60
- 61 file topSelected<"topselected.txt">;
- 62 file selectedTiles<"selectedtiles.txt">;
- 63 (topSelected, selectedTiles) = analyzeLandUse(land, landType, nSelect);
- 64
- 65 # Mark the top N tiles on a sinusoidal gridded map
- 66
- 67 image gridMap<"markedGrid.gif">;
- 68 gridMap = markMap(topSelected);
- 69
- 70 # Create multi-color images for all tiles
- 71
- 72 image colorImage[] <structured_regexp_mapper;
- 73 source=geos, match="(h..v..)",
- 74 transform="landuse/\\1.color.png">;
- 75
- 76 foreach g, i in geos {
- 77 colorImage[i] = colorMODIS(g);
- 78 }
- 79
- 80 # Assemble a montage of the top selected areas
- 81
- 82 image montage <single_file_mapper; file=@strcat(runID,"/","map.png") >; # @arg
- 83 montage = assemble(selectedTiles,colorImage,webDir);
-
-\end{Verbatim}
+\VerbatimInput[fontsize=\scriptsize,frame=single,framesep=2mm, numbers=left] {code/modis.swift}
+%\VerbatimInput [fontsize=\scriptsize,frame=single,framesep=2mm,gobble=7, numbers=left]{modis.swift}
+%\end{Verbatim}
%\end{verbatim}
\subsection{Simulation of glass cavity dynamics and thermodynamics.}
@@ -1410,90 +1327,9 @@
\\
{\bf \small Swift example 2: Monte-Carlo simulation of glass cavity dynamics.}
%\begin{verbatim}
-\begin{Verbatim}[fontsize=\scriptsize,frame=single,framesep=2mm,gobble=7, numbers=left]
- 1 type Arc;
- 2 type Restart;
- 3 type Log;
- 4
- 5 type GlassIn{
- 6 Restart startfile;
- 7 }
- 8
- 9 type GlassOut{
- 10 Arc arcfile;
- 11 Restart restartfile;
- 12 Restart startfile;
- 13 Restart final;
- 14 Log logfile;
- 15 }
- 16
- 17 app (GlassOut o) glassCavityRun(
- 18 GlassIn i, string rad, string temp, string steps,
- 19 string volume, string fraca, string energyfunction,
- 20 string centerstring, string arctimestring)
- 21 {
- 22 glassRun "-a" @filename(o.final) "--lf" @filename(i.startfile)
- 23 "--temp" temp "--stepsperparticle" steps "--volume" volume
- 24 "--fraca" fraca "--energy_function" energyfunction
- 25 "--cradius" rad "--ccoord" centerstring arctimestring
- 26 stdout=@filename(o.logfile);
- 27 }
- 28
- 29 CreateGlassSystem()
- 30 {
- 31 string temp=@arg("temp","2.0");
- 32 string steps=@arg("steps","10");
- 33 string esteps=@arg("esteps","100");
- 34 string ceqsteps=@arg("ceqsteps","100");
- 35 string natoms=@arg("natoms","200");
- 36 string volume=@arg("volume","200");
- 37 string rlist=@arg("rlist","rlist");
- 38 string clist=@arg("clist","clist");
- 39 string fraca=@arg("fraca","0.5");
- 40 string radii[] = readData(rlist);
- 41 string centers[] = readData(clist);
- 42 int nmodels=@toint( @arg("n","1") );
- 43 int nsub=@toint( @arg("nsub","1") );
- 44 string savearc=@arg("savearc","FALSE");
- 45 string arctimestring;
- 46 if(savearc=="FALSE") {
- 47 arctimestring="--arc_time=10000000";
- 48 }
- 49 else{
- 50 arctimestring="";
- 51 }
- 52 string energyfunction=@arg("energyfunction","softsphereratiosmooth");
- 53
- 54 GlassIn modelIn[][][] <ext;exec="GlassCavityOutArray.map",
- 55 rlist=rlist, clist=clist, steps=ceqsteps, n=nmodels,
- 56 esteps=esteps, temp=temp, volume=volume,
- 57 e=energyfunction, natoms=natoms, i="true">;
- 58 GlassOut modelOut[][][][] <ext; exec="GlassCavityContinueOutArray.map",
- 59 n=nmodels, nsub=nsub, rlist=rlist, clist=clist,
- 60 ceqsteps=ceqsteps, esteps=esteps, steps=steps, temp=temp, volume=volume,
- 61 e=energyfunction, natoms=natoms>;
- 62
- 63 foreach rad,rindex in radii {
- 64 foreach centerstring,cindex in centers {
- 65 foreach model in [0:nmodels-1] {
- 66 foreach job in [0:nsub-1] {
- 67 string fname =
- 68 @filename(modelOut[rindex][cindex][model][job].final)
- 69 if (fname != "NULL") {
- 70 modelOut[rindex][cindex][model][job] =
- 71 glassCavityRun( modelIn[rindex][cindex][model],
- 72 rad, temp, steps, volume, fraca, energyfunction,
- 73 centerstring, arctimestring);
- 74 }
- 75 }
- 76 }
- 77 }
- 78 }
- 79 }
- 80
- 81
- 82 CreateGlassSystem();
-\end{Verbatim}
+%\begin{Verbatim}[fontsize=\scriptsize,frame=single,framesep=2mm,gobble=7, numbers=left]
+\VerbatimInput[fontsize=\scriptsize,frame=single,framesep=2mm, numbers=left] {code/glass.swift}
+%\end{Verbatim}
%\end{verbatim}
\section{Performance Characteristics}
More information about the Swift-commit
mailing list