##// END OF EJS Templates
python3 syntax fixes on various scripts...
Min RK -
Show More
@@ -14,6 +14,8 something like 'current' as a stable URL for the most current version of the """
14 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
15 # Imports
15 # Imports
16 #-----------------------------------------------------------------------------
16 #-----------------------------------------------------------------------------
17 from __future__ import print_function
18
17 import os
19 import os
18 import shutil
20 import shutil
19 import sys
21 import sys
@@ -121,13 +123,13 if __name__ == '__main__':
121
123
122 sh('git add -A %s' % tag)
124 sh('git add -A %s' % tag)
123 sh('git commit -m"Updated doc release: %s"' % tag)
125 sh('git commit -m"Updated doc release: %s"' % tag)
124 print
126 print()
125 print 'Most recent 3 commits:'
127 print('Most recent 3 commits:')
126 sys.stdout.flush()
128 sys.stdout.flush()
127 sh('git --no-pager log --oneline HEAD~3..')
129 sh('git --no-pager log --oneline HEAD~3..')
128 finally:
130 finally:
129 cd(startdir)
131 cd(startdir)
130
132
131 print
133 print()
132 print 'Now verify the build in: %r' % dest
134 print('Now verify the build in: %r' % dest)
133 print "If everything looks good, 'git push'"
135 print("If everything looks good, 'git push'")
@@ -207,10 +207,10 latex_font_size = '11pt'
207
207
208 latex_documents = [
208 latex_documents = [
209 ('index', 'ipython.tex', 'IPython Documentation',
209 ('index', 'ipython.tex', 'IPython Documentation',
210 ur"""The IPython Development Team""", 'manual', True),
210 u"""The IPython Development Team""", 'manual', True),
211 ('parallel/winhpc_index', 'winhpc_whitepaper.tex',
211 ('parallel/winhpc_index', 'winhpc_whitepaper.tex',
212 'Using IPython on Windows HPC Server 2008',
212 'Using IPython on Windows HPC Server 2008',
213 ur"Brian E. Granger", 'manual', True)
213 u"Brian E. Granger", 'manual', True)
214 ]
214 ]
215
215
216 # The name of an image file (relative to this directory) to place at the top of
216 # The name of an image file (relative to this directory) to place at the top of
@@ -16,6 +16,7 impose the aggregation function to be commutative and distributive. It might
16 not be the case if you implement the naive gather / reduce / broadcast strategy
16 not be the case if you implement the naive gather / reduce / broadcast strategy
17 where you can reorder the partial data before performing the reduce.
17 where you can reorder the partial data before performing the reduce.
18 """
18 """
19 from __future__ import print_function
19
20
20 from IPython.parallel import Client, Reference
21 from IPython.parallel import Client, Reference
21
22
@@ -31,12 +32,12 root = rc[root_id]
31 view = rc[:]
32 view = rc[:]
32
33
33 # run bintree.py script defining bintree functions, etc.
34 # run bintree.py script defining bintree functions, etc.
34 execfile('bintree.py')
35 exec(compile(open('bintree.py').read(), 'bintree.py', 'exec'))
35
36
36 # generate binary tree of parents
37 # generate binary tree of parents
37 btree = bintree(ids)
38 btree = bintree(ids)
38
39
39 print "setting up binary tree interconnect:"
40 print("setting up binary tree interconnect:")
40 print_bintree(btree)
41 print_bintree(btree)
41
42
42 view.run('bintree.py')
43 view.run('bintree.py')
@@ -73,15 +74,15 view['add'] = add
73 view['mul'] = mul
74 view['mul'] = mul
74
75
75 # scatter some data
76 # scatter some data
76 data = range(1000)
77 data = list(range(1000))
77 view.scatter('data', data)
78 view.scatter('data', data)
78
79
79 # perform cumulative sum via allreduce
80 # perform cumulative sum via allreduce
80 view.execute("data_sum = com.allreduce(add, data, flat=False)")
81 view.execute("data_sum = com.allreduce(add, data, flat=False)")
81 print "allreduce sum of data on all engines:", view['data_sum']
82 print("allreduce sum of data on all engines:", view['data_sum'])
82
83
83 # perform cumulative sum *without* final broadcast
84 # perform cumulative sum *without* final broadcast
84 # when not broadcasting with allreduce, the final result resides on the root node:
85 # when not broadcasting with allreduce, the final result resides on the root node:
85 view.execute("ids_sum = com.reduce(add, id, flat=True)")
86 view.execute("ids_sum = com.reduce(add, id, flat=True)")
86 print "reduce sum of engine ids (not broadcast):", root['ids_sum']
87 print("reduce sum of engine ids (not broadcast):", root['ids_sum'])
87 print "partial result on each engine:", view['ids_sum']
88 print("partial result on each engine:", view['ids_sum'])
@@ -111,7 +111,7 if __name__ == '__main__':
111 assert partition[0]*partition[1] == num_procs, "can't map partition %s to %i engines"%(partition, num_procs)
111 assert partition[0]*partition[1] == num_procs, "can't map partition %s to %i engines"%(partition, num_procs)
112
112
113 view = rc[:]
113 view = rc[:]
114 print "Running %s system on %s processes until %f"%(grid, partition, tstop)
114 print("Running %s system on %s processes until %f" % (grid, partition, tstop))
115
115
116 # functions defining initial/boundary/source conditions
116 # functions defining initial/boundary/source conditions
117 def I(x,y):
117 def I(x,y):
@@ -170,7 +170,7 if __name__ == '__main__':
170 else:
170 else:
171 norm = -1
171 norm = -1
172 t1 = time.time()
172 t1 = time.time()
173 print 'scalar inner-version, Wtime=%g, norm=%g'%(t1-t0, norm)
173 print('scalar inner-version, Wtime=%g, norm=%g' % (t1-t0, norm))
174
174
175 impl['inner'] = 'vectorized'
175 impl['inner'] = 'vectorized'
176 # setup new solvers
176 # setup new solvers
@@ -188,7 +188,7 if __name__ == '__main__':
188 else:
188 else:
189 norm = -1
189 norm = -1
190 t1 = time.time()
190 t1 = time.time()
191 print 'vector inner-version, Wtime=%g, norm=%g'%(t1-t0, norm)
191 print('vector inner-version, Wtime=%g, norm=%g' % (t1-t0, norm))
192
192
193 # if ns.save is True, then u_hist stores the history of u as a list
193 # if ns.save is True, then u_hist stores the history of u as a list
194 # If the partion scheme is Nx1, then u can be reconstructed via 'gather':
194 # If the partion scheme is Nx1, then u can be reconstructed via 'gather':
@@ -12,7 +12,7 ipdir = get_ipdir()
12 cd(ipdir)
12 cd(ipdir)
13
13
14 # Load release info
14 # Load release info
15 execfile(pjoin('IPython', 'core', 'release.py'))
15 execfile(pjoin('IPython', 'core', 'release.py'), globals())
16
16
17 # Check that everything compiles
17 # Check that everything compiles
18 compile_tree()
18 compile_tree()
@@ -8,6 +8,7 Usage:
8 It prints summaries and if chosen, line-by-line info of where \\t or \\r
8 It prints summaries and if chosen, line-by-line info of where \\t or \\r
9 characters can be found in our source tree.
9 characters can be found in our source tree.
10 """
10 """
11 from __future__ import print_function
11
12
12 # Config
13 # Config
13 # If true, all lines that have tabs are printed, with line number
14 # If true, all lines that have tabs are printed, with line number
@@ -33,22 +34,22 for f in path('..').walkfiles('*.py'):
33 rets.append(f)
34 rets.append(f)
34
35
35 if errs:
36 if errs:
36 print "%3s" % errs, f
37 print("%3s" % errs, f)
37
38
38 if 't' in errs and full_report_tabs:
39 if 't' in errs and full_report_tabs:
39 for ln,line in enumerate(f.lines()):
40 for ln,line in enumerate(f.lines()):
40 if '\t' in line:
41 if '\t' in line:
41 print 'TAB:',ln,':',line,
42 print('TAB:',ln,':',line, end=' ')
42
43
43 if 'r' in errs and full_report_rets:
44 if 'r' in errs and full_report_rets:
44 for ln,line in enumerate(open(f.abspath(),'rb')):
45 for ln,line in enumerate(open(f.abspath(),'rb')):
45 if '\r' in line:
46 if '\r' in line:
46 print 'RET:',ln,':',line,
47 print('RET:',ln,':',line, end=' ')
47
48
48 # Summary at the end, to call cleanup tools if necessary
49 # Summary at the end, to call cleanup tools if necessary
49 if tabs:
50 if tabs:
50 print 'Hard tabs found. These can be cleaned with untabify:'
51 print('Hard tabs found. These can be cleaned with untabify:')
51 for f in tabs: print f,
52 for f in tabs: print(f, end=' ')
52 if rets:
53 if rets:
53 print 'Carriage returns (\\r) found in:'
54 print('Carriage returns (\\r) found in:')
54 for f in rets: print f,
55 for f in rets: print(f, end=' ')
General Comments 0
You need to be logged in to leave comments. Login now