【閱讀筆記】投資進化論:揭開投腦不理性的真相 2/2

《投資進化論:揭開投腦不理性的真相》這本書學術的名詞很多,幸好月初看了《橡皮擦計畫》,其中有部分內容在這本書也有提及,所以閱讀時沒有像讀《橡皮擦計畫》時,那麼的想放棄,不過略過學術的部分,單看心理行為學應用在投資上,也沒有那麼難懂。下方筆記是為了日後浮現「不理性」時提醒自己。

【閱讀筆記】投資進化論:揭開投腦不理性的真相 1/2

《投資進化論:揭開投腦不理性的真相》這本書學術的名詞很多,幸好月初看了《橡皮擦計畫》,其中有部分內容在這本書也有提及,所以閱讀時沒有像讀《橡皮擦計畫》時,那麼的想放棄,不過略過學術的部分,單看心理行為學應用在投資上,也沒有那麼難懂。下方筆記是為了日後浮現「不理性」時提醒自己。

Ubuntu 18.04 + NVIDIA Driver 418 + CUDA 10.0 + cuDNN 7.6

Hardware / System Environments:

  • NVIDIA GeForce RTX 2080 Ti
  • Ubuntu 18.04
  • NVIDIA Driver 418
  • CUDA Toolkit 10.0
  • CuDNN 7.6

Step 1: Installation Type






Step 2: Manual Partitioning

This table shows the required sizes of each partition in my case.

Partition Size (MB) Primary / Logical
/ 25600 Primary
/boot 1024 MB Primary
/var 12288 MB Logical
/tmp 15360 MB Logical
swap space 4096 MB Logical / swap area
EFI 256 MB Logical / EFI System Partition
/home Use the rest of free space Logical

After installation completed and system rebooted...

Step 3: Upgrade system

The first time you log in the system, it will pop-up a window for upgrading system. We need to upgrade it. Click "Install Now"

After upgraded, reboot the system. We do another upgrade.
$ sudo apt-get update
$ sudo apt-get upgrade

Step 4: Add NVIDIA package repositories


$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
$ sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
$ sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
$ sudo apt-get update
$ wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
$ sudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
$ sudo apt-get update

Step 5: Install NVIDIA driver

We install NVIDIA driver 418 in this case. If you've already installed NVIDIA driver, you have to remove it first.
$ sudo apt-get purge nvidia*

Then type these commands:
$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt-get update
$ sudo apt-get install nvidia-driver-418

After you installed it, reboot system again and type this command to make sure driver is working.
$ nvidia-smi
Mon Jul 22 19:50:22 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.67       Driver Version: 418.67       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 208...  On   | 00000000:42:00.0  On |                  N/A |
| 43%   43C    P8    49W / 300W |    377MiB / 10986MiB |     33%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1331      G   /usr/lib/xorg/Xorg                            18MiB |
|    0      1368      G   /usr/bin/gnome-shell                          58MiB |
|    0      1678      G   /usr/lib/xorg/Xorg                           133MiB |
|    0      1810      G   /usr/bin/gnome-shell                         103MiB |
|    0      2235      G   ...quest-channel-token=1289530776527538373    62MiB |
+-----------------------------------------------------------------------------+

Step 6: Install CUDA 10.0 & cuDNN 7.6

Choose CUDA version from HERE

Install development and runtime libraries (~4GB)
$ sudo apt-get install --no-install-recommends \
    cuda-10-0 \
    libcudnn7=7.6.0.64-1+cuda10.0  \
    libcudnn7-dev=7.6.0.64-1+cuda10.0

Step 7: Setup environment variables

