linux判断安装的tensorflow是gpu还是cpu版本
判断代码:
import os
from tensorflow.python.client import device_lib
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "99"
if __name__ == "__main__":
print(device_lib.list_local_devices())
结果一:CPU
[name: “/device
0”
device_type: “CPU”
memory_limit: 268435456
locality {
}
incarnation: 4723458630420161305
, name: “/device
0”
device_type: “XLA_CPU”
memory_limit: 17179869184
locality {
}
incarnation: 11640713468301226911
physical_device_desc: “device: XLA_CPU device”
]
结果二:GPU
[name: “/device
0”
device_type: “CPU”
memory_limit: 268435456
locality {
}
incarnation: 17503920527771229331
, name: “/device
0”
device_type: “GPU”
memory_limit: 191365120
locality {
bus_id: 1
links {
link \{
device\_id: 1
type: "StreamExecutor"
strength: 1
\}
}
}
incarnation: 11078361316836643347
physical_device_desc: “device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:03:00.0, compute capability: 6.1”
, name: “/device
1”
device_type: “GPU”
memory_limit: 6526258381
locality {
bus_id: 1
links {
link \{
type: "StreamExecutor"
strength: 1
\}
}
}
incarnation: 15928025279328008063
physical_device_desc: “device: 1, name: GeForce GTX 1080 Ti, pci bus id: 0000:04:00.0, compute capability: 6.1”
]
还没有评论,来说两句吧...