-
-
Notifications
You must be signed in to change notification settings - Fork 720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move SystemMonitor's GPU initialization back to constructor #4866
Changes from 2 commits
d860e58
80224a8
ddf9a43
79b315b
8218605
95d93f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -40,8 +40,9 @@ def __init__(self, n=10000): | |||
self.quantities["num_fds"] = self.num_fds | ||||
|
||||
if nvml is not None: | ||||
self.gpu_name = None | ||||
self.gpu_memory_total = None | ||||
gpu_extra = nvml.one_time() | ||||
self.gpu_name = gpu_extra["name"] | ||||
self.gpu_memory_total = gpu_extra["memory-total"] | ||||
self.gpu_utilization = deque(maxlen=n) | ||||
self.gpu_memory_used = deque(maxlen=n) | ||||
self.quantities["gpu_utilization"] = self.gpu_utilization | ||||
|
@@ -92,10 +93,6 @@ def update(self): | |||
|
||||
# give external modules (like dask-cuda) a chance to initialize CUDA context | ||||
if nvml is not None and nvml.nvmlInit is not None: | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not redundant, this is what I mentioned earlier when I also thought it was. It refers to the object in
pynvml.nvmlInit method. I think that's a confusing naming choice nevertheless but I won't touch it right now.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with that; I'm referring to the fact that by the time we call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah sorry, you're right, good catch. I've updated that in 79b315b . |
||||
if self.gpu_name is None: | ||||
gpu_extra = nvml.one_time() | ||||
self.gpu_name = gpu_extra["name"] | ||||
self.gpu_memory_total = gpu_extra["memory-total"] | ||||
gpu_metrics = nvml.real_time() | ||||
self.gpu_utilization.append(gpu_metrics["utilization"]) | ||||
self.gpu_memory_used.append(gpu_metrics["memory-used"]) | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicky but at this point could we just call
pynvml.nvmlDeviceGetHandleByIndex(0)
in the places where we used to callnvml._pynvml_handles()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in ddf9a43