2019年11月2日土曜日

操作ミスでUbuntu再インストール10月28日〜11月1日まで。。。

update 2022/8/24
wiwao@wiwao-desktop:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
wiwao@wiwao-desktop:~$ nvidia-smi
Fri Aug 26 08:42:52 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.33.01    Driver Version: 440.33.01    CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| 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 GTX 1080    On   | 00000000:01:00.0  On |                  N/A |
| 33%   35C    P8     9W / 200W |    272MiB /  8116MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0       976      G   /usr/lib/xorg/Xorg                            18MiB |
|    0      1043      G   /usr/bin/gnome-shell                          48MiB |
|    0      1933      G   /usr/lib/xorg/Xorg                            92MiB |
|    0      2067      G   /usr/bin/gnome-shell                          69MiB |
|    0      2526      G   ...691254562925,6318647564568795765,131072    39MiB |
+-----------------------------------------------------------------------------+
wiwao@wiwao-desktop:~$ cat /usr/local/cuda/version.txt
CUDA Version 10.2.89
wiwao@wiwao-desktop:~$  /usr/local/cuda/bin/nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
wiwao@wiwao-desktop:~$ sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb
[sudo] password for wiwao: 
Selecting previously unselected package libcudnn7.
(Reading database ... 201176 files and directories currently installed.)
Preparing to unpack libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb ...
Unpacking libcudnn7 (7.6.5.32-1+cuda10.2) ...
Setting up libcudnn7 (7.6.5.32-1+cuda10.2) ...
Processing triggers for libc-bin (2.27-3ubuntu1.6) ...
wiwao@wiwao-desktop:~$ sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.2_amd64.deb
Selecting previously unselected package libcudnn7-dev.
(Reading database ... 201182 files and directories currently installed.)
Preparing to unpack libcudnn7-dev_7.6.5.32-1+cuda10.2_amd64.deb ...
Unpacking libcudnn7-dev (7.6.5.32-1+cuda10.2) ...
Setting up libcudnn7-dev (7.6.5.32-1+cuda10.2) ...
update-alternatives: using /usr/include/x86_64-linux-gnu/cudnn_v7.h to provide /usr/include/cudnn.h (libcudnn) in auto mode
wiwao@wiwao-desktop:~$ sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.2_amd64.deb
Selecting previously unselected package libcudnn7-doc.
(Reading database ... 201188 files and directories currently installed.)
Preparing to unpack libcudnn7-doc_7.6.5.32-1+cuda10.2_amd64.deb ...
Unpacking libcudnn7-doc (7.6.5.32-1+cuda10.2) ...
Setting up libcudnn7-doc (7.6.5.32-1+cuda10.2) ...
wiwao@wiwao-desktop:~$ cp -r /usr/src/cudnn_samples_v7/ $HOME
wiwao@wiwao-desktop:~$ cd $HOME/cudnn_samples_v7/mnistCUDNN
wiwao@wiwao-desktop:~/cudnn_samples_v7/mnistCUDNN$ make clean && make
rm -rf *o
rm -rf mnistCUDNN
Linking agains cublasLt = true
CUDA VERSION: 10020
TARGET ARCH: x86_64
HOST_ARCH: x86_64
TARGET OS: linux
SMS: 30 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/include -IFreeImage/include  -m64    -gencode arch=compute_30,code=sm_30 -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/include -IFreeImage/include   -o fp16_emu.o -c fp16_emu.cpp
g++ -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include   -o mnistCUDNN.o -c mnistCUDNN.cpp
/usr/local/cuda/bin/nvcc -ccbin g++   -m64      -gencode arch=compute_30,code=sm_30 -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 mnistCUDNN fp16_dev.o fp16_emu.o mnistCUDNN.o -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include  -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -lcublasLt -LFreeImage/lib/linux/x86_64 -LFreeImage/lib/linux -lcudart -lcublas -lcudnn -lfreeimage -lstdc++ -lm
wiwao@wiwao-desktop:~/cudnn_samples_v7/mnistCUDNN$ ./mnistCUDNN
cudnnGetVersion() : 7605 , CUDNN_VERSION from cudnn.h : 7605 (7.6.5)
Host compiler version : GCC 7.5.0
There are 1 CUDA capable devices on your machine :
device 0 : sms 20  Capabilities 6.1, SmClock 1771.5 Mhz, MemSize (Mb) 8116, MemClock 5005.0 Mhz, Ecc=0, boardGroupID=0
Using device 0

Testing single precision
Loading image data/one_28x28.pgm
Performing forward propagation ...
Testing cudnnGetConvolutionForwardAlgorithm ...
Fastest algorithm is Algo 1
Testing cudnnFindConvolutionForwardAlgorithm ...
^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.017344 time requiring 0 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.030688 time requiring 3464 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.035840 time requiring 57600 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.048704 time requiring 203008 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.063488 time requiring 207360 memory
Resulting weights from Softmax:
0.0000000 0.9999399 0.0000000 0.0000000 0.0000561 0.0000000 0.0000012 0.0000017 0.0000010 0.0000000 
Loading image data/three_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000000 0.0000000 0.9999288 0.0000000 0.0000711 0.0000000 0.0000000 0.0000000 0.0000000 
Loading image data/five_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 0.9999820 0.0000154 0.0000000 0.0000012 0.0000006 

