GPU 入门

2025-03-02 · 1 分钟阅读时长

磁盘

lsblk | awk '
  /disk/ {
    if ($1 ~ /^sd/) {
      type = "SATA";
    } else if ($1 ~ /^nvme/) {
      type = "NVME";
    } else if ($1 ~ /^vd/) {
      type = "VIRTIO";  # 新增虚拟化磁盘类型
    } else {
      type = "OTHER";    # 未知类型归类
    }
    size = $4;
    count[type][size]++;
  }
  END {
    # 遍历所有类型输出
    for (t in count) {
      for (s in count[t]) {
        printf "%s %s * %d\n", t, s, count[t][s];
      }
    }
  }'

网卡

devices_info=$(ibv_devices | awk 'NR>2 {print $1}' | xargs -I {} sh -c 'rate=$(ibstat {} | grep "Rate" | awk "{print \$2 \" Gb/s\"}"); firmware=$(ibstat {} | grep "Firmware version" | awk "{print \$3}"); echo "{}: Firmware: $firmware, Rate: $rate"')
echo "$devices_info"

echo "总结:"
echo "$devices_info" | grep -oP 'Rate: \K\d+' | sort | uniq -c | awk '{print $2 " Gb/s * " $1}'
叶王
Authors
资深研发工程师

本文访问量

本站总访问量

本站总访客数