gpt4 book ai didi

cuda - Tensorflow:CUDA_VISIBLE_DEVICES似乎不起作用

转载 作者:行者123 更新时间:2023-12-04 22:43:00 27 4
gpt4 key购买 nike

当我使用CUDA_VISIBLE_DEVICES=2运行python脚本时,Tensorflow仍然显示以下内容:

I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla K80, pci bus id: 0000:86:00.0)



因此,我的代码失败,并显示以下消息:

Could not satisfy explicit device specification '/device:GPU:2' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0, /job:localhost/replica:0/task:0/gpu:0



有人可以解释一下发生了什么吗?

最佳答案

引用CUDA_VISIBLE_DEVICES的解释:

CUDA will enumerate the visible devices starting at zero. In the last case, devices 0, 2, 3 will appear as devices 0, 1, 2.



因此,如果您执行 CUDA_VISIBLE_DEVICES=2,则您的GPU#2将在tensorflow内部表示为 gpu:0

关于cuda - Tensorflow:CUDA_VISIBLE_DEVICES似乎不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40726039/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com