python 验证 tensorflow 是否可用 GPU

显摆一下,8 个 V100 GPU。
一通乱杀,感觉 GPU 已经好了。
自己都不知道怎么搞好的。

$ python3.9
Python 3.9.12 (main, Apr 16 2022, 19:31:36)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
print>>>
>>> print(tf.__version__)
2.8.0
>>> print("num gpus:", len(tf.config.list_physical_devices('GPU')))
num gpus: 8
>>> from tensorflow.python.client import device_lib
>>> print(device_lib.list_local_devices())
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 6336738906453244865
xla_global_id: -1
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 32463847424
locality {
  bus_id: 1
  links {
    link {
      device_id: 1
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 2
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 3
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 4
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 5
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 6
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 7
      type: "StreamExecutor"
      strength: 1
    }
  }
}
incarnation: 13475240345492349433
physical_device_desc: "device: 0, name: Tesla V100-SXM2-32GB, pci bus id: 0000:1a:00.0, compute capability: 7.0"
xla_global_id: 416903419
, name: "/device:GPU:1"
device_type: "GPU"
memory_limit: 32463847424
locality {
  bus_id: 1
  links {
    link {
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 2
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 3
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 4
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 5
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 6
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 7
      type: "StreamExecutor"
      strength: 1
    }
  }
}
incarnation: 3089231618543872242
physical_device_desc: "device: 1, name: Tesla V100-SXM2-32GB, pci bus id: 0000:1b:00.0, compute capability: 7.0"
xla_global_id: 2144165316
, name: "/device:GPU:2"
device_type: "GPU"
memory_limit: 32463847424
locality {
  bus_id: 1
  links {
    link {
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 1
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 3
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 4
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 5
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 6
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 7
      type: "StreamExecutor"
      strength: 1
    }
  }
}
incarnation: 14165301483984424139
physical_device_desc: "device: 2, name: Tesla V100-SXM2-32GB, pci bus id: 0000:3d:00.0, compute capability: 7.0"
xla_global_id: 1651660799
, name: "/device:GPU:3"
device_type: "GPU"
memory_limit: 32463847424
locality {
  bus_id: 1
  links {
    link {
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 1
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 2
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 4
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 5
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 6
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 7
      type: "StreamExecutor"
      strength: 1
    }
  }
}
incarnation: 9335437149881444734
physical_device_desc: "device: 3, name: Tesla V100-SXM2-32GB, pci bus id: 0000:3e:00.0, compute capability: 7.0"
xla_global_id: 878896533
, name: "/device:GPU:4"
device_type: "GPU"
memory_limit: 32463847424
locality {
  bus_id: 2
  numa_node: 1
  links {
    link {
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 1
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 2
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 3
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 5
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 6
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 7
      type: "StreamExecutor"
      strength: 1
    }
  }
}
incarnation: 8282065356596082067
physical_device_desc: "device: 4, name: Tesla V100-SXM2-32GB, pci bus id: 0000:88:00.0, compute capability: 7.0"
xla_global_id: 615190153
, name: "/device:GPU:5"
device_type: "GPU"
memory_limit: 32463847424
locality {
  bus_id: 2
  numa_node: 1
  links {
    link {
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 1
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 2
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 3
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 4
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 6
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 7
      type: "StreamExecutor"
      strength: 1
    }
  }
}
incarnation: 13181952684936688483
physical_device_desc: "device: 5, name: Tesla V100-SXM2-32GB, pci bus id: 0000:89:00.0, compute capability: 7.0"
xla_global_id: 1769886423
, name: "/device:GPU:6"
device_type: "GPU"
memory_limit: 32463847424
locality {
  bus_id: 2
  numa_node: 1
  links {
    link {
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 1
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 2
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 3
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 4
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 5
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 7
      type: "StreamExecutor"
      strength: 1
    }
  }
}
incarnation: 15525919415071616471
physical_device_desc: "device: 6, name: Tesla V100-SXM2-32GB, pci bus id: 0000:b2:00.0, compute capability: 7.0"
xla_global_id: 893286608
, name: "/device:GPU:7"
device_type: "GPU"
memory_limit: 32463847424
locality {
  bus_id: 2
  numa_node: 1
  links {
    link {
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 1
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 2
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 3
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 4
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 5
      type: "StreamExecutor"
      strength: 1
    }
    link {
      device_id: 6
      type: "StreamExecutor"
      strength: 1
    }
  }
}
incarnation: 4453703728072460311
physical_device_desc: "device: 7, name: Tesla V100-SXM2-32GB, pci bus id: 0000:b3:00.0, compute capability: 7.0"
xla_global_id: 2099794689
]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

努力的老周

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值