栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python 验证 tensorflow 是否可用 GPU

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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
]

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/870764.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号