[Swift-commit] r6849 - SwiftApps/Swift-MapRed/TurboChirp

yadunandb at ci.uchicago.edu yadunandb at ci.uchicago.edu
Wed Aug 14 23:37:52 CDT 2013


Author: yadunandb
Date: 2013-08-14 23:37:52 -0500 (Wed, 14 Aug 2013)
New Revision: 6849

Added:
   SwiftApps/Swift-MapRed/TurboChirp/quickserver.sh
   SwiftApps/Swift-MapRed/TurboChirp/teragen.out
Modified:
   SwiftApps/Swift-MapRed/TurboChirp/combiner.sh
   SwiftApps/Swift-MapRed/TurboChirp/run.sh
   SwiftApps/Swift-MapRed/TurboChirp/teragen.swift
   SwiftApps/Swift-MapRed/TurboChirp/teragen.tcl
Log:

* First working version with support for local combiner stage.
* A reduction tree is pending implementation.
* Commiting a netcat based exec server



Modified: SwiftApps/Swift-MapRed/TurboChirp/combiner.sh
===================================================================
--- SwiftApps/Swift-MapRed/TurboChirp/combiner.sh	2013-08-14 20:09:06 UTC (rev 6848)
+++ SwiftApps/Swift-MapRed/TurboChirp/combiner.sh	2013-08-15 04:37:52 UTC (rev 6849)
@@ -20,15 +20,13 @@
     TOKEN=($(cat $1))
     HOST=${TOKEN[0]}
     FILE=${TOKEN[1]}
-    echo "FILE: $FILE on $HOST"
     TARGET=$(basename $FILE)
-    echo "HOST: $HOST, CURRENT_HOST=$HOSTNAME"
     if [ "$HOST" != "$CURRENT_HOST" ]
     then
         # Fetch if file is remote
-        echo "chirp_get $HOST $TARGET $TARGET.imd"
         chirp_get $HOST $TARGET /tmp/$TARGET.imd
         RES=($(awk '{ sum += $1 } END { print sum,NR }' /tmp/$TARGET.imd))
+        rm /tmp/$TARGET.imd &> /dev/null &
     else
         # Process directly if file is local
         RES=($(awk '{ sum += $1 } END { print sum,NR }' $FILE))
@@ -37,7 +35,6 @@
 }
 
 ID=$RANDOM
-echo "DEBUG: ${FILES[*]}"
 for file_token in ${FILES[*]}
 do
     echo $file_token
@@ -48,8 +45,7 @@
 SUM=$(awk '{ sum += $1 } END { print sum }' $ID*imd2)
 COUNT=$(awk '{ sum += $2 } END { print sum }' $ID*imd2)
 
-echo "SUM  : $SUM"
-echo "COUNT: $COUNT"
-
-#rm *imd2 *imd
+echo "$SUM $COUNT" > $CURRENT_HOST.$ID.imd
+echo "$CURRENT_HOST $CURRENT_HOST.$ID.imd"
+rm $ID*{imd,imd2} &> /dev/null &
 exit 0
\ No newline at end of file

Added: SwiftApps/Swift-MapRed/TurboChirp/quickserver.sh
===================================================================
--- SwiftApps/Swift-MapRed/TurboChirp/quickserver.sh	                        (rev 0)
+++ SwiftApps/Swift-MapRed/TurboChirp/quickserver.sh	2013-08-15 04:37:52 UTC (rev 6849)
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+PORT=9393
+FILE=nc.server.exec
+[ "$1" != "" ] && PORT=$1
+while :
+do
+    netcat -l $PORT > $FILE
+    chmod 777 $FILE
+    /bin/bash $FILE
+done


Property changes on: SwiftApps/Swift-MapRed/TurboChirp/quickserver.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: SwiftApps/Swift-MapRed/TurboChirp/run.sh
===================================================================
--- SwiftApps/Swift-MapRed/TurboChirp/run.sh	2013-08-14 20:09:06 UTC (rev 6848)
+++ SwiftApps/Swift-MapRed/TurboChirp/run.sh	2013-08-15 04:37:52 UTC (rev 6849)
@@ -12,5 +12,6 @@
 export TURBINE_LAUNCH_OPTS="-f /homes/yadunand/Swift-MapRed/TurboChirp/hosts.txt"
 stc $PROG > ${PROG%.swift}.tcl
 [ "$?" == "0" ] && echo "Compile done"
-turbine -n 8 ${PROG%.swift}.tcl
+#turbine -n 8 ${PROG%.swift}.tcl
+turbine -l -V -n 10 -f hosts.txt ${PROG%.swift}.tcl >& ${PROG%.swift}.out
 [ "$?" == "0" ] && echo "Execute done"

