linux判断安装的tensorflow是gpu还是cpu版本

素颜马尾好姑娘i 2021-12-12 16:31 412阅读 0赞

判断代码:

  1. import os
  2. from tensorflow.python.client import device_lib
  3. os.environ["TF_CPP_MIN_LOG_LEVEL"] = "99"
  4. if __name__ == "__main__":
  5. print(device_lib.list_local_devices())

结果一:CPU

[name: “/device:CPU:0”

device_type: “CPU”

memory_limit: 268435456

locality {

}

incarnation: 4723458630420161305

, name: “/device:XLA_CPU:0”

device_type: “XLA_CPU”

memory_limit: 17179869184

locality {

}

incarnation: 11640713468301226911

physical_device_desc: “device: XLA_CPU device”

]

结果二:GPU

[name: “/device:CPU:0”

device_type: “CPU”

memory_limit: 268435456

locality {

}

incarnation: 17503920527771229331

, name: “/device:GPU:0”

device_type: “GPU”

memory_limit: 191365120

locality {

bus_id: 1

links {

  1. link \{
  2. device\_id: 1
  3. type: "StreamExecutor"
  4. strength: 1
  5. \}

}

}

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:GPU:1”

device_type: “GPU”

memory_limit: 6526258381

locality {

bus_id: 1

links {

  1. link \{
  2. type: "StreamExecutor"
  3. strength: 1
  4. \}

}

}

incarnation: 15928025279328008063

physical_device_desc: “device: 1, name: GeForce GTX 1080 Ti, pci bus id: 0000:04:00.0, compute capability: 6.1”

]

发表评论

表情:
评论列表 (有 0 条评论,412人围观)

还没有评论,来说两句吧...

相关阅读