Check out the latest superpixel benchmark — Superpixel Benchmark (2016) — and let me know your opinion! @david_stutz

SERIES»Working with Ubuntu«

Monitoring GPU Usage, CUDA_VISIBLE_DEVICES Issues and HDF5 for Torch

This series collects every-day problems when doing research and development with Ubuntu; this time: comfortably monitoring GPU usage, clarifying issues with CUDA_VISIBLE_DEVICES and HDF5 for Torch.

nvidia-smi is a convenient tool; however, for continuously monitoring GPU usage in the spirit of htop it is not very suitable. There are of course some workaround as described here and here, for example:

$ nvidia-smi --loop-ms=1000

Instead, I recently came across gpustat:

$ sudo pip install gpustat

gpustat allows more convenient monitoring, as illustrated by this screenshot:

I recently came into a problem when using two graphics cards and CUDA: this discussion suggests that the ids shown by nvidia-smi do not necessarily reflect the true ids used with CUDA_VISIBLE_DEVICES to tell CUDA which graphics cards are available for computation. While I did not find a workaround, I found that CUDA_VISIBLE_DEVICES also works with the graphics cards UUIDs (read about the details here). These look for example like:


and as of my experience are correctly given by nvidia-smi.

To install HDF5 for Torch:

$ sudo apt-get install libhdf5-dev

Note that there is a HDF5 package for Lua, however, I preferred the torch-hdf5 package by Deepmind:

# regualr hdf5 package:
# luarocks install hdf5 --local
# Torch HDF5 package:
$ sudo apt-get install libhdf5-serial-dev hdf5-tools
$ git clone https://github.com/deepmind/torch-hdf5 torch-hdf5-master
$ cd torch-hdf5-master
$ luarocks make hdf5-0-0.rockspec

More from »Working with Ubuntu«:

What is your opinion on this article? Did you find it interesting or useful? Let me know your thoughts in the comments below or get in touch with me: