Pytorch1.7适配cuda篇

Pytorch1.7适配cuda篇

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

服务器环境

cuda: 11.2
cudnn: 8.0
pytorch: 1.7.1
Pytorch1.7适配cuda篇

适应记录

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();”

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
xiaoxingxing的头像xiaoxingxing管理团队
上一篇 2022年4月15日
下一篇 2022年4月20日

相关推荐