Added: SwiftApps/Swift-MapRed/TurboChirp/teragen.out
===================================================================
--- SwiftApps/Swift-MapRed/TurboChirp/teragen.out	                        (rev 0)
+++ SwiftApps/Swift-MapRed/TurboChirp/teragen.out	2013-08-15 04:37:52 UTC (rev 6849)
@@ -0,0 +1,205 @@
+++ dirname /homes/wozniak/Public/turbine/bin/turbine
++ TURBINE_BIN=/homes/wozniak/Public/turbine/bin
++ [[ -z '' ]]
+++ cd /homes/wozniak/Public/turbine/bin/..
+++ /bin/pwd
++ TURBINE_HOME=/nfs2/wozniak/Public/turbine
++ source /nfs2/wozniak/Public/turbine/scripts/turbine-config.sh
+++ TURBINE_HOME=/homes/wozniak/Public/turbine
+++ TURBINE_VERSION=0.5.0
+++ export C_UTILS=/nfs2/wozniak/Public/c-utils
+++ C_UTILS=/nfs2/wozniak/Public/c-utils
+++ export TCL=/homes/wozniak/Public/tcl-8.5.11-x86_64
+++ TCL=/homes/wozniak/Public/tcl-8.5.11-x86_64
+++ export TCLSH=/homes/wozniak/Public/tcl-8.5.11-x86_64/bin/tclsh8.5
+++ TCLSH=/homes/wozniak/Public/tcl-8.5.11-x86_64/bin/tclsh8.5
+++ export ADLB=/nfs2/wozniak/Public/lb
+++ ADLB=/nfs2/wozniak/Public/lb
+++ export MPI_IMPL=MPICH2
+++ MPI_IMPL=MPICH2
+++ export MPI=@USE_MPI@
+++ MPI=@USE_MPI@
+++ export MPI_LIB=/nfs2/wozniak/Public/mpich-master-x86_64/lib
+++ MPI_LIB=/nfs2/wozniak/Public/mpich-master-x86_64/lib
+++ export TURBINE_LAUNCHER=mpiexec
+++ TURBINE_LAUNCHER=mpiexec
+++ TCLLIBPATH=
+++ [[ -n '' ]]
+++ TCLLIBPATH+=/homes/wozniak/Public/turbine/lib
+++ export TCLLIBPATH
+++ [[ /homes/wozniak/Public/tcl-8.5.11-x86_64/bin/tclsh8.5 == '' ]]
+++ export TURBINE_MACHINE=normal
+++ TURBINE_MACHINE=normal
+++ [[ normal == \s\i\c\o\r\t\e\x ]]
+++ return 0
++ [[ 0 != 0 ]]
++ ((  REPORT_VERSION  ))
++ ((  PRINT_HELP  ))
++ [[ hosts.txt != 0 ]]
++ TURBINE_LAUNCH_OPTIONS+=' -f hosts.txt'
++ shift 6
++ PROGRAM=teragen.tcl
++ shift
++ ARGS=
++ [[ teragen.tcl == '' ]]
++ [[ ! -f teragen.tcl ]]
++ ((  1  ))
++ [[ MPICH2 == \M\P\I\C\H\2 ]]
++ LINE_PREFIX=-l
++ OPTIONS=
++ OPTIONS+='-l '
++ OPTIONS+='-n 10 '
++ OPTIONS+=' -f hosts.txt'
++ ((  VERBOSE  ))
++ which mpiexec
+/usr/bin/mpiexec
++ mpiexec -l -n 10 -f hosts.txt /homes/wozniak/Public/tcl-8.5.11-x86_64/bin/tclsh8.5 teragen.tcl
+[9] DEBUG_ADLB: ADLB SERVER...
+[0] DEBUG_ADLB: adlb::insert <8>["0"]=<19>
+[0] DEBUG_ADLB: adlb::insert <8>["1"]=<20>
+[0] DEBUG_ADLB: adlb::insert <8>["2"]=<21>
+[0] DEBUG_ADLB: adlb::insert <8>["3"]=<22>
+[0] DEBUG_ADLB: adlb::insert <8>["4"]=<23>
+[0] DEBUG_ADLB: adlb::insert <8>["5"]=<24>
+[0] DEBUG_ADLB: adlb::insert <8>["6"]=<25>
+[0] DEBUG_ADLB: adlb::insert <8>["7"]=<26>
+[0] DEBUG_ADLB: adlb::insert <8>["8"]=<27>
+[0] DEBUG_ADLB: adlb::insert <8>["9"]=<28>
+[0] DEBUG_ADLB: adlb::insert <7>["7"]=<32 30 1>
+[0] DEBUG_ADLB: adlb::insert <7>["0"]=<36 34 1>
+[0] DEBUG_ADLB: adlb::insert <7>["9"]=<40 38 1>
+[0] DEBUG_ADLB: adlb::insert <7>["3"]=<44 42 1>
+[0] DEBUG_ADLB: adlb::insert <7>["2"]=<48 46 1>
+[0] DEBUG_ADLB: adlb::insert <7>["1"]=<52 50 1>
+[0] DEBUG_ADLB: adlb::insert <7>["5"]=<56 54 1>
+[0] DEBUG_ADLB: adlb::insert <7>["6"]=<60 58 1>
+[0] DEBUG_ADLB: adlb::insert <7>["8"]=<64 62 1>
+[0] DEBUG_ADLB: adlb::insert <7>["4"]=<68 66 1>
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "140 gen_data-app-leaf0 0 {33 31 1} 13 30 31 {12 13 0} 1 {32 30 1}" 0
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "170 gen_data-app-leaf0 0 {37 35 1} 13 34 35 {12 13 0} 1 {36 34 1}" 0
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "200 gen_data-app-leaf0 0 {41 39 1} 13 38 39 {12 13 0} 1 {40 38 1}" 0
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "230 gen_data-app-leaf0 0 {45 43 1} 13 42 43 {12 13 0} 1 {44 42 1}" 0
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "260 gen_data-app-leaf0 0 {49 47 1} 13 46 47 {12 13 0} 1 {48 46 1}" 0
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "290 gen_data-app-leaf0 0 {53 51 1} 13 50 51 {12 13 0} 1 {52 50 1}" 0
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "320 gen_data-app-leaf0 0 {57 55 1} 13 54 55 {12 13 0} 1 {56 54 1}" 0
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "350 gen_data-app-leaf0 0 {61 59 1} 13 58 59 {12 13 0} 1 {60 58 1}" 0
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "380 gen_data-app-leaf0 0 {65 63 1} 13 62 63 {12 13 0} 1 {64 62 1}" 0
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "410 gen_data-app-leaf0 0 {69 67 1} 13 66 67 {12 13 0} 1 {68 66 1}" 0
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "80 deeprule_action "29" "get_uniq_sites-app-leaf0 0 {14 15 0} 9 {16 9 1} 15 7"" 0
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[8] grep: tgen*out[8] : No such file or directory
+[8] grep: tgen*out[8] : No such file or directory
+[8] grep: tgen*out[8] : No such file or directory
+[8] grep: tgen*out[8] : No such file or directory
+[8] grep: tgen*out[8] : No such file or directory
+[8] grep: tgen*out[8] : No such file or directory
+[8] grep: tgen*out[8] : No such file or directory
+[0] DEBUG_ADLB: adlb::put: target_rank: -100 type: 0 "420 main-call_builtin-read 0 11 {16 9 1}" 0
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::insert <10>["0"]=<70>
+[0] DEBUG_ADLB: adlb::insert <10>["1"]=<71>
+[0] DEBUG_ADLB: adlb::insert <10>["2"]=<72>
+[0] DEBUG_ADLB: adlb::insert <10>["3"]=<73>
+[0] DEBUG_ADLB: adlb::insert <10>["4"]=<74>
+[0] DEBUG_ADLB: adlb::insert <10>["5"]=<75>
+[0] DEBUG_ADLB: adlb::insert <10>["6"]=<76>
+[0] DEBUG_ADLB: adlb::insert <10>["7"]=<77>
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::insert <87>["0"]=<134>
+[0] DEBUG_ADLB: adlb::insert <94>["0"]=<135>
+[0] DEBUG_ADLB: adlb::insert <101>["0"]=<136>
+[0] DEBUG_ADLB: adlb::insert <108>["0"]=<137>
+[0] DEBUG_ADLB: adlb::insert <115>["0"]=<138>
+[0] DEBUG_ADLB: adlb::insert <122>["0"]=<139>
+[0] DEBUG_ADLB: adlb::insert <129>["0"]=<140>
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] Site: crank Rank: 3
+[0] DEBUG_ADLB: adlb::put: target_rank: 3 type: 0 "870 comb_data_local-app-leaf0 0 {91 86 1} 85 86 {17 18 0} 18 {90 85 1} 70" 0
+[0] Site: crank String: crank
+[0] 
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] Site: thrash Rank: 5
+[0] DEBUG_ADLB: adlb::put: target_rank: 5 type: 0 "890 comb_data_local-app-leaf0 0 {133 128 1} 127 128 {17 18 0} 18 {132 127 1} 74" 0
+[0] Site: thrash String: thrash
+[0] 
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] Site: vanquish Rank: 6
+[0] DEBUG_ADLB: adlb::put: target_rank: 6 type: 0 "930 comb_data_local-app-leaf0 0 {126 121 1} 120 121 {17 18 0} 18 {125 120 1} 76" 0
+[0] Site: vanquish String: vanquish
+[0] 
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] Site: thwomp Rank: 0
+[0] DEBUG_ADLB: adlb::put: target_rank: 0 type: 0 "950 comb_data_local-app-leaf0 0 {119 114 1} 113 114 {17 18 0} 18 {118 113 1} 75" 0
+[0] Site: thwomp String: thwomp
+[0] 
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] Site: crush Rank: 9
+[0] DEBUG_ADLB: adlb::put: target_rank: 9 type: 0 "990 comb_data_local-app-leaf0 0 {112 107 1} 106 107 {17 18 0} 18 {111 106 1} 71" 0
+[0] Site: crush String: crush
+[0] 
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] Site: steamroller Rank: 4
+[0] DEBUG_ADLB: adlb::put: target_rank: 4 type: 0 "1010 comb_data_local-app-leaf0 0 {105 100 1} 99 100 {17 18 0} 18 {104 99 1} 72" 0
+[0] Site: steamroller String: steamroller
+[0] 
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] Site: stomp Rank: 8
+[0] DEBUG_ADLB: adlb::put: target_rank: 8 type: 0 "1040 comb_data_local-app-leaf0 0 {98 93 1} 92 93 {17 18 0} 18 {97 92 1} 73" 0
+[0] Site: stomp String: stomp
+[0] 
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[0] DEBUG_ADLB: adlb::get: type=1
+[9] WARNING: server contains targeted work!
+[9] WARNING: server contains targeted work!
+[0] WAITING TRANSFORMS: 8
+[0] TRANSFORM:      {450} decr-filename-[ 83 78 ] LOCAL (/83/)
+[0] TRANSFORM:      {460} decr-filename-[ 84 79 ] LOCAL (/84/)
+[0] TRANSFORM:      {480} DRS-81-82 LOCAL (/82/)
+[0] TRANSFORM:      {490} main-optmerged  LOCAL (/81/)
+[0] TRANSFORM:      {650} decr-filename-[ 111 106 ] LOCAL (/111/)
+[0] TRANSFORM:      {660} decr-filename-[ 112 107 ] LOCAL (/112/)
+[0] TRANSFORM:      {700} decr-filename-[ 118 113 ] LOCAL (/118/)
+[0] TRANSFORM:      {710} decr-filename-[ 119 114 ] LOCAL (/119/)

