python 验证 tensorflow 是否可用 GPU

python 验证 tensorflow 是否可用 GPU,第1张

显摆一下,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
]

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/916704.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-16
下一篇2022-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存