Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensorflow Tips #248

Open
junxnone opened this issue Nov 17, 2021 · 0 comments
Open

Tensorflow Tips #248

junxnone opened this issue Nov 17, 2021 · 0 comments

Comments

@junxnone
Copy link
Owner

junxnone commented Nov 17, 2021

获取当前版本 tensorflow 编译信息

import tensorflow as tf
build_info = tf.sysconfig.get_build_info()
for key in build_info:
    print(f'{key}: {build_info[key]}')
cpu_compiler: /usr/bin/gcc-5
cuda_compute_capabilities: ['sm_35', 'sm_50', 'sm_60', 'sm_70', 'sm_75', 'compute_80']
cuda_version: 11.2
cudnn_version: 8
is_cuda_build: True
is_rocm_build: False
is_tensorrt_build: True

获取主机可用的 GPU

for gpu_n in tf.config.experimental.list_physical_devices('GPU'):
    print(f'Num GPUs Available: {gpu_n}')
Num GPUs Available: PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')
Num GPUs Available: PhysicalDevice(name='/physical_device:GPU:1', device_type='GPU')
Num GPUs Available: PhysicalDevice(name='/physical_device:GPU:2', device_type='GPU')
Num GPUs Available: PhysicalDevice(name='/physical_device:GPU:3', device_type='GPU')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant