首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用TensorFlow 2.0.0: Error: device :0在设置XLA_GPU_JIT设备编号0时不受XLA服务支持

使用TensorFlow 2.0.0: Error: device :0在设置XLA_GPU_JIT设备编号0时不受XLA服务支持
EN

Stack Overflow用户
提问于 2019-11-06 10:15:17
回答 1查看 1.5K关注 0票数 1

我试图在TeslaV100-SXM2 GPU上运行一个CuDNNLSTM层,但是由于TensorFlow-GPU2.0.0安装了错误(不能降级,因为是共享服务器)。

Tf2.0.0不推荐ConfigProto选项,因此以前的线程(如this )没有帮助。

代码语言:javascript
运行
复制
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "2"  # Or 2, 3, etc. other than 0

tf.config.gpu.set_per_process_memory_growth(True)
tf.config.set_soft_device_placement(True)

如果我使用此代码行,则会显示另一个错误:

模块notfoundError:没有名为“tensorflow.contrib”

的模块

EN

回答 1

Stack Overflow用户

发布于 2019-11-08 14:55:29

第一个GPU的内存已经被另一个同事分配了。我使用以下代码和ie选择另一个免费的GPU。输入= 'gpu:3‘

代码语言:javascript
运行
复制
def config_device(computing_device):
if 'gpu' in computing_device:
    device_number = computing_device.rsplit(':', 1)[1]
    os.environ["CUDA_VISIBLE_DEVICES"] = device_number
# with tf.device(computing_device):

gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
    try:
        # Currently, memory growth needs to be the same across GPUs
        for gpu in gpus:
            tf.config.experimental.set_memory_growth(gpu, True)
        logical_gpus = tf.config.experimental.list_logical_devices('GPU')
        print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs")
    except RuntimeError as e:
        # Memory growth must be set before GPUs have been initialized
        print(e)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58727767

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档