最近需要用到一台服务器的GPU跑实验,其间 COLMAP 编译过程出错,提示 cuda 版本不支持,cmake虽然通过了,但其实没有找到支持的CUDA架构。
cv@cv:~/mvs_project/colmap/build$ cmake .. ... -- Automatic GPU detection failed. Building for common architectures. -- Autodetected CUDA architecture(s): 3.0;3.5;5.0;5.2;6.0;6.1;7.0;7.0+PTX -- Enabling CUDA support (version: 9.0, archs: sm_30 sm_35 sm_50 sm_52 sm_60 sm_61 sm_70 compute_70) ...colmap_build_errorcv@cv:~/mvs_project/colmap/build$ make [ 0%] Automatic rcc for target flann [ 0%] Built target flann_automoc [ 0%] Building CXX object lib/FLANN/CMakeFiles/flann.dir/flann.cpp.o [ 0%] Building C object lib/FLANN/CMakeFiles/flann.dir/ext/lz4.c.o [ 1%] Building C object lib/FLANN/CMakeFiles/flann.dir/ext/lz4hc.c.o [ 1%] Linking CXX static library libflann.a [ 1%] Built target flann [ 1%] Automatic rcc for target graclus [ 1%] Built target graclus_automoc [ 1%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/util.c.o [ 1%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mincover.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kwayrefine.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/refine.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/ometis.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mmatch.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mutil.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mpmetis.c.o [ 5%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/balance.c.o [ 5%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mfm2.c.o [ 5%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mesh.c.o [ 5%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/compress.c.o [ 5%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/initpart.c.o [ 7%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/subdomains.c.o [ 7%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kwayvolfm.c.o [ 7%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/fortran.c.o [ 7%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/pmetis.c.o [ 7%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kwayfm.c.o [ 9%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/parmetis.c.o [ 9%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/coarsen.c.o [ 9%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mkwayfmh.c.o [ 9%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mbalance2.c.o [ 9%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mbalance.c.o [ 11%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mmd.c.o [ 11%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/pqueue.c.o [ 11%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/estmem.c.o [ 11%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/myqsort.c.o [ 11%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kvmetis.c.o [ 13%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/fm.c.o [ 13%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/ccgraph.c.o [ 13%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/minitpart2.c.o [ 13%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/bucketsort.c.o [ 13%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/graph.c.o [ 15%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mrefine2.c.o [ 15%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/frename.c.o [ 15%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/stat.c.o [ 15%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/debug.c.o [ 15%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/srefine.c.o [ 17%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/meshpart.c.o [ 17%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mrefine.c.o [ 17%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kwayvolrefine.c.o [ 17%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/match.c.o [ 17%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kmetis.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mkwayrefine.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/metis.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mcoarsen.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/timing.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mfm.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/memory.c.o [ 21%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/minitpart.c.o [ 21%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/sfm.c.o [ 21%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mkmetis.c.o [ 21%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/separator.c.o [ 21%] Building C object lib/Graclus/CMakeFiles/graclus.dir/multilevelLib/wkkm.c.o [ 23%] Building C object lib/Graclus/CMakeFiles/graclus.dir/multilevelLib/mlkkm.c.o [ 23%] Linking C static library libgraclus.a [ 23%] Built target graclus [ 25%] Automatic rcc for target lsd [ 25%] Built target lsd_automoc [ 25%] Building C object lib/LSD/CMakeFiles/lsd.dir/lsd.c.o [ 25%] Linking C static library liblsd.a [ 25%] Built target lsd [ 25%] Automatic rcc for target pba [ 25%] Built target pba_automoc [ 25%] Building NVCC (Device) object lib/PBA/CMakeFiles/pba.dir/pba_generated_ProgramCU.cu.o CMake Error at pba_generated_ProgramCU.cu.o.cmake:207 (message): Error generating /home/cv/mvs_project/colmap/build/lib/PBA/CMakeFiles/pba.dir//./pba_generated_ProgramCU.cu.o lib/PBA/CMakeFiles/pba.dir/build.make:63: recipe for target 'lib/PBA/CMakeFiles/pba.dir/pba_generated_ProgramCU.cu.o' failed make[2]: *** [lib/PBA/CMakeFiles/pba.dir/pba_generated_ProgramCU.cu.o] Error 1 CMakeFiles/Makefile2:485: recipe for target 'lib/PBA/CMakeFiles/pba.dir/all' failed make[1]: *** [lib/PBA/CMakeFiles/pba.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2
于是又开始配置环境,首先根据自己机器配置NVIDIA官方网站下载 GeForce 驱动程序
>> 检查机器环境及配置
内核版本及操作系统信息
cv@cv:~/mvs_project/colmap/build$ uname -r
4.15.0-65-generic
cv@cv:~/mvs_project/colmap/build$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.6 LTS Release: 16.04 Codename: xenial cv@cv:~/mvs_project/colmap/build$ gcc --version gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.已经安装过显卡驱动的机器可以直接通过 nvidia-smi 命令显示显卡型号和驱动版本信息
cv@cv:~/mvs_project/colmap/build$ nvidia-smi Sat Nov 30 10:49:14 2019 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 418.43 Driver Version: 418.43 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 2070 Off | 00000000:01:00.0 Off | N/A | | 0% 65C P0 1W / 210W | 0MiB / 7952MiB | 0% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+对尚未安装过显卡驱动的机器,可以通过 lspci 指令查询,grep -i 的意思是忽略后面匹配项的大小写
cv@cv:~/mvs_project/colmap/build$ lspci | grep -i vga | grep -i nvidia 01:00.0 VGA compatible controller: NVIDIA Corporation Device 1f07 (rev a1)这里返回的是一串十六进制代码 1f07,跟我们平常所见略有不同,需要翻译一下,到 PCI devices 查询。打不开网页或者打开很慢的可以参考放在GitHub上的一份常见型号对应表
知道了自己的机器的配置就可以到上面给出的网站(https://www.geforce.cn/drivers)下载对应的驱动程序。
开始安装驱动之前的准备工作
>> 卸载旧版本或安装失败的驱动
cv@cv:~/mvs_project/colmap/build$ cd cv@cv:~$ sudo ./NVIDIA-Linux-x86_64-418.43.run --uninstall>> 安装可能需要的依赖
cv@cv:~$ sudo apt update cv@cv:~$ sudo apt install dkms build-essential linux-headers-generic cv@cv:~$ sudo apt install gcc-multilib xorg-dev cv@cv:~$ sudo apt install freeglut3-dev libx11-dev libxmu-dev libxi-dev cv@cv:~$ sudo apt install libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev>> 禁用 NOUVEAU 驱动
直接使用 VIM 打开,没有该文件时自动新建
cv@cv:~$ sudo vim /etc/modprobe.d/blacklist-nouveau.conf在文件中添加如下内容,保存退出
blacklist nouveau blacklist lbm-nouveau options nouveau modeset=0 alias nouveau off alias lbm-nouveau off然后执行下面的指令,禁用 nouveau 内核模块,更新配置,重启
cv@cv:~$ echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf cv@cv:~$ sudo update-initramfs -u cv@cv:~$ sudo rebootCTRL+ALT+F1 进入命令行模式,输入下面的命令,如果没有任何显示则表明禁用驱动成功了。然后关闭图形界面,后面要记得重新打开。
cv@cv:~$ lsmod | grep nouveaucv@cv:~$ sudo service lightdm stop
然后开始安装显卡驱动
cv@cv:~$ chmod a+x NVIDIA-Linux-x86_64-418.43.run cv@cv:~$ sudo ./NVIDIA-Linux-x86_64-418.43.run --dkms --no-opengl-files-dkms 默认开启。在 kernel 自行更新时将驱动程序安装至模块中,从而阻止驱动程序重新安装。
–no-opengl-files 表示只安装驱动文件,不安装OpenGL文件。这个参数不可省略,否则会导致登陆界面死循环。因为NVIDIA的驱动默认会安装OpenGL,而Ubuntu的内核本身也有OpenGL且与GUI显示息息相关,
一旦NVIDIA的驱动覆盖了OpenGL,在GUI需要动态链接OpenGL库的时候就会出现问题。
–no-x-check 表示安装驱动时不检查X服务,非必需,已经禁用图形界面。
–no-nouveau-check 表示安装驱动时不检查nouveau,非必需,已经禁用nouveau驱动。
–disable-nouveau 禁用nouveau。非必需,因为之前已经手动禁用了nouveau。
安装过程中弹出pre-install script failed的信息,继续安装即可,没有影响。
dkms 选项选yes
32位兼容 选项选yes
x-org 选项保持默认选no
安装完成后打开图形桌面。
cv@cv:~$ sudo service lightdm start cv@cv:~$ nvidia-smi如果有显示GPU相关信息表示驱动安装成功。
卸载CUDA
首先卸载以前安装的或安装失败的CUDA,以便我们顺利进行下面的步骤,直接执行CUDA自带的卸载脚本。
cv@cv:~$ sudo /usr/local/cuda-9.0/bin/uninstall_cuda_9.0.pl卸载完成后,清除残留文件夹。
cv@cv:~$ sudo rm -rf /usr/local/cuda-9.0/
安装CUDA和CUDNN
>> 首先下载安装文件,我们要安装的是CUDA10.1和CUDNN7.6
根据对应关系到 CUDA 下载页面寻找自己需要的版本,比如我下载的是 CUDA Toolkit 10.1 update2,选择好操作系统,系统架构和安装类型之后下载即可。
到 CUDA Toolkit Archive 网站上下载
cuda_10.1.243_418.87.00_linux.run
然后下载CUDNN,需要注册或登录NVIDIA账号,看清楚版本,到 cuDNN Download 网站上 for CUDA 10.1 下载里面的三个deb安装包
libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb
libcudnn7-dev_7.6.5.32-1+cuda10.1_amd64.deb
libcudnn7-doc_7.6.5.32-1+cuda10.1_amd64.deb
>> 然后开始安装 CUDA
cv@cv:~$ sudo service lightdm stop cv@cv:~$ chmod a+x cuda_10.1.243_418.87.00_linux.run cv@cv:~$ sudo ./cuda_10.1.243_418.87.00_linux.run是否同意条款 accept
选择安装界面,除了418.87取消勾选之外其他保持默认
剩下的都保持默认即可
然后打开配置文件,并在末尾添加链接路径,保存退出
cv@cv:~$ vim ~/.bashrc export PATH=/usr/local/cuda-10.1/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH使生效
cv@cv:~$ source ~/.bashrc这是应该已经可以查看CUDA安装版本了
cv@cv:~$ nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 20xx-20xx NVIDIA Corporation Built on Tue_Jan_10_13:22:03_CST_20xx Cuda compilation tools, release 10.1, V10.1.x>> 接着安装 cuDNN
cv@cv:~$ sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb cv@cv:~$ sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.1_amd64.deb cv@cv:~$ sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.1_amd64.deb>> 打开图形界面
cv@cv:~$ sudo service lightdm start
验证安装是否成功
>> CUDA 测试,进入到 CUDA 例程路径下,编译并测试
cv@cv:~$ cd NVIDIA_CUDA-10.1_Samples/ cv@cv:~/NVIDIA_CUDA-10.1_Samples$ make cv@cv:~/NVIDIA_CUDA-10.1_Samples$ cd bin/x86_64/linux/release/cv@cv:~/NVIDIA_CUDA-10.1_Samples/bin/x86_64/linux/release$ ./deviceQuery ./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking) Detected 1 CUDA Capable device(s) Device 0: "GeForce RTX 2070" CUDA Driver Version / Runtime Version 10.1 / 10.1 CUDA Capability Major/Minor version number: 7.5 Total amount of global memory: 7952 MBytes (8338604032 bytes) (36) Multiprocessors, ( 64) CUDA Cores/MP: 2304 CUDA Cores GPU Max Clock rate: 1710 MHz (1.71 GHz) Memory Clock rate: 7001 Mhz Memory Bus Width: 256-bit L2 Cache Size: 4194304 bytes Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384) Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers Total amount of constant memory: 65536 bytes Total amount of shared memory per block: 49152 bytes Total number of registers available per block: 65536 Warp size: 32 Maximum number of threads per multiprocessor: 1024 Maximum number of threads per block: 1024 Max dimension size of a thread block (x,y,z): (1024, 1024, 64) Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535) Maximum memory pitch: 2147483647 bytes Texture alignment: 512 bytes Concurrent copy and kernel execution: Yes with 3 copy engine(s) Run time limit on kernels: No Integrated GPU sharing Host Memory: No Support host page-locked memory mapping: Yes Alignment requirement for Surfaces: Yes Device has ECC support: Disabled Device supports Unified Addressing (UVA): Yes Device supports Compute Preemption: Yes Supports Cooperative Kernel Launch: Yes Supports MultiDevice Co-op Kernel Launch: Yes Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0 Compute Mode: < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) > deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.1, CUDA Runtime Version = 10.1, NumDevs = 1 Result = PASScv@cv:~/NVIDIA_CUDA-10.1_Samples/bin/x86_64/linux/release$ ./bandwidthTest [CUDA Bandwidth Test] - Starting... Running on... Device 0: GeForce RTX 2070 Quick Mode Host to Device Bandwidth, 1 Device(s) PINNED Memory Transfers Transfer Size (Bytes) Bandwidth(GB/s) 32000000 12.8 Device to Host Bandwidth, 1 Device(s) PINNED Memory Transfers Transfer Size (Bytes) Bandwidth(GB/s) 32000000 13.1 Device to Device Bandwidth, 1 Device(s) PINNED Memory Transfers Transfer Size (Bytes) Bandwidth(GB/s) 32000000 382.0 Result = PASS NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.>> cuDNN 测试
cv@cv:~$ cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2 -m 1 #define CUDNN_MAJOR 7 #define CUDNN_MINOR 6 #define CUDNN_PATCHLEVEL 5cv@cv:~$ cp -r /usr/src/cudnn_samples_v7/ . cv@cv:~$ cd cudnn_samples_v7/mnistCUDNN/ cv@cv:~$ make 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++ -lmcv@cv:~/cudnn_samples_v7/mnistCUDNN$ ./mnistCUDNN cudnnGetVersion() : 7605 , CUDNN_VERSION from cudnn.h : 7605 (7.6.5) Host compiler version : GCC 5.4.0 There are 1 CUDA capable devices on your machine : device 0 : sms 36 Capabilities 7.5, SmClock 1710.0 Mhz, MemSize (Mb) 7952, MemClock 7001.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 0 Testing cudnnFindConvolutionForwardAlgorithm ... ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.039040 time requiring 0 memory ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.100576 time requiring 3464 memory ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.122400 time requiring 2057744 memory ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.130560 time requiring 203008 memory ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.173888 time requiring 57600 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 0 Testing cudnnFindConvolutionForwardAlgorithm ... ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.022528 time requiring 0 memory ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.061344 time requiring 3464 memory ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.065536 time requiring 28800 memory ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.070208 time requiring 203008 memory ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.082592 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!
当这些配置好之后,COLMAP 的编译就很顺利地通过了。
colmap_buildcv@cv:~/mvs_project/colmap/build$ cmake .. -- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found installed version of Eigen: /usr/lib/cmake/eigen3 -- Found required Ceres dependency: Eigen version 3.2.92 in /usr/include/eigen3 -- Found required Ceres dependency: glog -- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE -- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE - Success -- Found required Ceres dependency: gflags -- Found Ceres version: 1.14.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, OpenMP, Multithreading] -- Boost version: 1.58.0 -- Found the following Boost libraries: -- program_options -- filesystem -- graph -- regex -- system -- unit_test_framework -- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0") -- Found Eigen -- Includes : /usr/include/eigen3 -- Found FreeImage -- Includes : /usr/include -- Libraries : /usr/lib/x86_64-linux-gnu/libfreeimage.so -- Found Glog -- Includes : /usr/include -- Libraries : /usr/lib/x86_64-linux-gnu/libglog.so -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so -- Found Glew -- Includes : /usr/include -- Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so -- Found Git: /usr/bin/git (found version "2.7.4") -- Found Threads: TRUE -- Found Qt -- Module : /usr/lib/x86_64-linux-gnu/cmake/Qt5Core -- Module : /usr/lib/x86_64-linux-gnu/cmake/Qt5OpenGL -- Module : /usr/lib/x86_64-linux-gnu/cmake/Qt5Widgets -- Found CGAL -- Includes : /usr/include -- Libraries : /usr/lib/x86_64-linux-gnu/libCGAL.so.11.0.1 -- Build type not specified, using Release -- Enabling SIMD support -- Enabling OpenMP support -- Disabling interprocedural optimization -- Autodetected CUDA architecture(s): 7.5 -- Enabling CUDA support (version: 10.1, archs: sm_75) -- Enabling OpenGL support -- Disabling profiling support -- Enabling CGAL support -- Configuring done -- Generating done -- Build files have been written to: /home/cv/mvs_project/colmap/build cv@cv:~/mvs_project/colmap/build$ make Scanning dependencies of target flann_automoc [ 0%] Automatic rcc for target flann [ 0%] Built target flann_automoc Scanning dependencies of target flann [ 0%] Building CXX object lib/FLANN/CMakeFiles/flann.dir/flann.cpp.o [ 0%] Building C object lib/FLANN/CMakeFiles/flann.dir/ext/lz4.c.o [ 1%] Building C object lib/FLANN/CMakeFiles/flann.dir/ext/lz4hc.c.o [ 1%] Linking CXX static library libflann.a [ 1%] Built target flann Scanning dependencies of target graclus_automoc [ 1%] Automatic rcc for target graclus [ 1%] Built target graclus_automoc Scanning dependencies of target graclus [ 1%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/util.c.o [ 1%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mincover.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kwayrefine.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/refine.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/ometis.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mmatch.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mutil.c.o [ 3%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mpmetis.c.o [ 5%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/balance.c.o [ 5%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mfm2.c.o [ 5%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mesh.c.o [ 5%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/compress.c.o [ 5%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/initpart.c.o [ 7%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/subdomains.c.o [ 7%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kwayvolfm.c.o [ 7%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/fortran.c.o [ 7%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/pmetis.c.o [ 7%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kwayfm.c.o [ 9%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/parmetis.c.o [ 9%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/coarsen.c.o [ 9%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mkwayfmh.c.o [ 9%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mbalance2.c.o [ 9%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mbalance.c.o [ 11%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mmd.c.o [ 11%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/pqueue.c.o [ 11%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/estmem.c.o [ 11%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/myqsort.c.o [ 11%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kvmetis.c.o [ 13%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/fm.c.o [ 13%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/ccgraph.c.o [ 13%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/minitpart2.c.o [ 13%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/bucketsort.c.o [ 13%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/graph.c.o [ 15%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mrefine2.c.o [ 15%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/frename.c.o [ 15%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/stat.c.o [ 15%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/debug.c.o [ 15%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/srefine.c.o [ 17%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/meshpart.c.o [ 17%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mrefine.c.o [ 17%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kwayvolrefine.c.o [ 17%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/match.c.o [ 17%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/kmetis.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mkwayrefine.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/metis.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mcoarsen.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/timing.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mfm.c.o [ 19%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/memory.c.o [ 21%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/minitpart.c.o [ 21%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/sfm.c.o [ 21%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/mkmetis.c.o [ 21%] Building C object lib/Graclus/CMakeFiles/graclus.dir/metisLib/separator.c.o [ 21%] Building C object lib/Graclus/CMakeFiles/graclus.dir/multilevelLib/wkkm.c.o [ 23%] Building C object lib/Graclus/CMakeFiles/graclus.dir/multilevelLib/mlkkm.c.o [ 23%] Linking C static library libgraclus.a [ 23%] Built target graclus Scanning dependencies of target lsd_automoc [ 25%] Automatic rcc for target lsd [ 25%] Built target lsd_automoc Scanning dependencies of target lsd [ 25%] Building C object lib/LSD/CMakeFiles/lsd.dir/lsd.c.o [ 25%] Linking C static library liblsd.a [ 25%] Built target lsd Scanning dependencies of target pba_automoc [ 25%] Automatic rcc for target pba [ 25%] Built target pba_automoc [ 25%] Building NVCC (Device) object lib/PBA/CMakeFiles/pba.dir/pba_generated_ProgramCU.cu.o Scanning dependencies of target pba [ 25%] Building CXX object lib/PBA/CMakeFiles/pba.dir/ConfigBA.cpp.o [ 25%] Building CXX object lib/PBA/CMakeFiles/pba.dir/CuTexImage.cpp.o [ 25%] Building CXX object lib/PBA/CMakeFiles/pba.dir/pba.cpp.o [ 27%] Building CXX object lib/PBA/CMakeFiles/pba.dir/SparseBundleCPU.cpp.o [ 27%] Building CXX object lib/PBA/CMakeFiles/pba.dir/SparseBundleCU.cpp.o [ 27%] Linking CXX static library libpba.a [ 27%] Built target pba Scanning dependencies of target poisson_recon_automoc [ 27%] Automatic rcc for target poisson_recon [ 27%] Built target poisson_recon_automoc Scanning dependencies of target poisson_recon [ 27%] Building CXX object lib/PoissonRecon/CMakeFiles/poisson_recon.dir/CmdLineParser.cpp.o [ 29%] Building CXX object lib/PoissonRecon/CMakeFiles/poisson_recon.dir/Factor.cpp.o [ 29%] Building CXX object lib/PoissonRecon/CMakeFiles/poisson_recon.dir/Geometry.cpp.o [ 29%] Building CXX object lib/PoissonRecon/CMakeFiles/poisson_recon.dir/MarchingCubes.cpp.o [ 29%] Building CXX object lib/PoissonRecon/CMakeFiles/poisson_recon.dir/PlyFile.cpp.o [ 29%] Building CXX object lib/PoissonRecon/CMakeFiles/poisson_recon.dir/PoissonRecon.cpp.o [ 31%] Building CXX object lib/PoissonRecon/CMakeFiles/poisson_recon.dir/SurfaceTrimmer.cpp.o [ 31%] Linking CXX static library libpoisson_recon.a [ 31%] Built target poisson_recon Scanning dependencies of target sift_gpu_automoc [ 31%] Automatic rcc for target sift_gpu [ 31%] Built target sift_gpu_automoc [ 31%] Building NVCC (Device) object lib/SiftGPU/CMakeFiles/sift_gpu.dir/sift_gpu_generated_ProgramCU.cu.o Scanning dependencies of target sift_gpu [ 31%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/FrameBufferObject.cpp.o [ 33%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/GlobalUtil.cpp.o [ 33%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/GLTexImage.cpp.o [ 33%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/ProgramGLSL.cpp.o [ 33%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/PyramidGL.cpp.o [ 33%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/ShaderMan.cpp.o [ 35%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/SiftGPU.cpp.o [ 35%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/SiftMatch.cpp.o [ 35%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/SiftPyramid.cpp.o [ 35%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/CuTexImage.cpp.o [ 35%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/PyramidCU.cpp.o [ 35%] Building CXX object lib/SiftGPU/CMakeFiles/sift_gpu.dir/SiftMatchCU.cpp.o [ 37%] Linking CXX static library libsift_gpu.a [ 37%] Built target sift_gpu Scanning dependencies of target sqlite3_automoc [ 37%] Automatic rcc for target sqlite3 [ 37%] Built target sqlite3_automoc Scanning dependencies of target sqlite3 [ 37%] Building C object lib/SQLite/CMakeFiles/sqlite3.dir/sqlite3.c.o [ 37%] Linking C static library libsqlite3.a [ 37%] Built target sqlite3 Scanning dependencies of target vlfeat_automoc [ 39%] Automatic rcc for target vlfeat [ 39%] Built target vlfeat_automoc ...
参考资料
[1] NVIDIA DEVELOPER
[2] CUDA TOOLKIT DOCUMENTATION
[3] Linux(Ubuntu)系统查看显卡型号
[4] 最全面解析 Ubuntu 16.04 安装nvidia驱动 以及各种错误
[5] Ubuntu安装和卸载CUDA和CUDNN
[6] Ubuntu server16.04安装配置驱动418.87、cuda10.1、cudnn7.6.4.38、anaconda、pytorch超详细解决
[7] Ubuntu 16.04 安装 CUDA10.1 (解决循环登陆的问题)
[8] 【目标检测】Ubuntu16.04+RTX2070+CUDA10.0+pytorch1.1搭建CenterNet环境