Modified: SwiftApps/Swift-MapRed/TurboChirp/teragen.swift
===================================================================
--- SwiftApps/Swift-MapRed/TurboChirp/teragen.swift	2013-08-14 20:09:06 UTC (rev 6848)
+++ SwiftApps/Swift-MapRed/TurboChirp/teragen.swift	2013-08-15 04:37:52 UTC (rev 6849)
@@ -31,8 +31,8 @@
     int fsize = 1;
 
     foreach item,i in [0:loop-1] {
-        file out <sprintf("tgen_%i.out", i)>;
-        file err <sprintf("tgen_%i.err", i)>;
+        file out <sprintf("intermediate/tgen_%i.out", i)>;
+        file err <sprintf("intermediate/tgen_%i.err", i)>;
     	(out, err) = gen_data(wrapper, fsize);
         tgen_out[i]=out;
     }
@@ -41,15 +41,15 @@
     file combiner_list <"uniq_sites">;
     combiner_list = get_uniq_sites(jobs_per_site, tgen_out);
     
-    string sites[] = split(readFile(combiner_list), "\n");
+    string sites[] = split(read(combiner_list), "\n");
         
 
     file combine = input_file("combiner.sh");
     //Here we are forcing jobs to sites to run local combiners
     file comb_out[];
     foreach site,i in sites {
-        file out1 <sprintf("sitecomb_%i.out", i)>;
-        file err1 <sprintf("sitecomb_%i.err", i)>;
+        file out1 <sprintf("intermediate/sitecomb_%i.out", i)>;
+        file err1 <sprintf("intermediate/sitecomb_%i.err", i)>;
         string site_info[] = split(site, " ");
         printf("Site: %s String: %s\n", site_info[0], site);
         location rank = hostmap_one(site_info[0]);
@@ -57,7 +57,7 @@
         
         //(out1, err1) = comb_data_local(combine, site);
         
-        // Todo : Find @location usage
+        // Todo : Find @location usage        
         (out1, err1) = @location=rank comb_data_local(combine, site);        
         comb_out[i] = out1;    
     }