Result of classification: 1 3 5

Test passed!

Testing half precision (math in single precision)
Loading image data/one_28x28.pgm
Performing forward propagation ...
Testing cudnnGetConvolutionForwardAlgorithm ...
Fastest algorithm is Algo 1
Testing cudnnFindConvolutionForwardAlgorithm ...
^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.016352 time requiring 0 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.024576 time requiring 3464 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.029696 time requiring 28800 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.045760 time requiring 203008 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.060416 time requiring 207360 memory
Resulting weights from Softmax:
0.0000001 1.0000000 0.0000001 0.0000000 0.0000563 0.0000001 0.0000012 0.0000017 0.0000010 0.0000001 
Loading image data/three_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000714 0.0000000 0.0000000 0.0000000 0.0000000 
Loading image data/five_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 1.0000000 0.0000154 0.0000000 0.0000012 0.0000006 

Result of classification: 1 3 5

Test passed!
wiwao@wiwao-desktop:~/cudnn_samples_v7/mnistCUDNN$ 


Yolo学習中に誤って電源を落としてしまったので、GPUのドライバーが壊れてしまったみたい。
いろいろ修正しましたが肝心の学習のコマンドエラーなのでアノテーションデータとその他のデータをコピーしてUbuntu再インストール。
Ubuntu16.04 LTSのイメージをUSBメモリーにコピーしてファイルを初期化して再インストールをしましたが去年の作業が忘却の彼方。。。それ程難しい操作ではなかった筈が何度もエラー。
OSイメージの書込が上手く行かず、起動ディスクの設定で間違えて半日潰れてしまいました。

次のこともあるのでメモします。
Ubuntu16.04 LTSのイメージは日本語版ではなく英語版の最新をUSBにISOファイルで保存。BOISメニューで起動をUSBメモリーに変更して起動してインストールの再に日本語の設定(メニュー画面が日本語になるとディレクトリ名の日本語になるので英語でインストールしてロケールで日本語に変えること。次のインストールの際に気をつける。)ファイル名が日本語だとターミナル画面で日本語入力出来ない等の不都合が致命的。

その後各種設定、GPUのドライバーCUDA、cuDNNのインストールとOpenCVのインストールまで数日掛かりそう。
あっ、SSHのインストールしないとドライバーインストール失敗すると画面が真っ黒になって表示出来ないのでsudo apt-get install sshは最初に必要。
wiwao@wiwao-desktop:~$ sudo apt-get install ssh
[sudo] password for wiwao:
Reading package lists... Done
Building dependency tree     
Reading state information... Done
ssh is already the newest version (1:7.2p2-4ubuntu2.8).
The following package was automatically installed and is no longer required:
  snapd-login-service
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
reboot
他の端末からsshの接続確認。
再インストール時のSSHのおまじない。
Last login: Thu Oct 31 09:27:41 on ttys000
wiwaoMacBookAir:~ wiwao$ ssh wiwao@192.168.0.235
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:9KN5NXNFZqeRERb1uTIbuZhwaDWAz3sSWUwmU+8IZdU.
Please contact your system administrator.
Add correct host key in /Users/wiwao/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/wiwao/.ssh/known_hosts:5
ECDSA host key for 192.168.0.235 has changed and you have requested strict checking.
Host key verification failed.
wiwaoMacBookAir:~ wiwao$ ssh-keygen -R 192.168.0.235
# Host 192.168.0.235 found: line 5
/Users/wiwao/.ssh/known_hosts updated.
Original contents retained as /Users/wiwao/.ssh/known_hosts.old
wiwaoMacBookAir:~ wiwao$ ssh wiwao@192.168.0.235
The authenticity of host '192.168.0.235 (192.168.0.235)' can't be established.
ECDSA key fingerprint is SHA256:9KN5NXNFZqeRERb1uTIbuZhwaDWAz3sSWUwmU+8IZdU.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.235' (ECDSA) to the list of known hosts.
wiwao@192.168.0.235's password: 
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 5.0.0-32-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage


 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

185 packages can be updated.
99 updates are security updates.

Your Hardware Enablement Stack (HWE) is supported until April 2023.
Last login: Thu Oct 31 09:32:45 2019 from fe80::46c:7ef9:d09a:c93f%enp0s31f6

