def print_mem(context=None):
if theano.sandbox.cuda.cuda_enabled:
rvals = theano.sandbox.cuda.cuda_ndarray.cuda_ndarray.mem_info()
# Avaliable memory in Mb
available = float(rvals[0]) / 1024. / 1024.
# Total memory in Mb
total = float(rvals[1]) / 1024. / 1024.
if context == None:
print ('Used %.3f Mb Free %.3f Mb, total %.3f Mb' %
(total - available, available, total))
else:
info = str(context)
print (('GPU status : Used %.3f Mb Free %.3f Mb,'
'total %.3f Mb [context %s]') %
(total - available, available, total, info))
评论列表
文章目录