In [1]:
from gpumon.file import log_context
device_name and device_count will return the name of the GPU found on the system and the number of GPUs
In [2]:
from gpumon import device_name, device_count
In [22]:
device_count() # Returns the number of GPUs available
Out[22]:
In [5]:
device_name() # Returns the type of GPU available
Out[5]:
In [6]:
from bokeh.io import output_notebook, show
import time
In [7]:
output_notebook()
Here we are simply going to tell the log context to record GPU measurements to the file test_gpu.txt
In [8]:
with log_context('test_gpu.txt') as log:
time.sleep(10)
We can then cat the file to see what we recorded in the 10 seconds
In [9]:
!cat test_gpu.txt
By calling the log object we get all the data returned to us in a dataframe
In [10]:
df = log()
In [11]:
df
Out[11]:
We can also call plot on the log object to plot the measurements we want
In [21]:
p = log.plot(gpu_measurement='pwr', num_gpus=4)
In [20]:
show(p)