提交 61fdba77 authored 作者: Roy Xue's avatar Roy Xue

Add CPU/GPU check

Questions remaining: here the import relation is really strange, so i use a new import here.
上级 b66e9db2
......@@ -689,7 +689,6 @@ class ProfileStats(object):
The sum of memory saved by reusing the input instead of
new allocation
"""
node_memory_size = 0
running_memory_size = 0
running_max_memory_size = 0
......@@ -786,9 +785,18 @@ class ProfileStats(object):
# memory isn't freed
pass
# CPU/GPU check
for var in fgraph.variables:
from theano.sandbox.cuda import CudaNdarrayType
if isinstance(var.type, CudaNdarrayType):
cg_check = 'GPU'
else:
cg_check = 'CPU'
break
return [node_memory_size, running_memory_size,
running_max_memory_size, node_memory_saved_by_inplace,
node_memory_saved_by_view]
node_memory_saved_by_view, cg_check]
def count_minimum_peak(node_list, fgraph, nodes_mem):
global mem_count, mem_bound, max_mem_count
......@@ -1036,6 +1044,8 @@ class ProfileStats(object):
# print >> file, " Max if no gc, inplace and view: %dKB" % int(
# round(max_sum_size / 1024))
# print >> file, " Running on %s" % (new_running_memory[5])
print >> file, " Max if no gc (allow_gc=False): %dKB (%dKB)" % (int(round(
new_max_node_memory_size / 1024.)), int(round(
max_node_memory_size / 1024.)))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论