inventory.fact 581 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. INVENTORY=$(mktemp lspci.XXXXXXXX)
  3. lspci > $INVENTORY
  4. NVIDIA_GPU=$(cat $INVENTORY | grep -i nvidia | wc -l)
  5. XILINX_FPGA=$(cat $INVENTORY | grep "Processing accelerators: Xilinx Corporation Device" | wc -l)
  6. INTEL_A10_FPGA=$(cat $INVENTORY | grep "Processing accelerators: Intel Corporation Device" | wc -l)
  7. AMD_GPU=$(cat $INVENTORY | grep "Display controller: Advanced Micro Devices, Inc. \[AMD/ATI\]" | wc -l)
  8. cat << EOF
  9. {
  10. "xilinx_fpga" : $XILINX_FPGA,
  11. "nvidia_gpu" : $NVIDIA_GPU,
  12. "amd_gpu" : $AMD_GPU,
  13. "intel_a10_fpga" : $INTEL_A10_FPGA
  14. }
  15. EOF
  16. rm -f $INVENTORY