* Unittest and ProfileMode documentation

* fixed small bug in ProfileMode, which wasn't being triggered
上级 221e2176
...@@ -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
...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论