Revision 1851
Added by Aaron Marcuse-Kubitza almost 13 years ago
map | ||
---|---|---|
70 | 70 |
if end != None: end += start |
71 | 71 |
|
72 | 72 |
# Optimization |
73 |
cpus = util.cast(int, opts.get_env_var('cpus', None, env_names)) |
|
73 |
if test: cpus_default = 0 |
|
74 |
else: cpus_default = None |
|
75 |
cpus = util.cast(int, opts.get_env_var('cpus', cpus_default, env_names)) |
|
74 | 76 |
|
75 | 77 |
# Debugging |
76 | 78 |
debug = opts.env_flag('debug', False, env_names) |
... | ... | |
111 | 113 |
ex_tracker = exc.ExPercentTracker(iter_text='row') |
112 | 114 |
profiler = profiling.ItersProfiler(start_now=True, iter_text='row') |
113 | 115 |
|
114 |
try: import pp |
|
115 |
except ImportError: cpus = 0 |
|
116 | 116 |
if cpus != 0: |
117 |
if cpus != None: args = [cpus] |
|
118 |
else: args = [] |
|
119 |
job_server = pp.Server(*args) |
|
120 |
log_start('Using '+str(job_server.get_ncpus())+' CPUs') |
|
117 |
try: import pp |
|
118 |
except ImportError: pass |
|
119 |
else: |
|
120 |
if cpus != None: args = [cpus] |
|
121 |
else: args = [] |
|
122 |
job_server = pp.Server(*args) |
|
123 |
log_start('Using '+str(job_server.get_ncpus())+' CPUs') |
|
121 | 124 |
|
122 | 125 |
doc = xml_dom.create_doc() |
123 | 126 |
root = doc.documentElement |
Also available in: Unified diff
bin/map: Don't import pp unless cpus != 0 because it's slow and doesn't need to happen if we're not using parallelization. cpus option defaults to 0 in test mode so tests run faster.