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

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Thu Aug 15 11:27:49 CDT 2013


Author: ketan
Date: 2013-08-15 11:27:49 -0500 (Thu, 15 Aug 2013)
New Revision: 6866

Modified:
   SwiftApps/Swift-MapRed/TurboChirp/run.sh
   SwiftApps/Swift-MapRed/TurboChirp/teragen.swift
   SwiftApps/Swift-MapRed/TurboChirp/teragen.tcl
Log:
params on commandline

Modified: SwiftApps/Swift-MapRed/TurboChirp/run.sh
===================================================================
--- SwiftApps/Swift-MapRed/TurboChirp/run.sh	2013-08-15 16:21:27 UTC (rev 6865)
+++ SwiftApps/Swift-MapRed/TurboChirp/run.sh	2013-08-15 16:27:49 UTC (rev 6866)
@@ -13,5 +13,5 @@
 stc $PROG > ${PROG%.swift}.tcl
 [ "$?" == "0" ] && echo "Compile done"
 #turbine -n 8 ${PROG%.swift}.tcl
-turbine -l -V -n 10 -f hosts.txt ${PROG%.swift}.tcl >& ${PROG%.swift}.out
+turbine -l -V -n 10 -f hosts.txt ${PROG%.swift}.tcl -loop=10 -fsize=1 >& ${PROG%.swift}.out
 [ "$?" == "0" ] && echo "Execute done"

Modified: SwiftApps/Swift-MapRed/TurboChirp/teragen.swift
===================================================================
--- SwiftApps/Swift-MapRed/TurboChirp/teragen.swift	2013-08-15 16:21:27 UTC (rev 6865)
+++ SwiftApps/Swift-MapRed/TurboChirp/teragen.swift	2013-08-15 16:27:49 UTC (rev 6866)
@@ -27,8 +27,10 @@
     file wrapper = input_file("teragen_wrap.sh");
 	file tgen_out[];
 
-    int loop = 10;
-    int fsize = 1;
+    //int loop = 10;
+    int loop=toint(argv("loop"));
+    //int fsize = 1;
+    int fsize = toint(argv("fsize"));
 
     foreach item,i in [0:loop-1] {
         file out <sprintf("intermediate/tgen_%i.out", i)>;

Modified: SwiftApps/Swift-MapRed/TurboChirp/teragen.tcl
===================================================================
--- SwiftApps/Swift-MapRed/TurboChirp/teragen.tcl	2013-08-15 16:21:27 UTC (rev 6865)
+++ SwiftApps/Swift-MapRed/TurboChirp/teragen.tcl	2013-08-15 16:27:49 UTC (rev 6866)
@@ -1,6 +1,6 @@
 
 # Generated by stc version 0.2.0
-# date                    : 2013/08/15 11:04:50
+# date                    : 2013/08/15 11:25:08
 # Turbine version         : 0.3.0
 # Input filename          : /nfs2/ketan/Swift-MapRed/TurboChirp/teragen.swift
 # Output filename         : /nfs2/ketan/Swift-MapRed/TurboChirp
@@ -64,15 +64,12 @@
 
 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__} " "
+    turbine::store_string ${c:s__} "\n"
     global c:s__-1
     turbine::allocate_custom c:s__-1 string 1 1 1
-    turbine::store_string ${c:s__-1} "\n"
+    turbine::store_string ${c:s__-1} " "
     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"
@@ -439,54 +436,67 @@
 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}>"
+    global c:s_combiner_s
+    global c:s__
+    # Value __ov___t1 with type $string was defined
+    # Value __ov_loop with type $int was defined
+    # Value __ov___t3 with type $string was defined
+    # Value __ov_fsize with type $int was defined
+    # Value __ov___t7 with type $int was defined
+    lassign [ adlb::multicreate [ list container integer file_ref 1 1 ] [ list integer 1 ] [ list container integer ref 1 1 ] [ list string 2 ] [ list container integer ref 1 1 ] [ list string 1 ] ] u:tgen_out u:fsize t:5 t:14 u:sites t:15
+    turbine::c::log "allocated u:tgen_out=<${u:tgen_out}> u:fsize=<${u:fsize}> t:5=<${t:5}> t:14=<${t:14}> u:sites=<${u:sites}>"
+    turbine::c::log "allocated t:15=<${t:15}>"
     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:combiner_list ${t:14} 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
+    # Swift l.31: assigning expression to loop
+    set optv:__t1 [ turbine::argv_get_impl "loop" ]
+    set optv:loop [ turbine::check_str_int ${optv:__t1} ]
+    # Swift l.33: assigning expression to fsize
+    set optv:__t3 [ turbine::argv_get_impl "fsize" ]
+    set optv:fsize [ turbine::check_str_int ${optv:__t3} ]
+    turbine::store_integer ${u:fsize} ${optv:fsize}
+    set optv:__t7 [ expr { ${optv:loop} - 1 } ]
+    turbine::range_work ${t:5} 0 ${optv:__t7} 1
+    # Swift l.42: 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
+    turbine::store_string ${t:14} "uniq_sites"
+    # Swift l.44: 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
+    # Swift l.46: assigning expression to sites
+    turbine::split [ list ${u:sites} ] [ list ${t:15} ${c:s__} ]
+    # Swift l.49: 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[_]
+    # Swift l.38: assigning expression to out
+    # Swift l.38: assigning expression to err
+    # Swift l.39: 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:container_sz [ adlb::enumerate ${t:5} 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 } ]
+    turbine::read_refcount_incr ${t:5} [ expr { ${tcltmp:iters} - 1 } ]
+    turbine::read_refcount_incr ${u:fsize} [ 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}
+    main-foreach0:outer ${stack} ${u:wrapper} ${u:fsize} ${u:tgen_out} ${t:5} 0 [ expr { ${tcltmp:container_sz} - 1 } ] 1
+    turbine::rule [ list [ turbine::get_file_status ${u:combiner_list} ] ] "main-call_builtin-read ${stack} ${t:15} {${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.55: assigning expression to site_info
     # 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[_]
