Skip to content

Pupillen/Robotics_Coding

Repository files navigation

针对Robotics Coding指南

本仓库收集汇总一些个人觉得常用的关于ROS等相关程序debug,profiling,加速调优等的相关工具链.

Debug

CPU程序Debug

关于逐行运行代码debug

推荐vscode ros插件,以debug模式编译节点,之后详见

Core Dump分析

CUDA程序Debug

仅仅set(CMAKE_BUILD_TYPE Debug)不够,注意设置-g -G的flag为host与device的调试信息如下,同时安装vscode插件Nsight Visual Studio Code Edition。支持一个warp为单位逐行bug. thread id注意设置为32的整数倍数

cmake_minimum_required(VERSION 3.10)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CUDA_ARCHITECTURES 52;70;75;86)

project(hellocuda LANGUAGES CXX CUDA)

add_executable(main main.cu)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    target_compile_options(main PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-G -g>)
endif()
target_include_directories(main PUBLIC ../../include)

HPC(高性能计算)

  • 并行加速库推荐OpenMP,在ros中使用个人觉得方便简单,例如典型cpu-bound的进程中for循环加上适当profiling可加速10倍
  • 墙裂推荐并行编程与优化

Profiling (CPU+GPU)

编译,cmake相关系列

  • 参见Doc/cmake项目管理.pdf
  • 参见Doc/cmakeadvanced.pdf
  • 类似墙裂推荐并行编程与优化cmake相关系列
  • 编译期sanity-check
set(CMAKE_BUILD_TYPE "Release")
ADD_COMPILE_OPTIONS(-std=c++14 )
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g")
#!!!!!!!!!!sanity check, compiler flags!!!!!!!!!!
add_compile_options(
  -Wall
  -Wextra
  -Weffc++
  -Werror=uninitialized
  -Werror=return-type
  -Wconversion
  -Werror=unused-result
  -Werror=suggest-override
  -Wzero-as-null-pointer-constant
  -Wmissing-declarations
  -Wold-style-cast
  -Wnon-virtual-dtor
  )
  #!!!!!!!!!!sanity check, com```cpppiler flags!!!!!!!!!!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages