caffe2线程泄露 torch1.9 独有warning & docker 容器exit code

参考于https://blog.csdn.net/qq_41963227/article/details/119391566
记录一下!!

  1. caffe2线程泄露
    问题描述:在使用pytorch1.9的dataloader时,如果设置num_workers>0或者pin_memory=True时,出现caffe2线程泄露的warning,数量等于num_workers的数量。

[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
比如nuw_work =4
j那么这句话就会输出4次!

不影响正常使用,如果设置num_workers数目为0和pin_memory=False会影响训练速度

官方说在pytorch1.10会修改这个warning,之后就不会有这个问题了,如果不想看它一直输出可以使用下面的解决方法。

解决方法:pytorchGitHub项目问题讨论

使用GitHub源文件安装的方式安装pytorch,并在安装前删除caffe2/utils/threadpool/pthreadpool-cpp.cc 文件中的警告程序删除,即下方代码块的第四行。

auto num_threads = leaked->get_thread_count();
// NOLINTNEXTLINE(modernize-make-unique)
threadpool.reset(new PThreadPool(num_threads));
TORCH_WARN(“Leaking Caffe2 thread-pool after fork.”);

不会影响程序运行

2 容器exit code
在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值