项目场景:


问题描述

terminate called after throwing an instance of ‘xxxxxx’
编译没问题,但运行出错

原因1:内存不足

解决方案:

查看当前所有可用的GPU,选择使用率较低的设备。

在代码里

import os
os.environ[‘CUDA_VISIBLE_DEVICES’] = ‘0’

或者在terminal选其他GPU即可解决

export CUDA_VISIBLE_DEVICES=3

原因2:传入了错误指针/参数

要注意引用、指针的使用是否正确,尤其涉及host端和device端的互相传输的时候。

原因3: block线程数超出了GPU 的限制

每个block设定的线程数超出了GPU 的限制,如NVIDIA GeForce RTX 3080的maxThreadsPerBlock为1024(可以通过getDevice Properties读到),若CUDA编程时给block里的线程数超出1024,则会报如上error:

dimBlock(32, 32, 1); // 正好1024,则正常运行
dimBlock(33,32, 1); // 超出1024,报错

【Debug记录】terminate called after throwing an instance of ‘xxxxxx‘相关推荐

  1. 报错信息 terminate called after throwing an instance of ‘std::cad_alloc‘ what():std::bad_alloc

    最近做了一道bfs算法的程序题 输入测试数据后卡在运行框中 然后会产生一个错误信息 第一次见到这样的报错于是记录一下解决过程 terminate called after throwing an in ...

  2. terminate called after throwing an instance of ‘c10::Error‘ chunk expects at least a 1-d tensor

    服务器类型:slurm管理下的超算服务器 系统:linux python版本:3.8 虚拟环境:virtualenv pytorch版本:1.10 问题描述:在服务器上用上卡跑模型时 python - ...

  3. XGB模型训练报错 terminate called after throwing an instance of ‘std::bad_alloc‘ what()

    背景:需要做XGB模型增量训练,但是因为一些原因没有得到原来的XGB模型,只有dump文件. XGB模型的dump文件是它的树结构存储为一个相对人类好理解的模型文件,但并不能被重新加载进XGB进行增量 ...

  4. terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr

    运行时报错: terminate called after throwing an instance of 'std::out_of_range' what():  basic_string::sub ...

  5. terminate called after throwing an instance of ‘YAML::TypedBadConversion<int>‘ what(): bad conver

    terminate called after throwing an instance of 'YAML::TypedBadConversion<int>'what(): bad conv ...

  6. 《视觉SLAM 十四讲》第五讲 实践:拼接点云-编译遇到的terminate called after throwing an instance of 'pcl::IOException问题及解决方法

    <视觉SLAM 十四讲>第五讲 实践:拼接点云-编译遇到的terminate called after throwing an instance of 'pcl::IOException问 ...

  7. 【已解决】terminate called after throwing an instance of ‘cv::Exception‘,已放弃 (核心已转储)

    这是运行高翔slambook2的代码出现的错误 terminate called after throwing an instance of 'cv::Exception' what(): OpenC ...

  8. Linux运行python文件出现以下错误:terminate called after throwing an instance of ‘std::runtime_error‘

    Linux运行python文件出现以下错误:terminate called after throwing an instance of 'std::runtime_error'

  9. terminate called after throwing an instance of ‘std::runtime_error‘ what(): locale::facet::_S_cre

    在运行程序时出错: terminate called after throwing an instance of 'std::runtime_error'   what():  locale::fac ...

最新文章

  1. MySQL 第七天(核心优化一)
  2. oracle数据恢复方法
  3. java执行jar中的main_浅谈java 执行jar包中的main方法
  4. 【转载】PHP面向对象(OOP)编程入门教程
  5. Research on NFT
  6. python多进程编程 多个函数并发执行_python并发编程之多进程编程
  7. [C++11]可调用对象绑定器
  8. 程旭元系统漫画第三期:加班 !
  9. 蓝桥杯 卡片换位(bfs)
  10. 如何修改bt tracker服务器,bt tracker服务器
  11. excel判断单元格包含指定内容的函数用=IF(COUNTIF(A1,*内容*),0,1)
  12. 关于python字符编码_关于python文件的字符编码
  13. 黑马程序员————银行业务调度系统
  14. 重庆大学大数据与软件学院阿里云大数据实训总结报告
  15. 多个数求最小公倍数详解!
  16. abaqus帮助html,ABAQUS/CAE 常 问 界 面 操 作(转自SimWe仿真论坛
  17. 编辑器进化 VSCode + Vim
  18. 现代密码学:数字签名
  19. swing标题边框(TitleBorder)
  20. 隐藏resent记录,隐藏菜单栏记录

热门文章

  1. Weakly-supervised Instance Segmentation via Class-agnostic Learning with Salient Images
  2. iOS 8人机界面指南(一):UI设计基础
  3. js基础笔记(持续更新)
  4. [渝粤教育] 西南科技大学 民事诉讼法学 在线考试复习资料
  5. 快速收集图片并批量重命名(在线收集表、QQ收集表、腾讯收集表+方方格子)(图片批量重命名)
  6. JAVA实训项目:银行网银系统管理平台(含源码)
  7. python编程用什么软件-python开发工具有哪些(初学python用什么软件)
  8. 传输层协议(1):TCP 报文结构
  9. 百度万亿流量的转发引擎BFE开源了!
  10. 中国大学MOOC 如何抓包和进行采集