Skip to content

lampaa/nvidia-smi-rest

Repository files navigation

What is it?

Smi Rest - service for obtaining GPU data in a convenient format and collecting statistics.

How to install?

  1. For Windows and Linux, needs to install the nvidia driver https://www.nvidia.com/Download/index.aspx
  2. For use without containerization, install Java 11 https://adoptopenjdk.net/
  3. For use with containerization, install docker, docker-compose https://docs.docker.com/get-docker/
  4. To use in Docker, you need to install the NVIDIA Container Toolkit https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker

Without Docker

With Docker

  • Run docker-compose -d up

REST API

alt text

Maven dependency

<dependency>
    <groupId>com.github.lampaa</groupId>
    <artifactId>smirest</artifactId>
    <version>0.0.2</version>
</dependency>

How to use

NvidiaSmiLogType smi = SmiReader.read(); // read from system
NvidiaSmiLogType smi = SmiReader.read(new File("smi_log.xml")); // read from xml file
NvidiaSmiLogType smi = SmiReader.read(new FileInputStream("smi_log.xml")); // read from input stream
NvidiaSmiLogType smi = SmiReader.read("<xml>...</xml>"); // from string
NvidiaSmiLogType smi = SmiReader.read(new StringReader("<xml>...</xml>")); // from reader

Documentation