Compile gdb

1
2
3
4
./configure --prefix=`pwd`/installed --with-python=/usr/bin/python3
make -j 16
make install
cp -Rf /usr/share/gdb/auto-load `pwd`/installed/share/gdb/

Remote desktop between Ubuntus

1
2
3
4
5
sudo apt install tigervnc-common
sudo apt install tigervnc-standalone-server
#vncpasswd
vncserver -localhost no -geometry 1280x720 :1
vncserver -list

Authentication required?

Empty ~/.vnc/passwd and

1
2
#/etc/xdg/autostart$ sudo vi org.gnome.SettingsDaemon.Color.desktop
X-GNOME-Autostart-enabled=false

then reboot the server.

refer to:
https://blog.csdn.net/Naisu_kun/article/details/123007055

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