$ vi ~/.bashrc
Add these lines
export PATH=/usr/local/cuda/bin:${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64

References:

【Kefir‧克菲爾】與克菲爾相遇(目前餵養一個月)

克菲爾是什麼?

克菲爾(kefir)為過去西藏人與白種人會飲用的一種乳製品,是克菲爾粒(kefir grains)與牛奶混合所形成。而克菲爾粒為一種共生複合體的型態,主要由乳酸菌、醋酸菌和酵母菌並與蛋白質和多糖組成的基質(1),英文稱為:Symbiotic Culture Of Bacteria and Yeast,簡稱SCOBY,而近一步經過發酵後會變成克菲爾菌,其型態很像一球一球的白色花椰菜外觀。

【閱讀筆記】深夜加油站遇見蘇格拉底-丹.米爾曼


所謂的勇士之道是什麼呢?是察覺自己的心智如何影響你的行動,以及體會到「此時此刻」的重要。前陣子也閱讀了傳達「活在當下」的兩本書,《我在印度,接近天堂也看見地獄》、《過你的第二人生:你要留在這裡,還是往前走?》,雖然這些作者所傳達的理念類似,但藉由不同的故事型態,更能反映自我的心智。

【閱讀筆記】面對壓力的態度,決定你的工作高度!:愈挫愈勇的高抗壓思考法

看待失敗的方式

  • 先調整意識,將失敗「視為前提」。每一次先做好心理準備,認為即使盡全力,但結果失敗了,也沒關係。
  • 將失敗後轉為成為未來的助力
  • Uniqlo社長-柳井正:「十次新嘗試中,有九次會失敗。」

因工作而沮喪,最多只能持續一小時

  • 藉著設定期限,逼迫自己在一小時內要轉換情緒
  • 坦然接受工作上的不快(人際關係/工作不順)併轉換情緒,往下一步前進

Install/Upgrade to The Newest Version of NVIDIA driver, CUDA and CuDNN libraries.

Environments:

  • Ubuntu 16.04 x64
  • NVIDIA driver 380 -> 410
  • CUDA 9.0 -> 10.1
  • CuDNN -> 7.6.1
  • NCCL -> 2.4.7

Step 1: Remove old version of NVIDIA driver.

$ sudo apt-get purge nvidia*

Step 2: Add repository url to source list.

$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt-get update

Step 3: Install NVIDIA driver 410.

 # option 1
$ sudo apt-get install nvidia-410
# if the package is not located, try other names.
$ sudo apt-get install nvidia-driver-410

Step 4: Install CUDA 10.1.

  • Choose specific version of CUDA deb from HERE
$ wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_10.1.168-1_amd64.deb
$ sudo dpkg -i cuda-repo-ubuntu1604_10.1.168-1_amd64.deb
…
(Reading database ... 268266 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604_10.1.168-1_amd64.deb ...
Unpacking cuda-repo-ubuntu1604 (10.1.168-1) ...
dpkg: error processing archive cuda-repo-ubuntu1604_10.1.168-1_amd64.deb (--install):
 trying to overwrite '/etc/apt/sources.list.d/cuda.list', which is also in package cuda-repo-ubuntu1704 9.0.176-1
Errors were encountered while processing:
 cuda-repo-ubuntu1604_10.1.168-1_amd64.deb
To fix this problem, we add --force-overwrite argument to the command.
$ sudo dpkg -i --force-overwrite cuda-repo-ubuntu1604_10.1.168-1_amd64.deb
$ sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get install cuda

Step 5: Install CuDNN 7.6 and NCCL 2.4.

◎Installing from a Tar File
  1. In order to download cuDNN, ensure you are registered for the NVIDIA Developer Program.
  2. Go to: NVIDIA cuDNN home page.
  3. Click Download.
  4. Complete the short survey and click Submit.
  5. Accept the Terms and Conditions. A list of available download versions of cuDNN displays.
  6. Select the cuDNN version you want to install. A list of available resources displays.
  7. Install Link Redirect Trace Tool in Chrome.
  8. Select ‘cuDNN for Linux’, which is a Tar file.
  9. Get redirected link from the tool.
Download and unzip the cuDNN package.
$ wget [url-of-cudnn-tar-file]
$ tar -zxvf cudnn-10.1-linux-x64-v7.6.1.34.tgz

Soft-link CUDA directory path.
$ cd /usr/local
$ sudo ln -s cuda-10.1 cuda

Copy the following files into the CUDA Toolkit directory, and change the file permissions.
$ sudo cp cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

◎Installing from a Debian File
  • Choose specific version of cuDNN deb from HERE
$ wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.6.1.34-1+cuda10.1_amd64.deb
$ wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7-dev_7.6.1.34-1+cuda10.1_amd64.deb
$ wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl2_2.4.7-1+cuda10.1_amd64.deb
$ wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl-dev_2.4.7-1+cuda10.1_amd64.deb
$ sudo dpkg -i libcudnn7_7.6.1.34-1+cuda10.1_amd64.deb
$ sudo dpkg -i libcudnn7-dev_7.6.1.34-1+cuda10.1_amd64.deb
$ sudo dpkg -i libnccl2_2.4.7-1+cuda10.1_amd64.deb
$ sudo dpkg -i libnccl-dev_2.4.7-1+cuda10.1_amd64.deb

Step 6: Setup environment variables.

Follow NVIDIA official instruction to setup variables.
$ vi ~/.bashrc

Append these lines to the file for 64 bit operation system.
export PATH=/usr/local/cuda/bin:${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Step 7: Reboot system and enable persistence mode.

$ sudo reboot now
…
$ nvidia-smi -pm 1
$ nvidia-smi
Fri Jul  5 07:06:21 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.67       Driver Version: 418.67       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla V100-SXM2...  Off  | 00000000:00:04.0 Off |                    0 |
| N/A   35C    P0    24W / 300W |    136MiB / 16130MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      2336      G   /usr/lib/xorg/Xorg                            63MiB |
|    0      2819      G   gnome-shell                                   72MiB |
+-----------------------------------------------------------------------------+

References: