2021/2/25

bookmark: github login no longer support password login

https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ 2021/8/13 開始,不支援 password login 了

2021/2/23

gitlab : push -f failed.

因為push 錯的 commit,所以想 roll-back remote 的 master 到前面的 commit (3aff..)。
git push -f 3aff67897909:master
文章說用 -f (force),結果出現 Error:
remote: GitLab: You are not allowed to force push code to a protected branch on this project.
原來是 gitlab 設定 protect 的關係。
這一篇 說..
原因是 GitLab 預設會保護 master branch

如果有些情況希望能解除這個設定,底下說明解除方式:

*前往專案
*Settings > Repository
*Protected branches
這時,會看到 master 被設定為 protect

可以點擊 "Unprotect" 按鈕,取消保護

在嘗試的強制 push ,應該就會成功

另外,一般用 rebase 後 push 都會 fail,用 -force 就可以成功 push。
但是其他已經 checkout 的人 pull 就會 fail...,
ref:

2021/2/19

git submodule

git submodule -help
usage: git submodule [--quiet] add [-b ] [-f|--force] [--name ] [--reference ] [--]  []
   or: git submodule [--quiet] status [--cached] [--recursive] [--] [...]
   or: git submodule [--quiet] init [--] [...]
   or: git submodule [--quiet] deinit [-f|--force] (--all| [--] ...)
   or: git submodule [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-shallow] [--reference ] [--recursive] [--] [...]
   or: git submodule [--quiet] summary [--cached|--files] [--summary-limit ] [commit] [--] [...]
   or: git submodule [--quiet] foreach [--recursive] 
   or: git submodule [--quiet] sync [--recursive] [--] [...]
   or: git submodule [--quiet] absorbgitdirs [--] [...]
看起來功能最多的是 git submodule update..
但是原來 git 並沒有這個 command (update)

如果 remote 端新增了 submodule
local 端 pull 後會新增 .gitmodule,但是 submodule 的 .git 不會自動 checkout pull
git submodule init
git submodule update

增加 submodule project 時,如果直接 edit .gitmodule,並沒有效果。一定要用 git submodule add 才行。

2021/2/18

socat 建立假的 com port 連線

在自己的機器上建立一虛擬的 com port,
$ socat -d -d pty,rawer pty,rawer
2021/02/18 16:16:11 socat[17589] N PTY is /dev/pts/6
2021/02/18 16:16:11 socat[17589] N PTY is /dev/pts/7
2021/02/18 16:16:11 socat[17589] N starting data transfer loop with FDs [5,5] and [7,7]

這是叫 socat create 兩個 連在一起的 pty port..
然後 socat 告訴你建好了,名稱分別是 /dev/pts/6 和 /dev/pts/7

之後就可以測次...
從 7 印出...,開啟一個新的 terminal...
$ cat /dev/pts/7

再開令一個新的 terminal,送資料進 令一個 virtual com port..
$ echo aaa > /dev/pts/6
然後就可以看到剛剛那格 cat pts 7 的 terminal 出現 aaa

同時,可以再開一個新 terminal cat pts/6 ,然後再開一個新的 termianl echo bbb > pts 7,
就可以看到 pts 6 出現 bbb

代表可以同時雙向...

socat 的 兩個 -d 是代表印出 error messagesss

2021/2/12

cudnn samples build and run

cudnn sample deb
/usr/src/cudnn_sample_v8

cuda 安裝在 /usr/local/cuda

copy sample 到 home folder
到 conv_sample 下
~/cudnn_samples_v8/conv_sample$ make
CUDA_VERSION is 10020
Linking agains cublasLt = true
CUDA VERSION: 10020
TARGET ARCH: x86_64
TARGET OS: linux
SMS: 35 50 53 60 61 62 70 72 75 
/usr/local/cuda/bin/nvcc -ccbin g++ -I/usr/local/cuda/include -I/usr/local/cuda/targets/ppc64le-linux/include  -m64    -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_75,code=compute_75 -o fp16_dev.o -c fp16_dev.cu
g++ -I/usr/local/cuda/include -I/usr/local/cuda/targets/ppc64le-linux/include   -o fp16_emu.o -c fp16_emu.cpp
g++ -I/usr/local/cuda/include -I/usr/local/cuda/targets/ppc64le-linux/include   -o conv_sample.o -c conv_sample.cpp
/usr/local/cuda/bin/nvcc -ccbin g++   -m64      -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_75,code=compute_75 -o conv_sample fp16_dev.o fp16_emu.o conv_sample.o -I/usr/local/cuda/include -I/usr/local/cuda/targets/ppc64le-linux/include -L/usr/local/cuda/lib64 -L/usr/local/cuda/targets/ppc64le-linux/lib -lcublasLt -lcudart -lcublas -lcudnn -lstdc++ -lm
測試一下...
~/cudnn_samples_v8/conv_sample$ ./conv_sample 
Executing: conv_sample
Using format CUDNN_TENSOR_NCHW (for INT8x4 and INT8x32 tests use CUDNN_TENSOR_NCHW_VECT_C)
Testing single precision
====USER DIMENSIONS====
input dims are 1, 32, 4, 4
filter dims are 32, 32, 1, 1
output dims are 1, 32, 4, 4
====PADDING DIMENSIONS====
padded input dims are 1, 32, 4, 4
padded filter dims are 32, 32, 1, 1
padded output dims are 1, 32, 4, 4
Testing conv
^^^^ CUDA : elapsed = 7.00951e-05 sec,  
Test PASSED
Testing half precision (math in single precision)
====USER DIMENSIONS====
input dims are 1, 32, 4, 4
filter dims are 32, 32, 1, 1
output dims are 1, 32, 4, 4
====PADDING DIMENSIONS====
padded input dims are 1, 32, 4, 4
padded filter dims are 32, 32, 1, 1
padded output dims are 1, 32, 4, 4
Testing conv
^^^^ CUDA : elapsed = 3.69549e-05 sec,  
Test PASSED

