[Swift-commit] r6584 - in SwiftTutorials/CMTS_2013-06-17/basic_swift: . part08 part11

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Mon Jun 17 15:17:58 CDT 2013


Author: davidk
Date: 2013-06-17 15:17:58 -0500 (Mon, 17 Jun 2013)
New Revision: 6584

Added:
   SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/
   SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/README
   SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/apps
   SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/p11.swift
   SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/sites.xml
Modified:
   SwiftTutorials/CMTS_2013-06-17/basic_swift/README
   SwiftTutorials/CMTS_2013-06-17/basic_swift/part08/README
Log:
Part11


Modified: SwiftTutorials/CMTS_2013-06-17/basic_swift/README
===================================================================
--- SwiftTutorials/CMTS_2013-06-17/basic_swift/README	2013-06-17 20:01:51 UTC (rev 6583)
+++ SwiftTutorials/CMTS_2013-06-17/basic_swift/README	2013-06-17 20:17:58 UTC (rev 6584)
@@ -57,3 +57,4 @@
 
 part10: Example readData to read file with multiple fields into a struct
 
+part11: Example using composite functions

Modified: SwiftTutorials/CMTS_2013-06-17/basic_swift/part08/README
===================================================================
--- SwiftTutorials/CMTS_2013-06-17/basic_swift/part08/README	2013-06-17 20:01:51 UTC (rev 6583)
+++ SwiftTutorials/CMTS_2013-06-17/basic_swift/part08/README	2013-06-17 20:17:58 UTC (rev 6584)
@@ -10,3 +10,4 @@
 
 To run
 $ swift p8.swift -steps=10 -range=100 -count=6 -nsim=1
+

Added: SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/README
===================================================================
--- SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/README	                        (rev 0)
+++ SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/README	2013-06-17 20:17:58 UTC (rev 6584)
@@ -0,0 +1,16 @@
+
+TOPIC: Example pipeline showing composite functions
+
+This example shows composite functions. The function called generate_randoms
+combines two app calls and returns only the result we care about.
+
+(file o) generate_randoms (int timesteps, int range_value, int count_value)
+{
+  file tmp;
+  tmp = mysim4(timesteps, range_value, 1);
+  int rand = readData(tmp);
+  o = mysim4(timesteps, range_value, rand);
+}
+
+To run
+$ swift p11.swift -steps=10 -range=100 -count=6 -nsim=1

Added: SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/apps
===================================================================
--- SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/apps	                        (rev 0)
+++ SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/apps	2013-06-17 20:17:58 UTC (rev 6584)
@@ -0,0 +1,2 @@
+cmtsworkshop random4  random4.sh
+localhost    average  avg.sh

Added: SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/p11.swift
===================================================================
--- SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/p11.swift	                        (rev 0)
+++ SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/p11.swift	2013-06-17 20:17:58 UTC (rev 6584)
@@ -0,0 +1,35 @@
+type file;
+
+app (file o) mysim4 (int timesteps, int range_value, int count_value)
+{
+  random4 timesteps range_value count_value stdout=@filename(o);
+}
+
+app (file o) analyze (file s[])
+{
+  average @filenames(s) stdout=@filename(o);
+}
+
+(file o) generate_randoms (int timesteps, int range_value, int count_value)
+{
+  file tmp;
+  tmp = mysim4(timesteps, range_value, 1);
+  int rand = readData(tmp);
+  o = mysim4(timesteps, range_value, rand);
+}
+
+
+file sims[];
+int  nsim  = @toInt(@arg("nsim",  "10"));
+int  steps = @toInt(@arg("steps", "1"));
+int  range = @toInt(@arg("range", "100"));
+int  count = @toInt(@arg("count", "10"));
+
+foreach i in [0:nsim-1] {
+  file simout <single_file_mapper; file=@strcat("output/sim_", i, ".tmp.out")>;
+  simout = generate_randoms(steps, range, count);
+  sims[i] = simout;
+}
+
+file stats<"output/average.out">;
+stats = analyze(sims);

Added: SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/sites.xml
===================================================================
--- SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/sites.xml	                        (rev 0)
+++ SwiftTutorials/CMTS_2013-06-17/basic_swift/part11/sites.xml	2013-06-17 20:17:58 UTC (rev 6584)
@@ -0,0 +1,39 @@
+<config>
+
+  <pool handle="localhost">
+    <execution provider="local"/>
+    <filesystem provider="local"/>
+    <workdirectory>/scratch/midway/{env.USER}/swiftwork</workdirectory>
+  </pool>
+
+  <pool handle="cmtsworkshop">
+    <execution provider="coaster" jobmanager="local:slurm"/>
+
+    <!-- Set partition and account here: -->
+    <profile namespace="globus" key="queue">cmtsworkshop</profile>
+    <profile namespace="globus" key="ppn">8</profile>
+    <profile namespace="globus" key="project">cmtsworkshop</profile>
+
+    <!-- Set number of jobs and nodes per job here: -->
+    <profile namespace="globus" key="slots">4</profile>
+    <profile namespace="globus" key="maxnodes">1</profile>
+    <profile namespace="globus" key="nodegranularity">1</profile>
+    <profile namespace="globus" key="jobsPerNode">8</profile> <!-- apps per node! -->
+    <profile namespace="karajan" key="jobThrottle">.31</profile> <!-- eg .31 -> 32 -->
+
+    <!-- Set estimated app time (maxwalltime) and requested job time (maxtime) here: -->
+    <profile namespace="globus" key="maxWalltime">00:15:00</profile>
+    <profile namespace="globus" key="maxtime">1800</profile>  <!-- in seconds! -->
+
+    <!-- Set data staging model and work dir here: -->
+    <filesystem provider="local"/>
+    <workdirectory>/scratch/midway/{env.USER}/swiftwork</workdirectory>
+
+    <!-- Typically leave these constant: -->
+    <profile namespace="globus" key="slurm.exclusive">false</profile>
+    <profile namespace="globus" key="highOverAllocation">100</profile>
+    <profile namespace="globus" key="lowOverAllocation">100</profile>
+    <profile namespace="karajan" key="initialScore">10000</profile>
+  </pool>
+
+</config>




More information about the Swift-commit mailing list