提交 8a2e4d1f authored 作者: desjagui@atchoum.iro.umontreal.ca's avatar desjagui@atchoum.iro.umontreal.ca

merge

...@@ -18,3 +18,5 @@ Structure ...@@ -18,3 +18,5 @@ Structure
ccodegen ccodegen
function function
module module
profilemode
unittest
...@@ -124,6 +124,15 @@ automatic code generation, but that way is much, much slower. ...@@ -124,6 +124,15 @@ automatic code generation, but that way is much, much slower.
theano will try to create it with the correct permissions. If that fails, theano will try to create it with the correct permissions. If that fails,
an exception will be raised and no C code will be compiled. an exception will be raised and no C code will be compiled.
- `THEANO_DEFAULT_MODE`:
string value specifying the default mode to use when compiling theano
graphs. This can be one of the strings defined in theano.compile.mode
Possible values so far are: FAST_COMPILE, FAST_RUN and DEBUG_MODE.
Omitting this variable defaults the mode to FAST_RUN.
- `THEANO_UNITTEST_SEED`:
an integer value specifying which seed should be used when running unit tests.
Setting this value will make the unit tests deterministic.
--- ---
Mac Mac
......
...@@ -193,9 +193,3 @@ How to reuse (overwrite) a storage tensor ...@@ -193,9 +193,3 @@ How to reuse (overwrite) a storage tensor
``theano.compile.io.Out(gw1, borrow = True)`` for that value in ``theano.compile.io.Out(gw1, borrow = True)`` for that value in
``compile.function`` ``compile.function``
=========================================
ProfileMode
=========================================
*** write up how to use it ***
...@@ -14,7 +14,7 @@ from builders import * ...@@ -14,7 +14,7 @@ from builders import *
import module import module
from module import * from module import *
import debugmode import debugmode # register DEBUG_MODE
from profilemode import ProfileMode from profilemode import ProfileMode
...@@ -326,7 +326,7 @@ class Method(Component): ...@@ -326,7 +326,7 @@ class Method(Component):
mode=None mode=None
"""This will override the Module compilation mode for this Method""" """This will override the Module compilation mode for this Method"""
def __init__(self, inputs, outputs, updates = {}, mode=None, **kwupdates): def __init__(self, inputs, outputs, updates = {}, mode=None):
"""Initialize attributes """Initialize attributes
:param inputs: value for `Method.inputs` :param inputs: value for `Method.inputs`
...@@ -334,8 +334,6 @@ class Method(Component): ...@@ -334,8 +334,6 @@ class Method(Component):
:param updates: value for `Method.updates` :param updates: value for `Method.updates`
:param kwupdates: additions to `updates`
:param mode: value for `Method.mode` :param mode: value for `Method.mode`
:type inputs: list of (str or `Result` or `io.In`) :type inputs: list of (str or `Result` or `io.In`)
...@@ -345,15 +343,13 @@ class Method(Component): ...@@ -345,15 +343,13 @@ class Method(Component):
:type updates: dict of `Result` or str -> `Result` or str :type updates: dict of `Result` or str -> `Result` or str
:type kwupdates: extra updates
:type mode: None or any mode accepted by `compile.function` :type mode: None or any mode accepted by `compile.function`
""" """
super(Method, self).__init__() super(Method, self).__init__()
self.inputs = inputs self.inputs = inputs
self.outputs = outputs self.outputs = outputs
self.updates = dict(updates, **kwupdates) self.updates = dict(updates)
self.mode = mode self.mode = mode
def resolve_all(self): def resolve_all(self):
...@@ -367,7 +363,7 @@ class Method(Component): ...@@ -367,7 +363,7 @@ class Method(Component):
elif isinstance(x, _RComponent): elif isinstance(x, _RComponent):
return x.r return x.r
else: else:
raise Exception('damnit looks like we need this') raise Exception('Cannot resolve symbol', x)
# return self.resolve(x).r # return self.resolve(x).r
def resolve_inputs(): def resolve_inputs():
......
...@@ -11,19 +11,7 @@ class ProfileMode(Mode): ...@@ -11,19 +11,7 @@ class ProfileMode(Mode):
op_time = {} op_time = {}
op_cimpl = {} op_cimpl = {}
def blah(i, node, *thunks): def blah(i, node, th):
if 0:
t0 = time.time()
for th in thunks:
th()
dt = time.time() - t0
elif 0: #more precise timing
for th in thunks:
t0 = time.time()
th()
dt = time.time() - t0
elif 1:
for th in thunks:
if hasattr(th, 'cthunk'): if hasattr(th, 'cthunk'):
t0 = time.time() t0 = time.time()
run_cthunk(th.cthunk) run_cthunk(th.cthunk)
...@@ -32,14 +20,11 @@ class ProfileMode(Mode): ...@@ -32,14 +20,11 @@ class ProfileMode(Mode):
t0 = time.time() t0 = time.time()
th() th()
dt = time.time() - t0 dt = time.time() - t0
elif 1:
pass
else:
raise Exception('one of the cases has to run the thunks!')
local_time[0] += dt local_time[0] += dt
apply_time[(i,node.op)] = apply_time.get((i,node.op), 0.0) + dt apply_time[(i,node.op)] = apply_time.get((i,node.op), 0.0) + dt
op_time[node.op] = op_time.get(node.op, 0.0) + dt op_time[node.op] = op_time.get(node.op, 0.0) + dt
op_cimpl[node.op] = hasattr(thunks[0], 'cthunk') op_cimpl[node.op] = hasattr(th, 'cthunk')
self.local_time = local_time self.local_time = local_time
self.apply_time = apply_time self.apply_time = apply_time
...@@ -83,4 +68,3 @@ class ProfileMode(Mode): ...@@ -83,4 +68,3 @@ class ProfileMode(Mode):
%(max(0, len(otimes)-n_ops_to_print), sum(t for t, a, ci in %(max(0, len(otimes)-n_ops_to_print), sum(t for t, a, ci in
otimes[n_ops_to_print:])) otimes[n_ops_to_print:]))
print '(*) Op is running a c implementation' print '(*) Op is running a c implementation'
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论