+    # Swift l.57: assigning expression to rank
+    # Swift l.58 evaluating  expression and throwing away 1 results
+    # Swift l.63: assigning expression to out1
+    # Swift l.63: assigning expression to err1
+    # Swift l.64: 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 } ]
@@ -519,100 +529,100 @@
     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
+        global c:s__-1
+        # Value __ov___t18 with type $string was defined
+        # Value __ov___t20 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:18 t:20 u:site_info t:25 t:26
+        turbine::c::log "allocated t:18=<${t:18}> t:20=<${t:20}> u:site_info=<${u:site_info}> t:25=<${t:25}> t:26=<${t:26}>"
+        turbine::allocate_file2 u:out1 ${t:18} 0
+        turbine::allocate_file2 u:err1 ${t:20} 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 optv:__t18 [ eval format [ list "intermediate/sitecomb_%i.out" ${v:i0} ] ]
+        turbine::store_string ${t:18} ${optv:__t18}
+        set optv:__t20 [ eval format [ list "intermediate/sitecomb_%i.err" ${v:i0} ] ]
+        turbine::store_string ${t:20} ${optv:__t20}
+        turbine::split [ list ${u:site_info} ] [ list ${u:site} ${c:s__-1} ]
+        turbine::container_reference ${u:site_info} 0 ${t:26} ref
+        turbine::dereference_string ${t:25} ${t:26}
+        turbine::rule [ list ${t:25} ] "main-optmerged ${stack} ${u:site} {${u:combine}} ${t:25} {${u:out1}} {${u:err1}}"
     }
     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
+proc main-optmerged { stack u:site u:combine t:25 u:out1 u:err1 } {
+    # Value __ov___t25: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} ] ]
+    # Value __ov___t29 with type $void was defined
+    set optv:__t25:1 [ turbine::retrieve_string ${t:25} CACHED 1 ]
+    set optv:rank [ draw [ adlb::hostmap ${optv:__t25: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} ]
+    set optv:__t29 [ turbine::printf_local "Site: %s Rank: %i" ${optv:__t25:1} ${optv:rank} ]
+    turbine::rule [ list ${u:site} ] [ list main-call_builtin-printf ${stack} ${u:site} ${optv:__t25:1} ]
     turbine::file_read_refcount_decr ${u:combine} 1
 }
 
 
-proc main-call_builtin-printf { stack u:site optv:__t21:1 } {
+proc main-call_builtin-printf { stack u:site optv:__t25:1 } {
     # Value __ov_site with type $string was defined
-    # Value __ov___t19 with type $void was defined
+    # Value __ov___t23 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} ]
+    set optv:__t23 [ turbine::printf_local "Site: %s String: %s\n" ${optv:__t25:1} ${optv:site} ]
 }
 
 
-proc main-foreach0:outer { stack u:wrapper u:tgen_out t:1 tcltmp:lo tcltmp:hi tcltmp:inc } {
+proc main-foreach0:outer { stack u:wrapper u:fsize u:tgen_out t:5 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}
+        main-foreach0:inner ${stack} ${u:wrapper} ${u:fsize} ${u:tgen_out} ${t:5} ${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}"
+            adlb::spawn 1 "command main-foreach0:outer ${stack} {${u:wrapper}} ${u:fsize} ${u:tgen_out} ${t:5} ${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 } {
+proc main-foreach0:inner { stack u:wrapper u:fsize u:tgen_out t:5 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} ]
+    set tcltmp:contents [ adlb::enumerate ${t:5} 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
+        # Value __ov___t9 with type $string was defined
+        # Value __ov___t11 with type $string was defined
+        lassign [ adlb::multicreate [ list string 2 ] [ list string 2 ] ] t:9 t:11
+        turbine::c::log "allocated t:9=<${t:9}> t:11=<${t:11}>"
+        turbine::allocate_file2 u:out ${t:9} 1
+        turbine::allocate_file2 u:err ${t:11} 1
+        set optv:__t9 [ eval format [ list "intermediate/tgen_%i.out" ${v:i} ] ]
+        turbine::store_string ${t:9} ${optv:__t9}
+        set optv:__t11 [ eval format [ list "intermediate/tgen_%i.err" ${v:i} ] ]
+        turbine::store_string ${t:11} ${optv:__t11}
+        f:gen_data ${stack} ${u:out} ${u:err} ${u:wrapper} ${u:fsize} -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::read_refcount_decr ${t:5} [ expr { ${tcltmp:iters} } ]
+    turbine::read_refcount_decr ${u:fsize} [ expr { ${tcltmp:iters} } ]
     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 } {
+proc main-call_builtin-read { stack t:15 u:combiner_list } {
     # Value __ov_combiner_list with type $file was defined
-    # Value __ov___t11 with type $string was defined
+    # Value __ov___t15 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}
+    set optv:__t15 [ turbine::file_read_local ${optv:combiner_list} ]
+    turbine::store_string ${t:15} ${optv:__t15}
 }
 
 turbine::defaults




More information about the Swift-commit mailing list