首页 > 系统相关 >ubuntu中使用vscode进行cuda c代码debug出现 no such file or directory 的问题

ubuntu中使用vscode进行cuda c代码debug出现 no such file or directory 的问题

时间:2023-05-19 20:16:02浏览次数:45  
标签:name err no vscode json gdb cuda ubuntu debug

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "CUDA C++: Launch",
      "type": "cuda-gdb",
      "request": "launch",
      "program": "${fileDirname}/test.err",
      "debuggerPath": "/usr/local/cuda-12.0/bin/cuda-gdb",
      "preLaunchTask": "mynvcc",
    },
    {
      "name": "CUDA C++: Attach",
      "type": "cuda-gdb",
      "request": "attach"
    },
   
  ]
}

问题提要:配置launch.json文件的时候,需要生成的program(如上例为test.err)成功生成,但vscode提示test.err no such file or directory的问题

 

原因:vscode debug时会进入debug下的文件路径,和我们想要的文件路径并不一致。

 

解决方法:将launch.json文件进行修改即可。

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "CUDA C++: Launch",
      "type": "cuda-gdb",
      "request": "launch",
      "program": "${fileDirname}/test.err",
      "debuggerPath": "/usr/local/cuda-12.0/bin/cuda-gdb",
      "preLaunchTask": "mynvcc",
      "cwd":""
    },
    {
      "name": "CUDA C++: Attach",
      "type": "cuda-gdb",
      "request": "attach"
    },
   
  ]
}

 

附成功debug的几个其他json文件:

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "mynvcc",
            "type": "shell",
            "command": "nvcc",
            "args": [
                    "-std=c++17",
                    "-g",
                    "-G",
                    "-lz",
                    "-o",
                    "${fileDirname}/test.err",
                    "main.cu"],
        }
    ]
}

c_cpp_properties.json

{
  "configurations": [
    {
      "name": "Linux",
      "includePath": [
        "${workspaceFolder}/**"
      ],
      "compilerPath": "/usr/local/cuda-12.0/bin/nvcc",
      "cStandard": "c17",
      "cppStandard": "gnu++17",
      "intelliSenseMode": "linux-gcc-x64",
      "compilerArgs": [
        ""
      ]
    }
  ],
  "version": 4
}

 

标签:name,err,no,vscode,json,gdb,cuda,ubuntu,debug
From: https://www.cnblogs.com/zhimingyiji/p/17416142.html

相关文章

  • Cannot cast Newtonsoft.Json.Linq.JObject to Newtonsoft.Json.Linq.JToken.
    @@CannotcastNewtonsoft.Json.Linq.JObjecttoNewtonsoft.Json.Linq.JToken 解决方法方法参数为[FromBody]objectcontent JObjectjo=(JObject)JsonConvert.DeserializeObject(content.ToString());JToken[]jtoArray=jo["contentBody"].ToArray();List<......
  • TypeError: Cannot read properties of null (reading 'name')
    报错如下:错误代码:searchList(){this.entity={}this.edit=nullletquery={}query.traceCode=this.codethis.loading=truecodeApi.queryTraceCode(query).then(res=>{...},err=>{......
  • VFS: Unable to mount root fs on unknown-block
    [1.736146]Listofallpartitions:[1.736921]fd00256000vda[1.736928]driver:virtio_blk[1.737723]Nofilesystemcouldmountroot,tried:[1.737723][1.738136]Kernelpanic-notsyncing:VFS:Unabletomountrootfs......
  • ubuntuSSh无法远程连接解决方案
    首先进入目录/etc/ssh中cd/etc/ssh然后编辑里面的sshd_config文件visshd_config查找PermitRootLLogin,把后面的内容改成yes,把前面的#删除,wq保存退出(一定要记得删"#"我因为这走了很多弯路)这个时候就可以了......
  • 在ubuntu 下怎么将eclipse添加到应用,同时有可以通过终端打开。
    1:将ubuntu添加到应用程序的方法:在终端中敲入:sudogedit/usr/share/applications/Eclipse.desktop在打开的GEdit中输入以下文本[DesktopEntry]Name=EclipseComment=Eclipse3.42IDEExec=/usr/java/eclipse/eclipse   <—这里改成你的eclipse的安装位置Icon=/usr/java/ecli......
  • Sonarqube---You're not authorized to run analysis. Please contact the project ad
    问题:sonarqube执行时报错:You'renotauthorizedtorunanalysis.Pleasecontacttheprojectadministrator原因:项目开始执行是好的,因为需要做项目的权限控制,所以将project从public修改为private后,再执行就报You'renotauthorizedtorunanalysis.Pleasecontacttheproject......
  • ubuntu deb安装
    ubuntudeb安装要安装.deb套件包时dpkg-ipackage_file.deb要反安装.deb套件包时dpkg-rpackage_name 注意:使用此命令需要你自己注意依赖软件,所以这并不是安装软件的最佳方法.  dpkg的详细使用方法,网上有很多,下面简单列了几个:dpkg-ipa......
  • nodejs的cookie实现module(cookie.js)
     文件名:cookie.js//Directlysendcookietosystem,ifit'snode.jshandler,send://request.headers.cookie//Ifit'ssocket.iocookie,send://client.request.headers.cookiemodule.exports.cookie=function(co){this.cookies={};co&......
  • nodejs 解析php的session_decode 的module(session_decode.js)
    文件名:session_decode.js//exports.session_decode=function(){//varmessage="Hellofromtheohaitheremodule";//returnmessage;//};exports.session_decode=function(data){//*example:session_decode('firstName|s:5:&quo......
  • ubuntu flash allow camera
    ubuntuflashallowcamera:ubuntu的bug,在ubuntu下特别难点击flash的allow按钮。通过搜索,找到以下方案解决这个问题:http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager02.html......