File size: 2,701 Bytes
63dd946
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# The serving stack, topology B: ONE Triton per GPU, as many as there are GPUs to use.
#   triton/compose/scale.sh auto       # a Triton per GPU, the gateway on the host, prometheus, grafana, dcgm
#   triton/compose/scale.sh 0          # stop everything (Triton drains in-flight requests: exit timeout 30 s < grace 45 s)
# The Triton services (triton-0, triton-1, ...) are not listed here: scale.sh writes one per GPU into
# artifacts/compose/tritons.yml and passes it to Compose beside this file, with the settings they share. Each
# container sees only its own GPU (NVIDIA_VISIBLE_DEVICES=UUID) and holds that GPU's network model (diar_nn_g<i>,
# instance device 0) and resample_cpu; its cpuset is its GPU's NUMA node.
# The gateway runs on the host, not in a container: its exactness is tested with the host's libraries (glibc's
# exp/log, numpy's OpenBLAS, libsndfile). Every published port binds 127.0.0.1.

services:
  dcgm-exporter:
    image: nvcr.io/nvidia/k8s/dcgm-exporter:3.3.9-3.6.1-ubuntu22.04
    profiles: [obs]
    runtime: nvidia
    cap_add: [SYS_ADMIN]
    environment: [NVIDIA_VISIBLE_DEVICES=all]
    command: ["-f", "/etc/dcgm-exporter/counters.csv", "-c", "1000"]
    volumes: ["./dcgm_counters.csv:/etc/dcgm-exporter/counters.csv:ro"]
    ports: ["127.0.0.1:${DCGM_PORT}:9400"]
    restart: unless-stopped

  # host network, listening on 127.0.0.1 only: it scrapes the gateway, which listens on the host's loopback. It runs
  # as your account so that it can read the gateway's token file (mode 0600) and keeps its data under artifacts/.
  prometheus:
    image: prom/prometheus:v3.11.0
    profiles: [obs]
    network_mode: host
    user: "${HOST_UID}:${HOST_GID}"
    command: ["--config.file=/etc/prometheus/prometheus.yml", "--storage.tsdb.path=/prometheus",
              "--storage.tsdb.retention.time=15d", "--web.listen-address=127.0.0.1:${PROM_PORT}"]
    volumes: ["${PROM_CONFIG}:/etc/prometheus/prometheus.yml:ro", "${GATEWAY_TOKEN_FILE}:/etc/prometheus/gateway_token:ro",
              "${PROM_DATA}:/prometheus"]
    restart: unless-stopped

  grafana:
    image: grafana/grafana:12.4.2
    profiles: [obs]
    network_mode: host
    environment:
      - GF_SERVER_HTTP_ADDR=127.0.0.1
      - GF_SERVER_HTTP_PORT=${GRAFANA_PORT}
      - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
      # the loopback is shared by every account on the machine
      - GF_AUTH_ANONYMOUS_ENABLED=false
      - PROM_URL=http://127.0.0.1:${PROM_PORT}
    volumes: ["./grafana/provisioning:/etc/grafana/provisioning:ro", "./grafana/dashboards:/var/lib/grafana/dashboards:ro",
              "grafana-data:/var/lib/grafana"]
    restart: unless-stopped

volumes:
  grafana-data: {}