Modified: SwiftApps/Swift-MapRed/TurboChirp/teragen.tcl
===================================================================
--- SwiftApps/Swift-MapRed/TurboChirp/teragen.tcl	2013-08-14 20:09:06 UTC (rev 6848)
+++ SwiftApps/Swift-MapRed/TurboChirp/teragen.tcl	2013-08-15 04:37:52 UTC (rev 6849)
@@ -0,0 +1,624 @@
+
+# Generated by stc version 0.2.0
+# date                    : 2013/08/14 23:29:29
+# Turbine version         : 0.3.0
+# Input filename          : /nfs2/yadunand/Swift-MapRed/TurboChirp/teragen.swift
+# Output filename         : /nfs2/yadunand/Swift-MapRed/TurboChirp
+# STC home                : /nfs2/wozniak/Public/stc
+# Turbine home            : /homes/wozniak/Public/turbine
+# Compiler settings:
+# stc.auto-declare              : true
+# stc.c_preprocess              : true
+# stc.codegen.no-stack          : true
+# stc.codegen.no-stack-vars     : true
+# stc.compiler-debug            : true
+# stc.debugging                 : COMMENTS
+# stc.exp.refcounting           : true
+# stc.ic.output-file            : 
+# stc.input_filename            : teragen.swift
+# stc.log.file                  : 
+# stc.log.trace                 : false
+# stc.must_pass_wait_vars       : true
+# stc.opt.algebra               : false
+# stc.opt.cancel-refcounts      : true
+# stc.opt.constant-fold         : true
+# stc.opt.controlflow-fusion    : true
+# stc.opt.dead-code-elim        : true
+# stc.opt.disable-asserts       : false
+# stc.opt.expand-dataflow-ops   : true
+# stc.opt.expand-loop-threshold-insts: 256
+# stc.opt.expand-loop-threshold-iters: 16
+# stc.opt.expand-loops          : true
+# stc.opt.flatten-nested        : true
+# stc.opt.forward-dataflow      : true
+# stc.opt.full-unroll           : false
+# stc.opt.function-inline       : false
+# stc.opt.function-inline-threshold: 500
+# stc.opt.function-signature    : true
+# stc.opt.hoist                 : true
+# stc.opt.max-iterations        : 10
+# stc.opt.piggyback-refcounts   : true
+# stc.opt.pipeline              : false
+# stc.opt.reorder-insts         : false
+# stc.opt.shared-constants      : true
+# stc.opt.unroll-loop-threshold-insts: 192
+# stc.opt.unroll-loop-threshold-iters: 8
+# stc.opt.unroll-loops          : true
+# stc.opt.wait-coalesce         : true
+# stc.output_filename           : 
+# stc.preproc.force-cpp         : false
+# stc.preproc.force-gcc         : false
+# stc.preprocess_only           : false
+# stc.profile                   : false
+# stc.rpath                     : 
+# stc.stc_home                  : /nfs2/wozniak/Public/stc
+# stc.turbine.version           : 0.3.0
+# stc.turbine_home              : /homes/wozniak/Public/turbine
+# stc.version                   : 0.2.0
+
+# Metadata:
+
+package require turbine 0.3.0
+namespace import turbine::*
+
+
+proc swift:constants {  } {
+    turbine::c::log "function:swift:constants"
+    global c:i_1
+    turbine::allocate_custom c:i_1 integer 1 1 1
+    turbine::store_integer ${c:i_1} 1
+    global c:s__
+    turbine::allocate_custom c:s__ string 1 1 1
+    turbine::store_string ${c:s__} " "
+    global c:s__-1
+    turbine::allocate_custom c:s__-1 string 1 1 1
+    turbine::store_string ${c:s__-1} "\n"
+    global c:s_combiner_s
+    turbine::allocate_custom c:s_combiner_s string 1 1 1
+    turbine::store_string ${c:s_combiner_s} "combiner.sh"
+    global c:s_jobs_per_s
+    turbine::allocate_custom c:s_jobs_per_s string 1 1 1
+    turbine::store_string ${c:s_jobs_per_s} "jobs_per_site.sh"
+    global c:s_teragen_wr
+    turbine::allocate_custom c:s_teragen_wr string 1 1 1
+    turbine::store_string ${c:s_teragen_wr} "teragen_wrap.sh"
+}
+
+
+proc f:ternary { stack u:o u:b u:i1 u:i2 } {
+    turbine::c::log "enter function: ternary"
+    turbine::read_refcount_incr ${u:i1} 1
+    turbine::read_refcount_incr ${u:b} 1
+    turbine::read_refcount_incr ${u:i2} 1
+    turbine::rule [ list ${u:b} ${u:i1} ${u:i2} ] "ternary-argwait ${stack} ${u:b} ${u:o} ${u:i2} ${u:i1}"
+}
+
+
+proc ternary-argwait { stack u:b u:o u:i2 u:i1 } {
+    # Value __v_b with type $boolean was defined
+    # Value __v_i1 with type $int was defined
+    # Value __v_i2 with type $int was defined
+    # Value __v_o with type $int was defined
+    set v:b [ turbine::retrieve_integer ${u:b} CACHED 1 ]
+    set v:i1 [ turbine::retrieve_integer ${u:i1} CACHED 1 ]
+    set v:i2 [ turbine::retrieve_integer ${u:i2} CACHED 1 ]
+    if { ${v:b} } { set v:o ${v:i1} } else { set v:o ${v:i2} }
+    turbine::store_integer ${u:o} ${v:o}
+}
+
+
+proc f:file_type { stack u:t u:f } {
+    turbine::c::log "enter function: file_type"
+    turbine::file_read_refcount_incr ${u:f} 1
+    turbine::rule [ list [ turbine::get_file_status ${u:f} ] ] "file_type-argwait ${stack} {${u:f}} ${u:t}"
+}
+
+
+proc file_type-argwait { stack u:f u:t } {
+    # Value __v_f with type $file was defined
+    # Value __v_t with type $string was defined
+    set v:f [ turbine::get_file ${u:f} 1 ]
+    set v:t [ file type [ lindex ${v:f} 0 ] ]
+    turbine::store_string ${u:t} ${v:t}
+}
+
+
+proc f:file_exists { stack u:o u:f } {
+    turbine::c::log "enter function: file_exists"
+    turbine::read_refcount_incr ${u:f} 1
+    turbine::rule [ list ${u:f} ] "file_exists-argwait ${stack} ${u:f} ${u:o}"
+}
+
+
+proc file_exists-argwait { stack u:f u:o } {
+    # Value __v_f with type $string was defined
+    # Value __v_o with type $boolean was defined
+    set v:f [ turbine::retrieve_string ${u:f} CACHED 1 ]
+    set v:o [ file exists ${v:f} ]
+    turbine::store_integer ${u:o} ${v:o}
+}
+
+
+proc f:file_mtime { stack u:o u:f } {
+    turbine::c::log "enter function: file_mtime"
+    turbine::read_refcount_incr ${u:f} 1
+    turbine::rule [ list ${u:f} ] "file_mtime-argwait ${stack} ${u:f} ${u:o}"
+}
+
+
+proc file_mtime-argwait { stack u:f u:o } {
+    # Value __v_f with type $string was defined
+    # Value __v_o with type $int was defined
+    set v:f [ turbine::retrieve_string ${u:f} CACHED 1 ]
+    set v:o [ file mtime ${v:f} ]
+    turbine::store_integer ${u:o} ${v:o}
+}
+
+
+proc f:strlen { stack u:n u:s } {
+    turbine::c::log "enter function: strlen"
+    turbine::read_refcount_incr ${u:s} 1
+    turbine::rule [ list ${u:s} ] "strlen-argwait ${stack} ${u:s} ${u:n}"
+}
+
+
+proc strlen-argwait { stack u:s u:n } {
+    # Value __v_s with type $string was defined
+    # Value __v_n with type $int was defined
+    set v:s [ turbine::retrieve_string ${u:s} CACHED 1 ]
+    set v:n [ string length ${v:s} ]
+    turbine::store_integer ${u:n} ${v:n}
+}
+
+
+proc f:trim { stack u:o u:s } {
+    turbine::c::log "enter function: trim"
+    turbine::read_refcount_incr ${u:s} 1
+    turbine::rule [ list ${u:s} ] "trim-argwait ${stack} ${u:s} ${u:o}"
+}
+
+
+proc trim-argwait { stack u:s u:o } {
+    # Value __v_s with type $string was defined
+    # Value __v_o with type $string was defined
+    set v:s [ turbine::retrieve_string ${u:s} CACHED 1 ]
+    set v:o [ string trim ${v:s} ]
+    turbine::store_string ${u:o} ${v:o}
+}
+
+
+proc f:hash { stack u:h u:s } {
+    turbine::c::log "enter function: hash"
+    turbine::read_refcount_incr ${u:s} 1
+    turbine::rule [ list ${u:s} ] "hash-argwait ${stack} ${u:s} ${u:h}"
+}
+
+
+proc hash-argwait { stack u:s u:h } {
+    # Value __v_s with type $string was defined
+    # Value __v_h with type $int was defined
+    set v:s [ turbine::retrieve_string ${u:s} CACHED 1 ]
+    set v:h [ c_utils::hash ${v:s} ]
+    turbine::store_integer ${u:h} ${v:h}
+}
+
+
+proc f:clock_seconds { stack u:t } {
+    turbine::c::log "enter function: clock_seconds"
+    # Value __v_t with type $int was defined
+    set v:t [ clock seconds ]
+    turbine::store_integer ${u:t} ${v:t}
+}
+
+
+proc f:clock { stack u:t } {
+    turbine::c::log "enter function: clock"
+    # Value __v_t with type $float was defined
+    set v:t [ expr {[ clock clicks -milliseconds ] / 1000.0 } ]
+    turbine::store_float ${u:t} ${v:t}
+}
+
+
+proc f:location_from_rank { stack u:loc u:rank } {
+    turbine::c::log "enter function: location_from_rank"
+    turbine::read_refcount_incr ${u:rank} 1
+    turbine::rule [ list ${u:rank} ] "location_from_rank-argwait ${stack} ${u:rank} ${u:loc}"
+}
+
+
+proc location_from_rank-argwait { stack u:rank u:loc } {
+    # Value __v_rank with type $int was defined
+    # Value __v_loc with type $int was defined
+    set v:rank [ turbine::retrieve_integer ${u:rank} CACHED 1 ]
+    set v:loc ${v:rank}
+    turbine::store_integer ${u:loc} ${v:loc}
+}
+
+
+proc f:random_worker { stack u:loc } {
+    turbine::c::log "enter function: random_worker"
+    # Value __v_loc with type $int was defined
+    set v:loc [ ::turbine::random_worker ]
+    turbine::store_integer ${u:loc} ${v:loc}
+}
+
+
+proc f:random_engine { stack u:loc } {
+    turbine::c::log "enter function: random_engine"
+    # Value __v_loc with type $int was defined
+    set v:loc [ ::turbine::random_engine ]
+    turbine::store_integer ${u:loc} ${v:loc}
+}
+
+
+proc f:hostmap_one { stack u:rank u:name } {
+    turbine::c::log "enter function: hostmap_one"
+    turbine::read_refcount_incr ${u:name} 1
+    turbine::rule [ list ${u:name} ] "hostmap_one-argwait ${stack} ${u:rank} ${u:name}"
+}
+
+
+proc hostmap_one-argwait { stack u:rank u:name } {
+    # Value __v_name with type $string was defined
+    # Value __v_rank with type $int was defined
+    set v:name [ turbine::retrieve_string ${u:name} CACHED 1 ]
+    set v:rank [ draw [ adlb::hostmap ${v:name} ] ]
+    turbine::store_integer ${u:rank} ${v:rank}
+}
+
+
+proc f:hostmap_one_worker { stack u:rank u:name } {
+    turbine::c::log "enter function: hostmap_one_worker"
+    turbine::read_refcount_incr ${u:name} 1
+    turbine::rule [ list ${u:name} ] "hostmap_one_worker-argwait ${stack} ${u:rank} ${u:name}"
+}
+
+
+proc hostmap_one_worker-argwait { stack u:rank u:name } {
+    # Value __v_name with type $string was defined
+    # Value __v_rank with type $int was defined
+    set v:name [ turbine::retrieve_string ${u:name} CACHED 1 ]
+    set v:rank [ ::turbine::random_rank WORKER [ adlb::hostmap ${v:name} ] ]
+    turbine::store_integer ${u:rank} ${v:rank}
+}
+
+
+proc f:gen_data { stack u:out u:err u:run u:recsize dr:location } {
+    turbine::c::log "enter function: gen_data"
+    # Alias __filename_run with type string was defined
+    # Alias __filename_out with type string was defined
+    # Alias __filename_err with type string was defined
+    turbine::file_read_refcount_incr ${u:run} 1
+    turbine::read_refcount_incr ${u:recsize} 1
+    set filename:run [ turbine::get_file_path ${u:run} ]
+    turbine::read_refcount_incr ${filename:run} 1
+    set filename:out [ turbine::get_output_file_path ${u:out} ]
+    turbine::read_refcount_incr ${filename:out} 1
+    set filename:err [ turbine::get_output_file_path ${u:err} ]
+    turbine::read_refcount_incr ${filename:err} 1
+    turbine::rule [ list ${filename:err} ${filename:out} ${filename:run} ${u:recsize} [ turbine::get_file_status ${u:run} ] ] "gen_data-app-leaf0 ${stack} {${u:err}} ${filename:run} ${filename:out} ${filename:err} {${u:run}} ${u:recsize} {${u:out}}" target ${dr:location} type ${::turbine::WORK}
+}
+
+
+proc gen_data-app-leaf0 { stack u:err filename:run filename:out filename:err u:run u:recsize u:out } {
+    # Value __v___filename_run with type $string was defined
+    # Value __v_recsize with type $int was defined
+    # Value __v___filename_out with type $string was defined
+    # Value __v___filename_err with type $string was defined
+    # Value __v_run with type $file was defined
+    # Value __v_out with type $file was defined
+    # Value __v_err with type $file was defined
+    set v:__filename_run [ turbine::retrieve_string ${filename:run} CACHED 1 ]
+    set v:recsize [ turbine::retrieve_integer ${u:recsize} CACHED 1 ]
+    set v:__filename_out [ turbine::retrieve_string ${filename:out} CACHED 1 ]
+    set v:__filename_err [ turbine::retrieve_string ${filename:err} CACHED 1 ]
+    set v:run [ turbine::get_file ${u:run} 1 ]
+    turbine::c::log [ list exec: /bin/bash ${v:__filename_run} ${v:recsize} [ dict create "stdout" ${v:__filename_out} "stderr" ${v:__filename_err} ] ]
+    turbine::exec_external "/bin/bash" [ dict create "stdout" ${v:__filename_out} "stderr" ${v:__filename_err} ] ${v:__filename_run} ${v:recsize}
+    set v:out [ turbine::create_local_file_ref ${v:__filename_out} ]
+    set v:err [ turbine::create_local_file_ref ${v:__filename_err} ]
+    turbine::set_file ${u:out} v:out
+    turbine::set_file ${u:err} v:err
+    turbine::decr_local_file_refcount v:out
+    turbine::decr_local_file_refcount v:err
+}
+
+
+proc f:comb_data { stack u:out u:err u:comb u:array dr:location } {
+    turbine::c::log "enter function: comb_data"
+    # Alias __filename_comb with type string was defined
+    # Alias __filename_out with type string was defined
+    # Alias __filename_err with type string was defined
+    turbine::file_read_refcount_incr ${u:comb} 1
+    turbine::read_refcount_incr ${u:array} 1
+    set filename:comb [ turbine::get_file_path ${u:comb} ]
+    turbine::read_refcount_incr ${filename:comb} 1
+    set filename:out [ turbine::get_output_file_path ${u:out} ]
+    turbine::read_refcount_incr ${filename:out} 1
+    set filename:err [ turbine::get_output_file_path ${u:err} ]
+    turbine::read_refcount_incr ${filename:err} 1
+    turbine::deeprule [ list ${filename:comb} ${filename:err} ${filename:out} ${u:array} [ turbine::get_file_status ${u:comb} ] ] [ list 0 0 0 1 0 ] [ list 0 0 0 1 1 ] "comb_data-app-leaf0 ${stack} {${u:err}} ${filename:out} ${filename:err} {${u:comb}} ${filename:comb} {${u:out}} ${u:array}" target ${dr:location} type ${::turbine::WORK}
+}
+
+
+proc comb_data-app-leaf0 { stack u:err filename:out filename:err u:comb filename:comb u:out u:array } {
+    # Value __v___filename_comb with type $string was defined
+    # Value __v___filename_out with type $string was defined
+    # Value __v___filename_err with type $string was defined
+    # Value __v_comb with type $file was defined
+    # Value __v_out with type $file was defined
+    # Value __v_err with type $file was defined
+    set v:__filename_comb [ turbine::retrieve_string ${filename:comb} CACHED 1 ]
+    set v:__filename_out [ turbine::retrieve_string ${filename:out} CACHED 1 ]
+    set v:__filename_err [ turbine::retrieve_string ${filename:err} CACHED 1 ]
+    set v:comb [ turbine::get_file ${u:comb} 1 ]
+    turbine::c::log [ list exec: /bin/bash ${v:__filename_comb} {*}[ turbine::unpack_args ${u:array} 1 1 ] [ dict create "stdout" ${v:__filename_out} "stderr" ${v:__filename_err} ] ]
+    turbine::exec_external "/bin/bash" [ dict create "stdout" ${v:__filename_out} "stderr" ${v:__filename_err} ] ${v:__filename_comb} {*}[ turbine::unpack_args ${u:array} 1 1 ]
+    set v:out [ turbine::create_local_file_ref ${v:__filename_out} ]
+    set v:err [ turbine::create_local_file_ref ${v:__filename_err} ]
+    turbine::set_file ${u:out} v:out
+    turbine::set_file ${u:err} v:err
+    turbine::decr_local_file_refcount v:out
+    turbine::decr_local_file_refcount v:err
+    turbine::read_refcount_decr ${u:array} 1
+}
+
+
+proc f:comb_data_local { stack u:out u:err u:comb u:array dr:location } {
+    turbine::c::log "enter function: comb_data_local"
+    # Alias __filename_comb with type string was defined
+    # Alias __filename_out with type string was defined
+    # Alias __filename_err with type string was defined
+    turbine::file_read_refcount_incr ${u:comb} 1
+    turbine::read_refcount_incr ${u:array} 1
+    set filename:comb [ turbine::get_file_path ${u:comb} ]
+    turbine::read_refcount_incr ${filename:comb} 1
+    set filename:out [ turbine::get_output_file_path ${u:out} ]
+    turbine::read_refcount_incr ${filename:out} 1
+    set filename:err [ turbine::get_output_file_path ${u:err} ]
+    turbine::read_refcount_incr ${filename:err} 1
+    turbine::rule [ list ${filename:comb} ${filename:err} ${filename:out} ${u:array} [ turbine::get_file_status ${u:comb} ] ] "comb_data_local-app-leaf0 ${stack} {${u:err}} ${filename:out} ${filename:err} {${u:comb}} ${filename:comb} {${u:out}} ${u:array}" target ${dr:location} type ${::turbine::WORK}
+}
+
+
+proc comb_data_local-app-leaf0 { stack u:err filename:out filename:err u:comb filename:comb u:out u:array } {
+    # Value __v___filename_comb with type $string was defined
+    # Value __v_array with type $string was defined
+    # Value __v___filename_out with type $string was defined
+    # Value __v___filename_err with type $string was defined
+    # Value __v_comb with type $file was defined
+    # Value __v_out with type $file was defined
+    # Value __v_err with type $file was defined
+    set v:__filename_comb [ turbine::retrieve_string ${filename:comb} CACHED 1 ]
+    set v:array [ turbine::retrieve_string ${u:array} CACHED 1 ]
+    set v:__filename_out [ turbine::retrieve_string ${filename:out} CACHED 1 ]
+    set v:__filename_err [ turbine::retrieve_string ${filename:err} CACHED 1 ]
+    set v:comb [ turbine::get_file ${u:comb} 1 ]
+    turbine::c::log [ list exec: /bin/bash ${v:__filename_comb} ${v:array} [ dict create "stdout" ${v:__filename_out} "stderr" ${v:__filename_err} ] ]
+    turbine::exec_external "/bin/bash" [ dict create "stdout" ${v:__filename_out} "stderr" ${v:__filename_err} ] ${v:__filename_comb} ${v:array}
+    set v:out [ turbine::create_local_file_ref ${v:__filename_out} ]
+    set v:err [ turbine::create_local_file_ref ${v:__filename_err} ]
+    turbine::set_file ${u:out} v:out
+    turbine::set_file ${u:err} v:err
+    turbine::decr_local_file_refcount v:out
+    turbine::decr_local_file_refcount v:err
+}
+
+
+proc f:get_uniq_sites { stack u:out u:sites u:array dr:location } {
+    turbine::c::log "enter function: get_uniq_sites"
+    # Alias __filename_sites with type string was defined
+    # Alias __filename_out with type string was defined
+    turbine::read_refcount_incr ${u:array} 1
+    turbine::file_read_refcount_incr ${u:sites} 1
+    set filename:sites [ turbine::get_file_path ${u:sites} ]
+    turbine::read_refcount_incr ${filename:sites} 1
+    set filename:out [ turbine::get_output_file_path ${u:out} ]
+    turbine::read_refcount_incr ${filename:out} 1
+    turbine::deeprule [ list ${filename:out} ${filename:sites} ${u:array} [ turbine::get_file_status ${u:sites} ] ] [ list 0 0 1 0 ] [ list 0 0 1 1 ] "get_uniq_sites-app-leaf0 ${stack} {${u:sites}} ${filename:out} {${u:out}} ${filename:sites} ${u:array}" target ${dr:location} type ${::turbine::WORK}
+}
+
+
+proc get_uniq_sites-app-leaf0 { stack u:sites filename:out u:out filename:sites u:array } {
+    # Value __v___filename_sites with type $string was defined
+    # Value __v___filename_out with type $string was defined
+    # Value __v_sites with type $file was defined
+    # Value __v_out with type $file was defined
+    set v:__filename_sites [ turbine::retrieve_string ${filename:sites} CACHED 1 ]
+    set v:__filename_out [ turbine::retrieve_string ${filename:out} CACHED 1 ]
+    set v:sites [ turbine::get_file ${u:sites} 1 ]
+    turbine::c::log [ list exec: /bin/bash ${v:__filename_sites} {*}[ turbine::unpack_args ${u:array} 1 1 ] [ dict create "stdout" ${v:__filename_out} ] ]
+    turbine::exec_external "/bin/bash" [ dict create "stdout" ${v:__filename_out} ] ${v:__filename_sites} {*}[ turbine::unpack_args ${u:array} 1 1 ]
+    set v:out [ turbine::create_local_file_ref ${v:__filename_out} ]
+    turbine::set_file ${u:out} v:out
+    turbine::decr_local_file_refcount v:out
+    turbine::read_refcount_decr ${u:array} 1
+}
+
+
+proc swift:main {  } {
+    turbine::c::log "enter function: main"
+    set stack 0
+    global c:s__-1
+    global c:s_combiner_s
+    global c:s_jobs_per_s
+    global c:s_teragen_wr
+    lassign [ adlb::multicreate [ list container integer file_ref 1 1 ] [ list container integer ref 1 1 ] [ list string 2 ] [ list container integer ref 1 1 ] [ list string 1 ] ] u:tgen_out t:1 t:10 u:sites t:11
+    turbine::c::log "allocated u:tgen_out=<${u:tgen_out}> t:1=<${t:1}> t:10=<${t:10}> u:sites=<${u:sites}> t:11=<${t:11}>"
+    turbine::allocate_file2 u:wrapper "" 1
+    turbine::allocate_file2 u:jobs_per_site "" 1
+    turbine::allocate_file2 u:combiner_list ${t:10} 1
+    turbine::allocate_file2 u:combine "" 1
+    # Swift l.27: assigning expression to wrapper
+    turbine::input_file [ list ${u:wrapper} ] [ list ${c:s_teragen_wr} ]
+    # Swift l.30: assigning expression to loop
+    # Swift l.31: assigning expression to fsize
+    turbine::range_work ${t:1} 0 9 1
+    # Swift l.40: assigning expression to jobs_per_site
+    turbine::input_file [ list ${u:jobs_per_site} ] [ list ${c:s_jobs_per_s} ]
+    turbine::store_string ${t:10} "uniq_sites"
+    # Swift l.42: assigning expression to combiner_list
+    f:get_uniq_sites ${stack} ${u:combiner_list} ${u:jobs_per_site} ${u:tgen_out} -100
+    # Swift l.44: assigning expression to sites
+    turbine::split [ list ${u:sites} ] [ list ${t:11} ${c:s__-1} ]
+    # Swift l.47: assigning expression to combine
+    turbine::input_file [ list ${u:combine} ] [ list ${c:s_combiner_s} ]
+    # Swift l.36: assigning expression to out
+    # Swift l.36: assigning expression to err
+    # Swift l.37: assigning expression to tgen_out[_]
+    turbine::rule [ list ${u:sites} ] "main-foreach-wait1 ${stack} ${u:sites} {${u:combine}}" type ${::turbine::LOCAL}
+    set tcltmp:container_sz [ adlb::enumerate ${t:1} count all 0 ]
+    set tcltmp:iters ${tcltmp:container_sz}
+    turbine::file_read_refcount_incr ${u:wrapper} [ expr { ${tcltmp:iters} - 1 } ]
+    turbine::read_refcount_incr ${t:1} [ expr { ${tcltmp:iters} - 1 } ]
+    adlb::write_refcount_incr ${u:tgen_out} [ expr { ${tcltmp:iters} - 1 } ]
+    main-foreach0:outer ${stack} ${u:wrapper} ${u:tgen_out} ${t:1} 0 [ expr { ${tcltmp:container_sz} - 1 } ] 1
+    turbine::rule [ list [ turbine::get_file_status ${u:combiner_list} ] ] "main-call_builtin-read ${stack} ${t:11} {${u:combiner_list}}" type ${::turbine::WORK}
+    turbine::read_refcount_decr ${u:tgen_out} 1
+    turbine::file_read_refcount_decr ${u:jobs_per_site} 1
+}
+
+
+proc main-foreach-wait1 { stack u:sites u:combine } {
+    # Swift l.53: assigning expression to site_info
+    # Swift l.54 evaluating  expression and throwing away 1 results
+    # Swift l.55: assigning expression to rank
+    # Swift l.56 evaluating  expression and throwing away 1 results
+    # Swift l.61: assigning expression to out1
+    # Swift l.61: assigning expression to err1
+    # Swift l.62: assigning expression to comb_out[_]
+    set tcltmp:container_sz [ adlb::enumerate ${u:sites} count all 0 ]
+    set tcltmp:iters ${tcltmp:container_sz}
+    turbine::read_refcount_incr ${u:sites} [ expr { ${tcltmp:iters} - 1 } ]
+    turbine::file_read_refcount_incr ${u:combine} [ expr { ${tcltmp:iters} - 1 } ]
+    main-foreach1:outer ${stack} ${u:combine} ${u:sites} 0 [ expr { ${tcltmp:container_sz} - 1 } ] 1
+}
+
+
+proc main-foreach1:outer { stack u:combine u:sites tcltmp:lo tcltmp:hi tcltmp:inc } {
+    set tcltmp:itersleft [ expr { max(0,(${tcltmp:hi} - ${tcltmp:lo}) / ${tcltmp:inc} + 1) } ]
+    if { [ expr { ${tcltmp:itersleft} <= 0 } ] } {
+        return
+    }
+    if { [ expr { ${tcltmp:itersleft} <= 64 } ] } {
+        main-foreach1:inner ${stack} ${u:combine} ${u:sites} ${tcltmp:lo} ${tcltmp:hi} ${tcltmp:inc}
+    } else {
+        set tcltmp:skip [ expr { ${tcltmp:inc} * max(64,((${tcltmp:itersleft} - 1) / 16) + 1) } ]
+        for { set tcltmp:splitstart ${tcltmp:lo} } { ${tcltmp:splitstart} <= ${tcltmp:hi} } { incr tcltmp:splitstart ${tcltmp:skip} } {
+            set tcltmp:splitend [ expr { min(${tcltmp:hi},${tcltmp:splitstart} + ${tcltmp:skip} - 1) } ]
+            set tcltmp:prio [ turbine::get_priority ]
+            turbine::set_priority ${tcltmp:prio}
+            adlb::spawn 1 "command main-foreach1:outer ${stack} {${u:combine}} ${u:sites} ${tcltmp:splitstart} ${tcltmp:splitend} ${tcltmp:inc}"
+            turbine::reset_priority
+        }
+    }
+}
+
+
+proc main-foreach1:inner { stack u:combine u:sites tcltmp:lo tcltmp:hi tcltmp:inc } {
+    set tcltmp:splitlen [ expr { ${tcltmp:hi} - ${tcltmp:lo} + 1 } ]
+    set tcltmp:contents [ adlb::enumerate ${u:sites} dict ${tcltmp:splitlen} ${tcltmp:lo} ]
+    dict for {v:i0 u:site} ${tcltmp:contents} {
+        global c:s__
+        # Value __ov___t14 with type $string was defined
+        # Value __ov___t16 with type $string was defined
+        lassign [ adlb::multicreate [ list string 2 ] [ list string 2 ] [ list container integer ref 1 1 ] [ list string 1 ] [ list ref 1 ] ] t:14 t:16 u:site_info t:21 t:22
+        turbine::c::log "allocated t:14=<${t:14}> t:16=<${t:16}> u:site_info=<${u:site_info}> t:21=<${t:21}> t:22=<${t:22}>"
+        turbine::allocate_file2 u:out1 ${t:14} 0
+        turbine::allocate_file2 u:err1 ${t:16} 0
+        turbine::read_refcount_incr ${u:site} 2
+        set optv:__t14 [ eval format [ list "intermediate/sitecomb_%i.out" ${v:i0} ] ]
+        turbine::store_string ${t:14} ${optv:__t14}
+        set optv:__t16 [ eval format [ list "intermediate/sitecomb_%i.err" ${v:i0} ] ]
+        turbine::store_string ${t:16} ${optv:__t16}
+        turbine::split [ list ${u:site_info} ] [ list ${u:site} ${c:s__} ]
+        turbine::container_reference ${u:site_info} 0 ${t:22} ref
+        turbine::dereference_string ${t:21} ${t:22}
+        turbine::rule [ list ${t:21} ] "main-optmerged ${stack} ${u:site} {${u:combine}} {${u:out1}} {${u:err1}} ${t:21}"
+    }
+    set tcltmp:iters [ expr { max(0,(${tcltmp:hi} - ${tcltmp:lo}) / ${tcltmp:inc} + 1) } ]
+    turbine::read_refcount_decr ${u:sites} [ expr { ${tcltmp:iters} } ]
+}
+
+
+proc main-optmerged { stack u:site u:combine u:out1 u:err1 t:21 } {
+    # Value __ov___t21:1 with type $string was defined
+    # Value __ov_rank with type $int was defined
+    # Value __ov___t25 with type $void was defined
+    set optv:__t21:1 [ turbine::retrieve_string ${t:21} CACHED 1 ]
+    set optv:rank [ draw [ adlb::hostmap ${optv:__t21:1} ] ]
+    f:comb_data_local ${stack} ${u:out1} ${u:err1} ${u:combine} ${u:site} ${optv:rank}
+    set optv:__t25 [ turbine::printf_local "Site: %s Rank: %i" ${optv:__t21:1} ${optv:rank} ]
+    turbine::rule [ list ${u:site} ] [ list main-call_builtin-printf ${stack} ${u:site} ${optv:__t21:1} ]
+    turbine::file_read_refcount_decr ${u:combine} 1
+}
+
+
+proc main-call_builtin-printf { stack u:site optv:__t21:1 } {
+    # Value __ov_site with type $string was defined
+    # Value __ov___t19 with type $void was defined
+    set optv:site [ turbine::retrieve_string ${u:site} CACHED 1 ]
+    set optv:__t19 [ turbine::printf_local "Site: %s String: %s\n" ${optv:__t21:1} ${optv:site} ]
+}
+
+
+proc main-foreach0:outer { stack u:wrapper u:tgen_out t:1 tcltmp:lo tcltmp:hi tcltmp:inc } {
+    set tcltmp:itersleft [ expr { max(0,(${tcltmp:hi} - ${tcltmp:lo}) / ${tcltmp:inc} + 1) } ]
+    if { [ expr { ${tcltmp:itersleft} <= 0 } ] } {
+        return
+    }
+    if { [ expr { ${tcltmp:itersleft} <= 64 } ] } {
+        main-foreach0:inner ${stack} ${u:wrapper} ${u:tgen_out} ${t:1} ${tcltmp:lo} ${tcltmp:hi} ${tcltmp:inc}
+    } else {
+        set tcltmp:skip [ expr { ${tcltmp:inc} * max(64,((${tcltmp:itersleft} - 1) / 16) + 1) } ]
+        for { set tcltmp:splitstart ${tcltmp:lo} } { ${tcltmp:splitstart} <= ${tcltmp:hi} } { incr tcltmp:splitstart ${tcltmp:skip} } {
+            set tcltmp:splitend [ expr { min(${tcltmp:hi},${tcltmp:splitstart} + ${tcltmp:skip} - 1) } ]
+            set tcltmp:prio [ turbine::get_priority ]
+            turbine::set_priority ${tcltmp:prio}
+            adlb::spawn 1 "command main-foreach0:outer ${stack} {${u:wrapper}} ${u:tgen_out} ${t:1} ${tcltmp:splitstart} ${tcltmp:splitend} ${tcltmp:inc}"
+            turbine::reset_priority
+        }
+    }
+}
+
+
+proc main-foreach0:inner { stack u:wrapper u:tgen_out t:1 tcltmp:lo tcltmp:hi tcltmp:inc } {
+    set tcltmp:splitlen [ expr { ${tcltmp:hi} - ${tcltmp:lo} + 1 } ]
+    set tcltmp:contents [ adlb::enumerate ${t:1} dict ${tcltmp:splitlen} ${tcltmp:lo} ]
+    dict for {v:i u:item} ${tcltmp:contents} {
+        global c:i_1
+        # Value __ov___t5 with type $string was defined
+        # Value __ov___t7 with type $string was defined
+        lassign [ adlb::multicreate [ list string 2 ] [ list string 2 ] ] t:5 t:7
+        turbine::c::log "allocated t:5=<${t:5}> t:7=<${t:7}>"
+        turbine::allocate_file2 u:out ${t:5} 1
+        turbine::allocate_file2 u:err ${t:7} 1
+        set optv:__t5 [ eval format [ list "intermediate/tgen_%i.out" ${v:i} ] ]
+        turbine::store_string ${t:5} ${optv:__t5}
+        set optv:__t7 [ eval format [ list "intermediate/tgen_%i.err" ${v:i} ] ]
+        turbine::store_string ${t:7} ${optv:__t7}
+        f:gen_data ${stack} ${u:out} ${u:err} ${u:wrapper} ${c:i_1} -100
+        turbine::container_insert ${u:tgen_out} ${v:i} ${u:out} file_ref 1
+        turbine::file_read_refcount_decr ${u:err} 1
+    }
+    set tcltmp:iters [ expr { max(0,(${tcltmp:hi} - ${tcltmp:lo}) / ${tcltmp:inc} + 1) } ]
+    turbine::file_read_refcount_decr ${u:wrapper} [ expr { ${tcltmp:iters} } ]
+    turbine::read_refcount_decr ${t:1} [ expr { ${tcltmp:iters} } ]
+}
+
+
+proc main-call_builtin-read { stack t:11 u:combiner_list } {
+    # Value __ov_combiner_list with type $file was defined
+    # Value __ov___t11 with type $string was defined
+    set optv:combiner_list [ turbine::get_file ${u:combiner_list} 1 ]
+    set optv:__t11 [ turbine::file_read_local ${optv:combiner_list} ]
+    turbine::store_string ${t:11} ${optv:__t11}
+}
+
+turbine::defaults
+turbine::init $engines $servers
+turbine::enable_read_refcount
+turbine::check_constants "WORKER" ${turbine::WORK_TASK} 0 "CONTROL" ${turbine::CONTROL_TASK} 1 "ADLB_RANK_ANY" ${adlb::RANK_ANY} -100
+turbine::start swift:main swift:constants
+turbine::finalize
+




More information about the Swift-commit mailing list