2021/2/8

bookmarks: forticlient for ubuntu 20.04 , deb file

wget https://filestore.fortinet.com/forticlient/downloads/FortiClientFullVPNInstaller_6.4.0.0851.deb
奇怪這個link在官網沒有link。
-- 原來是下面 Forticlient VPN 的部份,有 rpm. deb 的 link


在 chromebook 也有FortiClient VPN 可以安裝。
雖然會說是舊版的。

Failed to initialize NVML: Driver/library version mismatch

run nvidia-smi 時出現 Error message: Failed to initialize NVML: Driver/library version mismatch

因為 更新後,driver 版本跟 nvidia 版本不一致,要重新load nvidia driver,一般重新開機就可以。
不然就要手動reload nvidia driver

因為 driver 都又相依行,所以要照相依順序一一rmmod..
最後目標是nvidia,都remove 後,再run 一次nvidia-smi,就會自動load 正確的driver

charles-chang@penguin1:~$ sudo rmmod nvidia_drm
charles-chang@penguin1:~$ sudo rmmod nvidia
rmmod: ERROR: Module nvidia is in use by: nvidia_uvm nvidia_modeset
charles-chang@penguin1:~$ sudo rmmod nvidia_uvm
charles-chang@penguin1:~$ sudo rmmod nvidia_modeset
charles-chang@penguin1:~$ sudo rmmod nvidia
charles-chang@penguin1:~$ sudo nvidia-smi
Mon Feb  8 23:30:38 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.102.04   Driver Version: 450.102.04   CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  TITAN RTX           Off  | 00000000:01:00.0 Off |                  N/A |
| 24%   42C    P0    30W / 280W |      0MiB / 24218MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
charles-chang@penguin1:~$ lsmod | grep nvidia
nvidia_uvm            983040  0
nvidia_drm             49152  0
nvidia_modeset       1179648  1 nvidia_drm
nvidia              19701760  2 nvidia_uvm,nvidia_modeset
drm_kms_helper        172032  1 nvidia_drm
drm                   401408  3 drm_kms_helper,nvidia_drm

2021/2/4

Bookmark : SOTA

deeplearning 進展快速,幾個月 sota network 就換人做了。
這個網站幫你排序,紀錄目前與過去各個 deep learning 領域的 SOTA network。

2021/2/3

mender.io code reading...

都是用 go 寫的。
和 bootloader (uboot) 溝通(作用)部份,是 installer/bootenv.go
用的是 uboot 的 userland tools:
  • fw_printenv
  • fw_setenv
  • /etc/fw_env.config
用在WriteEnv( )上,而使用 WriteEnv 的。就只有 dual_rootfs_device.go
CommitUpdate()
Rollback()
InstallUpdate()
配合官方的 state-scripts 文件來看..
-- state script 就是mender 提供的 callback function,mender 把狀態分為 9 個狀態。然後每個狀太的 enter, leave 都會 call 對應名稱的 shell script

有關 root filesystem 的 script,例如 retrain-ssh-keys,就是把新 root partition mount 近來,然後把目前 root fs 的 key date copy 過去。
然後 script 的開頭...
current=$(/sbin/fw_printenv mender_boot_part | awk -F = '{ print $2 }')

if [ $current = "2" ]; then
    newroot=/dev/mmcblk0p3
elif [ $current = "3" ]; then
    newroot=/dev/mmcblk0p2
else
    echo "Unexpected current root: $current" >&2
    exit 1
fi
從 uboot 的 env 知道目前的 boot partition,然後令一個就是 update partition

2021/2/1

/etc/hosts , /etc/nsswitch.conf and /etc/resolv.conf

hosts 寫明一些你自己的 dns 對應。
但是要參考到這個 file,必須要寫好 nsswitch

不然雖然有寫在 hosts,ping 一樣的 badd address

nsswitch 中寫明dns 解析的參照順序。

.. dns 遇到問題時,可以用 nscd 來 debug..