failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED 报错 (解决方法)

本文介绍了在运行GCN_Keras代码时遇到的两个错误:CPU指令集不匹配警告和CUBLAS分配失败。针对第一个问题,通过设置环境变量屏蔽警告;对于第二个问题,可以通过固定GPU内存分配比例或检查资源占用来解决。提供的解决方案包括修改代码以限制GPU内存使用,并建议避免同时运行多个消耗GPU资源的程序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 1.报错 问题:(来自GCN_Keras-master代码)

在Pycharm运行GCN_Keras代码的时候,报错:

①Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

您的CPU支持该TensorFlow二进制文件未编译为使用的指令:AVX2 FMA

原因:成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

②failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED

原因:

解决:failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED

2.解决方法

①Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

开头加入代码:可以临时屏蔽警告信息

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' 

②failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED

开头加入代码:固定分配显存

import tensorflow as tf
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options)) 

或:

可能开的程序太多了,jupyter和pycharm尽量不要一起开,关掉其他的试试。


 其中代码来自:图卷积神经网络 with Keras

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值