$ git submodule update --init --recursive -f$ make build-containerFollow either of the two methods below to build gpuagent and gpuctl binaries
vendor setup workspace for manual building (required once)
-
choose build/developer environment
- rhel9
[user@host]# GPUAGENT_BLD_CONTAINER_IMAGE=gpuagent-builder-rhel:9 make docker-shell- ubuntu 22.04
[user@host]# GPUAGENT_BLD_CONTAINER_IMAGE=gpuagent-bldr-ubuntu:22.04 make docker-shell -
golang dependency setup (required once)
[user@build-container ]# make gopkglist -
golang vendor setup
[user@build-container ]# cd sw/nic/gpuagent/ [user@build-container ]# go mod vendor
-
bild gpuagent (within build-container)
[user@build-container ]# make
Choose build base os
-
rhel9
[user@host]# GPUAGENT_BLD_CONTAINER_IMAGE=gpuagent-builder-rhel:9 make gpuagent -
ubuntu 22.04
[user@host]# GPUAGENT_BLD_CONTAINER_IMAGE=gpuagent-bldr-ubuntu:22.04 make gpuagent
- gpuagent binary can be found at - ${TOP_DIR}/sw/nic/build/x86_64/sim/bin/gpuagent
- gpuctl binary can be found at - ${TOP_DIR}/sw/nic/build/x86_64/sim/bin/gpuctl
[root@dev gpu-agent]# make -C sw/nic/gpuagent clean
[root@dev gpu-agent]# gpuagent-wsl is a variant of gpuagent that uses AMD's librocdxg amdsmi backend
to monitor GPUs from within Windows Subsystem for Linux 2 (WSL2).
- WSL2 kernel with
/dev/dxgpresent (Windows 11 or Windows 10 22H2+). - rocdxg-amd-smi-lib installed at
/opt/rocm-wsl(override withWSL_AMD_SMI_LIB_DIR=<path>). - Third-party libs pre-built (run
make build-libs-dockeronce if not already done).
| Target | Description |
|---|---|
make gpuagent_wsl |
Native WSL2 build (no Docker). Requires librocdxg at /opt/rocm-wsl. |
make gpuagent_wsl_docker |
Build inside the RHEL9 container with a stub libamd_smi.so — verifies compile and link without real hardware. |
make build-libs-docker |
Compile third-party libs inside the container (required once before make gpuagent_wsl). |
make wsl-shim |
Build the LD_PRELOAD shim (wsl-shim/). Install with make -C wsl-shim install. |
The wsl-shim (wsl-shim/wsl_amdsmi_shim.cc) is an LD_PRELOAD shared library that
intercepts libamd_smi calls and redirects them to librocdxg on WSL2. It is
installed to /usr/local/metrics/lib/libamd_smi_shim.so. Use it when running an
existing gpuagent binary on WSL2 without rebuilding:
LD_PRELOAD=/usr/local/metrics/lib/libamd_smi_shim.so gpuagentThe following metrics are not available through librocdxg and will report as unavailable (AMD SMI NA sentinel):
voltage_soc(no VDDSOC sensor; only VDDGFX is exposed)pcie_bandwidth_acc(instantaneous Mb/s only; no accumulated byte counter)- Violation statistics (throttling events)
- Fan speed
sw/nic/build/x86_64/sim/bin/gpuagent-wsl
- For updating any amdsmi library to any other version, make sure the libamdsmi.so libraries are built correctly and are available in sw/nic/build/x86_64/sim/lib/ path. These are required during runtime, mismatch in library version may lead to runtime issues. These libraries are built from amdsmi git. The commit/tag the current gpuagent is built on can be found in file
- apply patches on amdsmi found in here
- amdsmi build instructions are available here
- If you face any issue with golang dependencies, re-run
make gopkglistandgo mod vendorcommand. - some go files are generated during build time, if you face any issue related to missing files, run
make gpuagentcommand within build-container, then re-rungo mod vendorcommand.