Don't use "-fsanitize=address", use "-fsanitize=leak" instead.
技术
Deep learning memo
1 2 3 | import netron modelPath = "models.onnx" netron.start(modelPath) |
then browse to http://localhost:8080.
onnx to trt
1 | ./trtexec --onnx=Resnet34_3inputs_448x448_20200609.onnx --saveEngine=Resnet34_3inputs_448x448_20200609.trt --workspace=6000 |
TensorRT docs https://docs.nvidia.com/deeplearning/tensorrt/api/c_api/classnvinfer1_1_1_i_runtime.html
Precision of time_since_epoch
1 2 | #include <chrono> uint64_t timestamp = std::chrono::system_clock::now().time_since_epoch().count(); |
'timestamp' is in ns, not in us(μs or microsecond).
1 2 3 4 5 6 | 1 s = 1000 ms 1 ms = 1000 μs 1 μs = 1000 ns 1 ns = 1000 ps 2 GHz = 2 x 10^9 Hz, its 1 circle has 0.5 ns long. |
Build protobuf in Windows
git clone https://github.com/protocolbuffers/protobuf.git cd protobuf git submodule update --init --recursive mkdir bld cd bld cmake -G "Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=%CD%/installed -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=ON ../cmake/
If the project which we link with the protobuf.so complains "libprotobuf.so.22 is not found", it means we build protobuf in another way, through ./configure.
Cpu Affinity
from 宋宝华:
https://www.toutiao.com/article/6937097613720191520/
1 2 3 4 5 6 7 8 9 10 11 12 | # grub.cfg, cpu order number starts from 0. linux ... isolcpus=2 # bash taskset -cp 2 662 cat /proc/interrupts cat /proc/irq/44/smp_affinity # make menuconfig NO_HZ_FULL NO_HZ_IDLE Documentation/timers/no_hz.rst |
Could NOT find CARES
When I built wireshark in ubuntu, it emitted this error.
The correct packages to install are
1 2 3 4 5 | sudo apt install libgcrypt20-dev libc-ares-dev libpcap-dev mkdir bld cd bld cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/installed -DCMAKE_PREFIX_PATH=/home/work/3rdParty/qt/5.15.2/gcc_64 #. |
VS Code memo
launch.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | {
"version": "0.2.0",
"configurations": [
{
"name": "dbg a.out",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/path/to/a.out",
"args": [
"-b",
"sim"
],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/path/to/",
"environment": [
{
"name": "LD_LIBRARY_PATH",
"value": "./:${workspaceRoot}/path/to/:/usr/local/cuda-11.1/lib64"
},
{
"name": "GST_DEBUG_DUMP_DOT_DIR",
"value": "/home/work/tmp"
}
],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "C++ Attach (GDB)",
"type": "cppdbg",
"request": "attach",
"targetArchitecture": "x64",
"program": "${workspaceRoot}/path/to/a.out",
"processId": "${command:pickProcess}"
}
]
} |
Don't translate tab to spaces,
1 | File -> Preferences -> Settings -> Text Editor -> Insert Spaces / Detect Indentation |
Display std::string or std::vector content
1 | -exec -enable-pretty-printing |
VS2019输入Tab键使之不变为空格
工具 -> 选项 -> 文本编辑器 -> 高级 -> 使用自适应格式,取消勾选。
Build FFMpeg in Windows
In MSYS2 x64 bash,
pacman -S mingw-w64-x86_64-toolchain
pacman -S base-devel
pacman -S yasm nasm gcc
basedir=/d/work/open
cd ${basedir}/x264
./configure --prefix=${basedir}/x264_install --enable-static --extra-cflags="-O0 -g3" --enable-debug
make
make install
cd ${basedir}/ffmpeg
./configure --prefix=${basedir}/ffmpeg_install --enable-static --disable-shared --extra-cflags=-I${basedir}/x264_install/include --extra-ldflags=-L${basedir}/x264_install/lib
make
make install
refer to:
http://events.jianshu.io/p/53ecc4dbe7d0
https://www.videolan.org/developers/x264.html
http://ffmpeg.org/download.html
https://www.msys2.org/
https://git-scm.com/download/win