gcc版本与cuda版本不兼容(无root权限)问题解决(cuda11.8)

本人在实验室服务器上复现代码,配置环境的时候遇到gcc与cuda版本不兼容的问题,但是又没有root权限。因此在网上搜寻资料以解决。

——————————————————————————

因为没有root权限(sudo),而gcc和g++又是安装在系统路径下,在进行实验或者复现代码的时候需要更换gcc版本(比如需要和不同的cuda版本兼容,具体兼容见链接https://stackoverflow.com/questions/6622454/cuda-incompatible-with-my-gcc-version),但是又没有root权限。

因此考虑在conda环境下安装兼容版本的gcc,用它来进行编译和环境配置。

操作前:

安装一些包(需要gcc编译)时报错:

/usr/local/cuda/include/crt/host_config.h:132:2: error: #error -- unsupported GNU version! gcc versions later than 11 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. 132 | #error -- unsupported GNU version! gcc versions later than 11 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. | ^~~~~ [2/2] c++ -MMD -MF

也就是cuda和gcc版本不兼容,高于11版本号的gcc都不被当前cuda版本号支持(我的cuda版本号是11.8)

具体操作步骤如下:

直接运行

conda install -c conda-forge cxx-compiler

 操作后

运行代码不再报错:

成功!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值