MoseleyBioinformaticsLab / gpu_tracker

Context manager and CLI that tracks the computational-resource-usage of a code block or shell command, particularly the GPU usage.
Other
4 stars 1 forks source link

Problem with Tracking GPU Info #43

Closed alpharmike closed 1 month ago

alpharmike commented 1 month ago

Hello

I was trying to utilize the tracker (v3.0.0), but I'm facing an error indicating that a wrong attribute has been used for the Pandas DataFrame object:

Traceback (most recent call last):
  File "/app/main.py", line 80, in <module>
    with gput.Tracker(sleep_time=1, time_unit='seconds', n_expected_cores=1) as tracker:
  File "/opt/conda/lib/python3.10/site-packages/gpu_tracker/tracker.py", line 317, in __init__
    self._tracking_process = _TrackingProcess(
  File "/opt/conda/lib/python3.10/site-packages/gpu_tracker/tracker.py", line 80, in __init__
    gpu_info = _TrackingProcess._query_gpu(nvidia_command='--query-gpu=uuid,memory.total')
  File "/opt/conda/lib/python3.10/site-packages/gpu_tracker/tracker.py", line 237, in _query_gpu
    return gpu_info.map(lambda value: value.strip() if type(value) is str else value)
  File "/opt/conda/lib/python3.10/site-packages/pandas/core/generic.py", line 5902, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'map'. Did you mean: 'mad'?

I would appreciate your support/fix for this issue.

erikhuck commented 1 month ago

@alpharmike I've encountered this error before as well. This is likely a result of using an outdated version of pandas in your environment. Can you try updating to the latest version of pandas and see if that resolves the error?

alpharmike commented 1 month ago

@alpharmike I've encountered this error before as well. This is likely a result of using an outdated version of pandas in your environment. Can you try updating to the latest version of pandas and see if that resolves the error?

Thanks for your quick reply.

Your point is actually valid. After consulting the Pandas documentation, it seems like the map method for DataFrame object has been introduced with Pandas 2.1.0, but I was using Pandas 1.5.3.

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.map.html

I'm closing the issue now.

erikhuck commented 1 month ago

Glad that worked @alpharmike and thank you for using the gpu-tracker package! I hope it continues to prove useful for you!