perf: Improve performance by reducing redundant pynvml.nvmlInit call
### perf: Call nvmlInit() and nvmlShutdown() only once (fixes #54)
Lots of time is spent on nvmlInit() and nvmlShutdown() for each
new_query call. When running in a loop mode (-i), we do not need to
initialize and shutdown the nvml library because nvml APIs will be used
throughout the lifespan of the gpustat process.
Upon importing `gpustat.pynvml`, nvmlInit() will always be called.
合并状态:未合并 关闭于 2023-11-24 1 条评论