Pytorch1.7适配cuda篇

Pytorch1.7适配cuda篇

由于3090、A10以后的显卡使用安培Ampere架构,不再支持cuda11以下版本,导致cuda、pytorch必须升级,进而导致过去开的的模型需要重新适配。根据适配过程中遇见的问题,做优化记录(持续更新)…

服务器环境

cuda: 11.2
cudnn: 8.0
pytorch: 1.7.1

适配记录

1、报错:error: identifier “AT_CHECK” is undefined

 error: identifier “AT_CHECK” is undefined

解决方法:找到报错的.cpp、.cu、.h文件,搜索并替换

“AT_CHECK”修改为“TORCH_CHECK”

2、报错:type().is_cuda()

 error: identifier “type().is_cuda()” is undefined

解决方法:找到报错的.cpp、.cu、.h文件,搜索并替换

“type().is_cuda()”修改为“is_cuda()

3、报错: error: ‘THCState_getCurrentStream’ was not declared in this scope

  error: ‘THCState_getCurrentStream’ was not declared in this scope

解决方法:找到报错的.cpp、.cu、.h文件,搜索并替换

 cudaStream_t stream = THCState_getCurrentStream(state);修改为“cudaStream_t stream = c10::cuda::getCurrentCUDAStream();

4、报错:error: ‘getCurrentCUDAStream’ is not a member of ‘c10::cuda’

error: ‘getCurrentCUDAStream’ is not a member of ‘c10::cuda’

解决方法:#include <c10/cuda/CUDACachingAllocator.h>

#include <c10/cuda/CUDACachingAllocator.h>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值