Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/ein16/synth/d2/run.py
ViewVC logotype

Diff of /branches/ein16/synth/d2/run.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3997, Sun Jun 19 15:55:49 2016 UTC revision 3998, Sun Jun 19 17:12:03 2016 UTC
# Line 118  Line 118 
118    
119  #run all examples for a specific operator  #run all examples for a specific operator
120  def single1_all_ops(ex_opr):  def single1_all_ops(ex_opr):
121      #print "single all ops"      print "single all ops"
122      ex = get_ex(ex_opr)      ex = get_ex(ex_opr)
123        print "B"
124      #print(example.get_oprname(ex))      #print(example.get_oprname(ex))
125      n = len(ex.tys)      n = len(ex.tys)
126        print "C"
127      rtn = [str(ex_opr)+": length "+str(n)]      rtn = [str(ex_opr)+": length "+str(n)]
128        print "D"
129        print rtn
130      for ex_num  in range(n):      for ex_num  in range(n):
131          #print (example.toStr(ex,ex_num))          #print (example.toStr(ex,ex_num))
132          x =  example.toStr(ex,ex_num)+" "+str(ex_opr)+"-"+str(ex_num)+":"          x =  example.toStr(ex,ex_num)+" "+str(ex_opr)+"-"+str(ex_num)+":"
133          #print x          #print x
134            print "starting"
135          y = single1_specific_ex(ex_opr, ex_num)          y = single1_specific_ex(ex_opr, ex_num)
136            print "ending"
137          rtn.append(x+y)          rtn.append(x+y)
138      return rtn      return rtn
139    
# Line 171  Line 177 
177          (app, coeffs, dimF) = mkApply_twice(name, opr_inner,opr_outer, ishape, inputfile)          (app, coeffs, dimF) = mkApply_twice(name, opr_inner,opr_outer, ishape, inputfile)
178          #print "\nafter mk apply twice:\n",apply.toStr(app,0 )          #print "\nafter mk apply twice:\n",apply.toStr(app,0 )
179          # main part          # main part
180          (rtn, rst_good, rst_eh, rst_terrible, rst_compile) =  central(app, coeffs, dimF)          (rtn0, rst_good, rst_eh, rst_terrible, rst_compile) =  central(app, coeffs, dimF)
181            rtn = str(ex_opr)+"-"+str( ex_num)+"-"+str(  opr_outer.name)+"-"+name+":"+rtn0
182          return (1, rtn, rst_good, rst_eh, rst_terrible, rst_compile)          return (1, rtn, rst_good, rst_eh, rst_terrible, rst_compile)
183      else:      else:
184          x = "\n\t\tskipped did not apply "+opr_outer.name+" to ("+tshape.name+","          x = "\n\t\tskipped did not apply "+opr_outer.name+" to ("+tshape.name+","
# Line 190  Line 197 
197    
198  def embed2_apply_outer(ex_opr, ex_num, ex_outer, gty):  def embed2_apply_outer(ex_opr, ex_num, ex_outer, gty):
199      if(gty==-1):      if(gty==-1):
200            print "found uanry"
201          #apply all possible unary operators to a specific inside example          #apply all possible unary operators to a specific inside example
202          opr_outer = op_unary[ex_outer]          opr_outer = op_unary[ex_outer]
203          return  embed2_outer(ex_opr, ex_num, opr_outer, "_",[])          return  embed2_outer(ex_opr, ex_num, opr_outer, "_",[])
# Line 286  Line 294 
294  elif (n==2):  elif (n==2):
295      #run specific operators      #run specific operators
296      ex_opr = int(sys.argv[2])      ex_opr = int(sys.argv[2])
297        print "inside"
298      rtn = single1_all_ops(ex_opr)      rtn = single1_all_ops(ex_opr)
299        print "post"
300      for i in rtn:      for i in rtn:
301          print i          print i
302      os.system("open results_tmp.txt")      os.system("open results_tmp.txt")
# Line 297  Line 307 
307      pnt2("-2 cmd:", cnt, total, rst_good,  rst_eh, rst_terrible, rst_compile)      pnt2("-2 cmd:", cnt, total, rst_good,  rst_eh, rst_terrible, rst_compile)
308      for i in rtn:      for i in rtn:
309          for j in i:          for j in i:
310              print j              print (str(ex_opr)+":"+j)
311  elif (n==3):  elif (n==3):
312      # run one example      # run one example
313      # with a specific operator      # with a specific operator
# Line 321  Line 331 
331      raise "unsupported"      raise "unsupported"
332  elif(n==-4):  elif(n==-4):
333      # run a specific double layer example      # run a specific double layer example
334        #str(ex_opr)+"-"+str( ex_num)+"-"+str(  opr_outer.name)
335      ex_opr = int(sys.argv[2])      ex_opr = int(sys.argv[2])
336      ex_num = int(sys.argv[3])      ex_num = int(sys.argv[3])
337      ex_outer= int(sys.argv[4])      ex_outer= int(sys.argv[4])
# Line 347  Line 358 
358      ex_opr = int(sys.argv[2])   #inside operator      ex_opr = int(sys.argv[2])   #inside operator
359      #ex_num = int(sys.argv[2])#inside type on list      #ex_num = int(sys.argv[2])#inside type on list
360      ex_outer2 = int(sys.argv[3])#outer binary operator      ex_outer2 = int(sys.argv[3])#outer binary operator
361      if(ex_outer2>6):      if(ex_outer2>len(op_binary )):
362          raise "outer2 needs to be less than 6"          raise Exception ("outer2 needs to be less than "+str(len(op_binary)))
363      #  ex_ty2 = int(sys.argv[4])      #  ex_ty2 = int(sys.argv[4])
364      rtn=[]      rtn=[]
365      #ex_opr=10      #ex_opr=10

Legend:
Removed from v.3997  
changed lines
  Added in v.3998

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0