pytorch profiler使用及apex安装遇到的cuda问题

 pytorch profiler使用:

with torch.profiler.profile(schedule=torch.profiler.schedule(wait=0,\
warmup=10,active=3,repeat=1),on_trace_ready=torch.profiler.tensorboard_trace_handler('./log'), \
record_shapes=True, with_stack=True) as prof:
 训练代码

参考:

PyTorch Profiler With TensorBoard — PyTorch Tutorials 1.13.1+cu117 documentation

PyTorch 官方博客:PyTorch Profiler v1.9 详解_HyperAI超神经的博客-CSDN博客_pytorch profiler

PyTorch 模型性能分析——PyTorch Profiler - 简书

【PyTorch】torch.profiler.profile的使用 - 知乎

PyTorch全新性能分析工具,可视化瓶颈,并集成到了VS Code - 知乎

nvidia apex安装遇到问题:cuda extensions are being compiled with a version of Cuda that does not match the version used to compile Pytorch binaries

这是由编译apex使用的cuda版本(runtime api,用nvcc可查看)和实际系统的cuda版本(driver api,用nvidia-smi可查看)不一致,需要设置CUDA_HOME环境变量使得这两者一致:

export CUDA_HOME=/usr/local/cuda-10.6/

或者

UDA_HOME=/usr/local/cuda-11.6 pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./

参考:

cuda extensions are being compiled with a version of Cuda that does not match the version used to compile Pytorch binaries. · Issue #550 · NVIDIA/apex · GitHub

显卡,显卡驱动,nvcc, cuda driver,cudatoolkit,cudnn到底是什么? - marsggbo - 博客园

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值