Skip to content

Commit

Permalink
Merge pull request #24 from zijwang/fix_attrlist
Browse files Browse the repository at this point in the history
Fix attrList no-effect issue. Close #22 #27
  • Loading branch information
anderskm authored Aug 16, 2019
2 parents 47e1e0f + a4bf18d commit 42ef071
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion GPUtil/GPUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ def showUtilization(all=False, attrList=None, useOldCode=False):
print('--------------')
for gpu in GPUs:
print(' {0:2d} {1:3.0f}% {2:3.0f}%'.format(gpu.id, gpu.load*100, gpu.memoryUtil*100))
else:
elif attrList is None:
# if `attrList` was not specified, use the default one
attrList = [[{'attr':'id','name':'ID'},
{'attr':'load','name':'GPU','suffix':'%','transform': lambda x: x*100,'precision':0},
{'attr':'memoryUtil','name':'MEM','suffix':'%','transform': lambda x: x*100,'precision':0}],
Expand Down

0 comments on commit 42ef071

Please sign in to comment.