wiwao@wiwao-desktop:~$ 
次GPUドライバーのインストール。

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-367
sudo apt-get install mesa-common-dev
sudo apt-get install freeglut3-dev
reboot
で再起動
で$ nvidia-smi
wiwao@wiwao-desktop:~$ nvidia-smi
Wed Oct 30 11:16:50 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.130                Driver Version: 384.130                   |
|-------------------------------+----------------------+----------------------+
| 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 GTX 1080    Off  | 00000000:01:00.0  On |                  N/A |
| 33%   46C    P0    40W / 200W |    181MiB /  8110MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1200      G   /usr/lib/xorg/Xorg                           138MiB |
|    0      2029      G   compiz                                        40MiB |

+-----------------------------------------------------------------------------+

これを最初に実行することで、画面解像度やloginできなくなった時、後から簡単に元に戻すことが可能(設定->ソフトウェアとアップグレード->追加のドライバーを開けると確認できます。別の端末からssh接続してsudo apt-get install nvidia-367 --reinstallを実行するだけ

sudo apt-get --purge remove nvidia-*
sudo dpkg -i cuda-repo-ubuntu1604-8-0-rc_8.0.27-1_amd64.deb 
sudo apt-get update
sudo apt-get install cuda
sudo apt-get remove --purge -y cuda-repo-ubuntu1604-8-0-rc
sudo dpkg -i cuda-misc-headers-8-0_8.0.27.1-1_amd64.deb
sudo cp cuda/lib64/* /usr/local/cuda/lib64/
sudo cp cuda/include/* /usr/local/cuda/include/
sudo apt-get install nvidia-370 --reinstall
sudo apt-get --purge remove nvidia-*
sudo dpkg -i cuda-repo-ubuntu1604_9.2.148-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

ここまでで良かったのですが、最新のシステムで問題無いとのことでUbuntu18にして再スタート。Ubuntu16のサポートはもうすぐ終わる為この際、最新にする。(ここから嵌る。)

wiwao@wiwao-desktop:~$ nvidia-smi
Wed Oct 30 15:33:39 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.129                Driver Version: 390.129                   |
|-------------------------------+----------------------+----------------------+
| 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 GTX 1080    Off  | 00000000:01:00.0  On |                  N/A |
| 35%   45C    P8     7W / 200W |    226MiB /  8116MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1244      G   /usr/lib/xorg/Xorg                            18MiB |
|    0      1294      G   /usr/bin/gnome-shell                          49MiB |
|    0      1562      G   /usr/lib/xorg/Xorg                            86MiB |
|    0      1691      G   /usr/bin/gnome-shell                          69MiB |
+-----------------------------------------------------------------------------+
wiwao@wiwao-desktop:~$ 


ここから再スタート
cuda インストールですが、最新版がCUDA Toolkit 10.1 Update 2 Download
でdeb(network)はまたこのエラーが続く。
wiwao@wiwao-desktop:~$ sudo apt-get -y install cuda
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 cuda : Depends: cuda-10-1 (>= 10.1.243) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
wiwao@wiwao-desktop:~$ 
なのでdeb(local)で再度やり直し。
同じエラー
  1. Install aptitude
    sudo apt-get install aptitude
    
  2. Install main package
    sudo aptitude install cuda
cuda 10.1をインストール中
インストール出来た様なので
cd
 で最後に以下を追加書き込み。(時々小野さんスペル間違えて、抜き打ちテストする。。。)


export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}

export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

export LD_LIBRARY_PATH=/usr/local/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

export CUDA_HOME=/usr/local/cuda

reboot

でテスト
smokeParticles
sudo make -j8でコンパイル
これで./smokeParticles
OK

wiwao@wiwao-desktop:/usr/local/cuda-10.1/samples/5_Simulations/particles$ ./particles
CUDA Particles Simulation Starting...

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.


grid: 64 x 64 x 64 = 262144 cells

particles: 16384
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  33
  Current serial number in output stream:  34


あまり急にトントンとインストールしてエラーが出ました。再起動で動くようになりました。フー。。。。

次にcuDNN
wiwao@wiwao-desktop:~$ ll
total 2156816
drwxr-xr-x 19 wiwao wiwao       4096 10月 31 12:07 ./
drwxr-xr-x  3 root  root        4096 10月 31 09:06 ../
-rw-------  1 wiwao wiwao       1972 10月 31 12:21 .bash_history
-rw-r--r--  1 wiwao wiwao        220 10月 31 09:06 .bash_logout
-rw-r--r--  1 wiwao wiwao       4028 10月 31 11:24 .bashrc
drwx------ 14 wiwao wiwao       4096 10月 31 12:07 .cache/
drwx------ 16 wiwao wiwao       4096 10月 31 12:19 .config/
-rw-rw-r--  1 wiwao wiwao       2936 10月 31 10:40 cuda-repo-ubuntu1804_10.1.105-1_amd64.deb
-rw-rw-r--  1 wiwao wiwao       2936 10月 31 10:37 cuda-repo-ubuntu1804_10.1.168-1_amd64.deb
-rw-r--r--  1 wiwao wiwao 1859785444  8月 10 06:17 cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
drwxr-xr-x  2 wiwao wiwao       4096 10月 31 12:20 Desktop/
drwxr-xr-x  2 wiwao wiwao       4096 10月 31 09:19 Documents/
drwxr-xr-x  2 wiwao wiwao       4096 10月 31 12:07 Downloads/
-rw-r--r--  1 wiwao wiwao       8980 10月 31 09:06 examples.desktop
drwx------  3 wiwao wiwao       4096 10月 31 10:11 .gnome/
drwx------  3 wiwao wiwao       4096 10月 31 10:32 .gnupg/
-rw-------  1 wiwao wiwao       2076 10月 31 11:26 .ICEauthority
-rw-rw-r--  1 wiwao wiwao  182349464 10月 31 12:06 libcudnn7_7.6.4.38-1+cuda10.1_amd64.deb
-rw-rw-r--  1 wiwao wiwao  160754004 10月 31 12:07 libcudnn7-dev_7.6.4.38-1+cuda10.1_amd64.deb
-rw-rw-r--  1 wiwao wiwao    5553740 10月 31 12:07 libcudnn7-doc_7.6.4.38-1+cuda10.1_amd64.deb
drwx------  3 wiwao wiwao       4096 10月 31 09:16 .local/
drwx------  2 wiwao wiwao       4096 10月 31 11:29 .mozc/
drwxr-xr-x  2 wiwao wiwao       4096 10月 31 09:19 Music/
drwx------  4 wiwao wiwao       4096 10月 31 11:35 .nv/
-rw-r--r--  1 wiwao wiwao        351 10月 31 09:17 .pam_environment
drwxr-xr-x  2 wiwao wiwao       4096 10月 31 09:19 Pictures/
drwx------  3 wiwao wiwao       4096 10月 31 10:11 .pki/
-rw-r--r--  1 wiwao wiwao        807 10月 31 09:06 .profile
drwxr-xr-x  2 wiwao wiwao       4096 10月 31 09:19 Public/
drwx------  2 wiwao wiwao       4096 10月 31 09:58 .ssh/
-rw-r--r--  1 wiwao wiwao          0 10月 31 09:20 .sudo_as_admin_successful
drwxr-xr-x  2 wiwao wiwao       4096 10月 31 09:19 Templates/
drwxr-xr-x  2 wiwao wiwao       4096 10月 31 09:19 Videos/
-rw-rw-r--  1 wiwao wiwao        131 10月 31 09:17 .xinputrc
wiwao@wiwao-desktop:~$ sudo dpkg -i libcudnn7_7.6.4.38-1+cuda10.1_amd64.deb
Selecting previously unselected package libcudnn7.
(Reading database ... 189331 files and directories currently installed.)
Preparing to unpack libcudnn7_7.6.4.38-1+cuda10.1_amd64.deb ...
Unpacking libcudnn7 (7.6.4.38-1+cuda10.1) ...
Setting up libcudnn7 (7.6.4.38-1+cuda10.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
wiwao@wiwao-desktop:~$ sudo dpkg -i libcudnn7-dev_7.6.4.38–1+cuda10.1_amd64.deb
dpkg: error: cannot access archive 'libcudnn7-dev_7.6.4.38–1+cuda10.1_amd64.deb': No such file or directory
wiwao@wiwao-desktop:~$ sudo dpkg -i libcudnn7-dev_7.6.4.38-1+cuda10.1_amd64.deb
Selecting previously unselected package libcudnn7-dev.
(Reading database ... 189337 files and directories currently installed.)
Preparing to unpack libcudnn7-dev_7.6.4.38-1+cuda10.1_amd64.deb ...
Unpacking libcudnn7-dev (7.6.4.38-1+cuda10.1) ...
Setting up libcudnn7-dev (7.6.4.38-1+cuda10.1) ...
update-alternatives: using /usr/include/x86_64-linux-gnu/cudnn_v7.h to provide /usr/include/cudnn.h (libcudnn) in auto mode
wiwao@wiwao-desktop:~$ sudo dpkg -i libcudnn7-doc_7.6.4.38-1+cuda10.1_amd64.deb
Selecting previously unselected package libcudnn7-doc.
(Reading database ... 189343 files and directories currently installed.)
Preparing to unpack libcudnn7-doc_7.6.4.38-1+cuda10.1_amd64.deb ...
Unpacking libcudnn7-doc (7.6.4.38-1+cuda10.1) ...
Setting up libcudnn7-doc (7.6.4.38-1+cuda10.1) ...
wiwao@wiwao-desktop:~$ cp -r /usr/src/cudnn_samples_v7/ $HOME
wiwao@wiwao-desktop:~$ cd $HOME/cudnn_samples_v7/mnistCUDNN
wiwao@wiwao-desktop:~/cudnn_samples_v7/mnistCUDNN$ make clean && make
rm -rf *o
rm -rf mnistCUDNN
Linking agains cublasLt = true
CUDA VERSION: 10010
TARGET ARCH: x86_64
HOST_ARCH: x86_64
TARGET OS: linux
SMS: 30 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/include -IFreeImage/include  -m64    -gencode arch=compute_30,code=sm_30 -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/include -IFreeImage/include   -o fp16_emu.o -c fp16_emu.cpp
g++ -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include   -o mnistCUDNN.o -c mnistCUDNN.cpp
/usr/local/cuda/bin/nvcc -ccbin g++   -m64      -gencode arch=compute_30,code=sm_30 -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 mnistCUDNN fp16_dev.o fp16_emu.o mnistCUDNN.o -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include  -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -lcublasLt -LFreeImage/lib/linux/x86_64 -LFreeImage/lib/linux -lcudart -lcublas -lcudnn -lfreeimage -lstdc++ -lm
wiwao@wiwao-desktop:~/cudnn_samples_v7/mnistCUDNN$ ./mnistCUDNN
cudnnGetVersion() : 7604 , CUDNN_VERSION from cudnn.h : 7604 (7.6.4)
Host compiler version : GCC 7.4.0
There are 1 CUDA capable devices on your machine :
device 0 : sms 20  Capabilities 6.1, SmClock 1771.5 Mhz, MemSize (Mb) 8116, MemClock 5005.0 Mhz, Ecc=0, boardGroupID=0
Using device 0

Testing single precision
Loading image data/one_28x28.pgm
Performing forward propagation ...
Testing cudnnGetConvolutionForwardAlgorithm ...
Fastest algorithm is Algo 1
Testing cudnnFindConvolutionForwardAlgorithm ...
^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.023456 time requiring 0 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.039680 time requiring 3464 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.046720 time requiring 57600 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.071680 time requiring 203008 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.075776 time requiring 2057744 memory
Resulting weights from Softmax:
0.0000000 0.9999399 0.0000000 0.0000000 0.0000561 0.0000000 0.0000012 0.0000017 0.0000010 0.0000000 
Loading image data/three_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000000 0.0000000 0.9999288 0.0000000 0.0000711 0.0000000 0.0000000 0.0000000 0.0000000 
Loading image data/five_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 0.9999820 0.0000154 0.0000000 0.0000012 0.0000006 

Result of classification: 1 3 5

Test passed!

Testing half precision (math in single precision)
Loading image data/one_28x28.pgm
Performing forward propagation ...
Testing cudnnGetConvolutionForwardAlgorithm ...
Fastest algorithm is Algo 1
Testing cudnnFindConvolutionForwardAlgorithm ...
^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.023360 time requiring 0 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.038880 time requiring 3464 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.047808 time requiring 28800 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.075392 time requiring 203008 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.075680 time requiring 2057744 memory
Resulting weights from Softmax:
0.0000001 1.0000000 0.0000001 0.0000000 0.0000563 0.0000001 0.0000012 0.0000017 0.0000010 0.0000001 
Loading image data/three_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000714 0.0000000 0.0000000 0.0000000 0.0000000 
Loading image data/five_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 1.0000000 0.0000154 0.0000000 0.0000012 0.0000006 

Result of classification: 1 3 5

Test passed!

wiwao@wiwao-desktop:~/cudnn_samples_v7/mnistCUDNN$

で成功

次にOpenCV下記を一括入力
sudo apt install gcc-6 g++-6 cmake build-essential git pkg-config ccache \
unzip ecm extra-cmake-modules fcitx-libs-dev libfcitx-qt5-1 \
mesa-utils libgtk2.0-dev libgtk-3-dev ffmpeg \
libavcodec-dev libavformat-dev libswscale-dev \
libjpeg-dev libpng-dev libtiff5-dev x264 libxvidcore-dev yasm \
libxine2-dev libv4l-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev \
libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev \
x264 v4l-utils ffmpeg libdc1394-22 libdc1394-22-dev libtiff5-dev \
qt5-default libeigen3-dev libeigen3-doc tesseract-ocr tesseract-ocr-jpn \
vtk6 tcl-vtk6 python-vtk6 libgflags-dev autoconf automake libtool \
autoconf-archive libleptonica-dev libtesseract-dev gphoto2 liblapacke-dev \
libgoogle-glog-dev libprotobuf-dev libprotoc-dev protobuf-compiler \
libgphoto2-dev libvtk6-dev libvtk6-qt-dev liblapack-dev libatlas-base-dev



git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git
cd opencv
mkdir build
cd build


ビルド準備でこちらのcMakeをする。
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D BUILD_opencv_python3=ON \
-D WITH_CUBLAS=1 \
-D BUILD_EXAMPLES=ON ..
何故か-D WITH_CUDA=ON \
を外すと出来た。
--     Linker flags (Release):      -Wl,--gc-sections  
--     Linker flags (Debug):        -Wl,--gc-sections  
--     ccache:                      YES
--     Precompiled headers:         NO
--     Extra dependencies:          dl m pthread rt
--     3rdparty dependencies:
-- 
--   OpenCV modules:
--     To be built:                 aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot quality reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv java js matlab ovis python2 python3
--     Applications:                tests perf_tests examples apps
--     Documentation:               NO
--     Non-free algorithms:         NO
-- 
--   GUI: 
--     GTK+:                        YES (ver 3.22.30)
--       GThread :                  YES (ver 2.56.4)
--       GtkGlExt:                  NO
--     VTK support:                 YES (ver 6.3.0)
-- 
--   Media I/O: 
--     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
--     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
--     WEBP:                        /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x020e)
--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 2.3.0)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
-- 
--   Video I/O:
--     DC1394:                      YES (2.2.5)
--     FFMPEG:                      YES
--       avcodec:                   YES (57.107.100)
--       avformat:                  YES (57.83.100)
--       avutil:                    YES (55.78.100)
--       swscale:                   YES (4.8.100)
--       avresample:                NO
--     GStreamer:                   NO
--     v4l/v4l2:                    YES (linux/videodev2.h)
-- 
--   Parallel framework:            pthreads
-- 
--   Trace:                         YES (with Intel ITT)
-- 
--   Other third-party libraries:
--     Intel IPP:                   2019.0.0 Gold [2019.0.0]
--            at:                   /home/wiwao/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
--     Intel IPP IW:                sources (2019.0.0)
--               at:                /home/wiwao/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
--     Lapack:                      YES (/usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libcblas.so /usr/lib/x86_64-linux-gnu/libatlas.so)
--     Eigen:                       YES (ver 3.3.4)
--     Custom HAL:                  NO
--     Protobuf:                    build (3.5.1)
-- 
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/wiwao/opencv/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
-- 
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.6.8)
--     Libraries:                   NO
--     numpy:                       NO (Python3 wrappers can not be generated)
--     install path:                -
-- 
--   Python (for build):            /usr/bin/python2.7
-- 
--   Java:                          
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
-- 
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wiwao/opencv/build

-- General configuration for OpenCV 3.4.0 =====================================
--   Version control:               unknown
-- 
--   Extra modules:
--     Location (extra):            /home/wiwao/src/opencv_contrib/modules
--     Version control (extra):     unknown
-- 
--   Platform:
--     Timestamp:                   2019-11-05T07:24:27Z
--     Host:                        Linux 5.0.0-32-generic x86_64
--     CMake:                       3.10.2
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   CPU/HW features:
--     Baseline:                    SSE SSE2 SSE3
--       requested:                 SSE3
--     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2
--       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2
--       SSE4_1 (3 files):          + SSSE3 SSE4_1
--       SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
--       FP16 (2 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
--       AVX (5 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
--       AVX2 (9 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++11:                       YES
--     C++ Compiler:                /usr/bin/c++  (ver 7.4.0)
--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):
--     Linker flags (Debug):
--     ccache:                      YES
--     Precompiled headers:         NO
--     Extra dependencies:          dl m pthread rt cudart nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda-10.1/lib64 -L/usr/lib/x86_64-linux-gnu
--     3rdparty dependencies:
-- 
--   OpenCV modules:
--     To be built:                 aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dpm face features2d flann freetype fuzzy hdf highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python_bindings_generator reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    js world
--     Disabled by dependency:      -
--     Unavailable:                 cnn_3dobj cvv dnn_modern java matlab ovis python2 python3
--     Applications:                tests perf_tests examples apps
--     Documentation:               NO
--     Non-free algorithms:         NO
-- 
--   GUI: 
--     GTK+:                        YES (ver 3.22.30)
--       GThread :                  YES (ver 2.56.4)
--       GtkGlExt:                  NO
--     VTK support:                 YES (ver 6.3.0)
-- 
--   Media I/O: 
--     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
--     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
--     WEBP:                        /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x020e)
--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
-- 
--   Video I/O:
--     DC1394:                      YES (ver 2.2.5)
--     FFMPEG:                      YES
--       avcodec:                   YES (ver 57.107.100)
--       avformat:                  YES (ver 57.83.100)
--       avutil:                    YES (ver 55.78.100)
--       swscale:                   YES (ver 4.8.100)
--       avresample:                NO
--     GStreamer:                   NO
--     libv4l/libv4l2:              NO
--     v4l/v4l2:                    linux/videodev2.h
--     gPhoto2:                     YES
-- 
--   Parallel framework:            pthreads
-- 
--   Trace:                         YES (with Intel ITT)
-- 
--   Other third-party libraries:
--     Intel IPP:                   2017.0.3 [2017.0.3]
--            at:                   /home/wiwao/src/opencv/build/3rdparty/ippicv/ippicv_lnx
--     Intel IPP IW:                sources (2017.0.3)
--               at:                /home/wiwao/src/opencv/build/3rdparty/ippicv/ippiw_lnx
--     Lapack:                      YES (/usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libcblas.so /usr/lib/x86_64-linux-gnu/libatlas.so)
--     Eigen:                       YES (ver 3.3.4)
--     Custom HAL:                  NO
-- 
--   NVIDIA CUDA:                   YES (ver 10.1, CUFFT CUBLAS NVCUVID FAST_MATH)
--     NVIDIA GPU arch:             30 35 37 50 52 60 61 70
--     NVIDIA PTX archs:
-- 
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/wiwao/src/opencv/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
-- 
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.6.8)
--     Libraries:                   NO
--     numpy:                       NO (Python3 wrappers can not be generated)
--     packages path:               lib/python3.6/dist-packages
-- 
--   Python (for build):            /usr/bin/python2.7
-- 
--   Java:
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
-- 
--   Matlab:                        NO
-- 
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wiwao/src/opencv/build

結論はdarknetコンパイル時にopenCVが理由でエラー

ここからエラーが頻発するので調べるとopencv3.4.0ならdarknetが動くと言う記事があったので一から入れ直し
https://hatobus.hatenablog.jp/entry/2018/07/05/104114



sudo apt install cmake
$ wget https://github.com/opencv/opencv/archive/3.4.0.tar.gz
$ tar xvzf 3.4.0.tar.gz 
$ ln -s opencv-3.4.0 opencv
$ wget https://github.com/opencv/opencv_contrib/archive/3.4.0.tar.gz
$ mv 3.4.0.tar.gz.1 opencv_contrib-3.4.0.tar.gz
$ tar xvzf opencv_contrib-3.4.0.tar.gz 
$ ln -s opencv_contrib-3.4.0 opencv_contrib
$ cd opencv
$ mkdir build
$ cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D BUILD_opencv_cudacodec=OFF \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D WITH_CUBLAS=1 \
-D WITH_CUDA=ON ..
でmake -j16それから

sudo make install

sudo ldconfig

python
import cv2すど

cv2.cuda.getCudaEnabledDeviceCount()
でエラー。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

もし失敗してたら
cd ~/opencv/
rm -rf build

でbuildフォルダを消してからCmakeからやり直してください。
だって。。。

でも設定はこの通りでdarknetは通りました。


-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.1
-- Checking SFM deps... TRUE
-- CERES support is disabled. Ceres Solver for reconstruction API is required.
--
-- General configuration for OpenCV 3.4.0 =====================================
--   Version control:               unknown
--
--   Extra modules:
--     Location (extra):            /home/wiwao/opencv_contrib/modules
--     Version control (extra):     unknown
--
--   Platform:
--     Timestamp:                   2019-11-11T06:42:17Z
--     Host:                        Linux 5.0.0-32-generic x86_64
--     CMake:                       3.10.2
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
--
--   CPU/HW features:
--     Baseline:                    SSE SSE2 SSE3
--       requested:                 SSE3
--     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2
--       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2
--       SSE4_1 (3 files):          + SSSE3 SSE4_1
--       SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
--       FP16 (2 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
--       AVX (5 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
--       AVX2 (9 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++11:                       YES
--     C++ Compiler:                /usr/bin/c++  (ver 7.4.0)
--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):
--     Linker flags (Debug):
--     ccache:                      YES
--     Precompiled headers:         NO
--     Extra dependencies:          dl m pthread rt cudart nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda-10.1/lib64 -L/usr/lib/x86_64-linux-gnu
--     3rdparty dependencies:
--
--   OpenCV modules:
--     To be built:                 aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dpm face features2d flann freetype fuzzy hdf highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python_bindings_generator reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    cudacodec js world
--     Disabled by dependency:      -
--     Unavailable:                 cnn_3dobj cvv dnn_modern java matlab ovis python2 python3
--     Applications:                tests perf_tests apps
--     Documentation:               NO
--     Non-free algorithms:         NO
--
--   GUI:
--     GTK+:                        YES (ver 3.22.30)
--       GThread :                  YES (ver 2.56.4)
--       GtkGlExt:                  NO
--     VTK support:                 YES (ver 6.3.0)
--
--   Media I/O:
--     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
--     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
--     WEBP:                        /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x020e)
--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
--
--   Video I/O:
--     DC1394:                      YES (ver 2.2.5)
--     FFMPEG:                      YES
--       avcodec:                   YES (ver 57.107.100)
--       avformat:                  YES (ver 57.83.100)
--       avutil:                    YES (ver 55.78.100)
--       swscale:                   YES (ver 4.8.100)
--       avresample:                NO
--     GStreamer:                   NO
--     libv4l/libv4l2:              NO
--     v4l/v4l2:                    linux/videodev2.h
--     gPhoto2:                     YES
--
--   Parallel framework:            pthreads
--
--   Trace:                         YES (with Intel ITT)
--
--   Other third-party libraries:
--     Intel IPP:                   2017.0.3 [2017.0.3]
--            at:                   /home/wiwao/opencv/build/3rdparty/ippicv/ippicv_lnx
--     Intel IPP IW:                sources (2017.0.3)
--               at:                /home/wiwao/opencv/build/3rdparty/ippicv/ippiw_lnx
--     Lapack:                      YES (/usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libcblas.so /usr/lib/x86_64-linux-gnu/libatlas.so)
--     Eigen:                       YES (ver 3.3.4)
--     Custom HAL:                  NO
--
--   NVIDIA CUDA:                   YES (ver 10.1, CUFFT CUBLAS NVCUVID FAST_MATH)
--     NVIDIA GPU arch:             30 35 37 50 52 60 61 70
--     NVIDIA PTX archs:
--
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/wiwao/opencv/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
--
--   Python (for build):            /usr/bin/python2.7
--
--   Java:
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
--
--   Matlab:                        NO
--
--   Install to:                    /usr/local
-- -----------------------------------------------------------------

パイソンのエラーは出ますがdarknetが下記makefileで
エラーがない。
GPU=1
CUDNN=1
CUDNN_HALF=0
OPENCV=1
AVX=0
OPENMP=0
LIBSO=0
ZED_CAMERA=0

# set GPU=1 and CUDNN=1 to speedup on GPU
# set CUDNN_HALF=1 to further speedup 3 x times (Mixed-precision on Tensor Cores) GPU: Volta, Xavier, Turing and higher
# set AVX=1 and OPENMP=1 to speedup on CPU (if error occurs then set AVX=0)

DEBUG=0

ARCH= -gencode arch=compute_30,code=sm_30 \
      -gencode arch=compute_35,code=sm_35 \
      -gencode arch=compute_50,code=[sm_50,compute_50] \
      -gencode arch=compute_52,code=[sm_52,compute_52] \
 -gencode arch=compute_61,code=[sm_61,compute_61]

OS := $(shell uname)

# Tesla V100
# ARCH= -gencode arch=compute_70,code=[sm_70,compute_70]

# GeForce RTX 2080 Ti, RTX 2080, RTX 2070, Quadro RTX 8000, Quadro RTX 6000, Quadro RTX 5000, Tesla T4, XNOR Tensor Cores
# ARCH= -gencode arch=compute_75,code=[sm_75,compute_75]

# Jetson XAVIER
# ARCH= -gencode arch=compute_72,code=[sm_72,compute_72]

# GTX 1080, GTX 1070, GTX 1060, GTX 1050, GTX 1030, Titan Xp, Tesla P40, Tesla P4
 ARCH= -gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61



2020/02/21
revised


  • Home
  • High Performance Computing
  • CUDA Toolkit
  • CUDA Toolkit 10.2 Download


  • darknetの設定の記録が無くなっていたので補足。

    git clone https://github.com/AlexeyAB/darknet
    cd darknet
    mkdir build-release
    cd build-release
    cmake ..
    make
    make install

    https://pjreddie.com/media/files/yolov3.weights
    cd darknet
    ここにyolov3.weightsを入れる。
    それからMakefileを下記に変更

    GPU=1
    CUDNN=1
    CUDNN_HALF=0
    OPENCV=1
    AVX=0
    OPENMP=0
    LIBSO=0
    ZED_CAMERA=0

    # set GPU=1 and CUDNN=1 to speedup on GPU
    # set CUDNN_HALF=1 to further speedup 3 x times (Mixed-precision on Tensor Cores) GPU: Volta, Xavier, Turing and higher
    # set AVX=1 and OPENMP=1 to speedup on CPU (if error occurs then set AVX=0)

    DEBUG=0

    ARCH= -gencode arch=compute_30,code=sm_30 \
    -gencode arch=compute_35,code=sm_35 \
    -gencode arch=compute_50,code=[sm_50,compute_50] \
    -gencode arch=compute_52,code=[sm_52,compute_52] \
    # -gencode arch=compute_61,code=[sm_61,compute_61]

    OS := $(shell uname)

    # Tesla V100
    # ARCH= -gencode arch=compute_70,code=[sm_70,compute_70]

    # GeForce RTX 2080 Ti, RTX 2080, RTX 2070, Quadro RTX 8000, Quadro RTX 6000, Quadro RTX 5000, Tesla T4, XNOR Tensor Cores
    # ARCH= -gencode arch=compute_75,code=[sm_75,compute_75]

    # Jetson XAVIER
    # ARCH= -gencode arch=compute_72,code=[sm_72,compute_72]

    # GTX 1080, GTX 1070, GTX 1060, GTX 1050, GTX 1030, Titan Xp, Tesla P40, Tesla P4
    ARCH= -gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61

    それからmake -j8
    webカメラを付けて下記コマンドで問題無いか?


    ./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights -c 0

    0 件のコメント:

    コメントを投稿