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

merge

......@@ -18,3 +18,5 @@ Structure
ccodegen
function
module
profilemode
unittest
......@@ -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,
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
......
......@@ -193,9 +193,3 @@ How to reuse (overwrite) a storage tensor
``theano.compile.io.Out(gw1, borrow = True)`` for that value in
``compile.function``
=========================================
ProfileMode
=========================================
*** write up how to use it ***
......@@ -14,7 +14,7 @@ from builders import *
import module
from module import *
import debugmode
import debugmode # register DEBUG_MODE
from profilemode import ProfileMode
......@@ -326,7 +326,7 @@ class Method(Component):
mode=None
"""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
:param inputs: value for `Method.inputs`
......@@ -334,8 +334,6 @@ class Method(Component):
:param updates: value for `Method.updates`
:param kwupdates: additions to `updates`
:param mode: value for `Method.mode`
:type inputs: list of (str or `Result` or `io.In`)
......@@ -345,15 +343,13 @@ class Method(Component):
:type updates: dict of `Result` or str -> `Result` or str
:type kwupdates: extra updates
:type mode: None or any mode accepted by `compile.function`
"""
super(Method, self).__init__()
self.inputs = inputs
self.outputs = outputs
self.updates = dict(updates, **kwupdates)
self.updates = dict(updates)
self.mode = mode
def resolve_all(self):
......@@ -367,7 +363,7 @@ class Method(Component):
elif isinstance(x, _RComponent):
return x.r
else:
raise Exception('damnit looks like we need this')
raise Exception('Cannot resolve symbol', x)
# return self.resolve(x).r
def resolve_inputs():
......
......@@ -11,35 +11,20 @@ class ProfileMode(Mode):
op_time = {}
op_cimpl = {}
def blah(i, node, *thunks):
if 0:
t0 = time.time()
for th in thunks:
th()
def blah(i, node, th):
if hasattr(th, 'cthunk'):
t0 = time.time()
run_cthunk(th.cthunk)
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'):
t0 = time.time()
run_cthunk(th.cthunk)
dt = time.time() - t0
else:
t0 = time.time()
th()
dt = time.time() - t0
elif 1:
pass
else:
raise Exception('one of the cases has to run the thunks!')
t0 = time.time()
th()
dt = time.time() - t0
local_time[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_cimpl[node.op] = hasattr(thunks[0], 'cthunk')
op_cimpl[node.op] = hasattr(th, 'cthunk')
self.local_time = local_time
self.apply_time = apply_time
......@@ -83,4 +68,3 @@ class ProfileMode(Mode):
%(max(0, len(otimes)-n_ops_to_print), sum(t for t, a, ci in
otimes[n_ops_to_print:]))
print '(*) Op is running a c implementation'
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论