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