ubuntu16.04 + CUDA 9.0 + opencv3.3 安装
安装前的准备
CUDA 9.0 安装,可以参看Ubuntu16.04 + cuda9.0 + cudnn7.1.4 + tensorflow安装
ippicv_2017u2_lnx_intel64_20170418.tgz + opencv3.3.0下载
安装前的准备
安装依赖环境:
-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev -dev libxine2-dev libgstreamer0.-dev libgstreamer-plugins-base0.-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils libeigen3-dev
初始化安装:
cd opencv- mkdir build cd build cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
此时会遇到正在下载ippicv,ctrl+C结束。
在刚才下载ippicv_2017u2_lnx_intel64_20170418.tgz的目录下,新建一个脚本,输入下面的命令,并且在/home/ubuntu/opencv/opencv-3.3.0/3rdparty/ippicv 中新建downloads目录,并执行下面的脚本:
#!/bin/bash ipp_file=./ippicv_2017u2_lnx_intel64_20170418.tgz && ipp_hash=$(md5sum $ipp_file | cut -d" " -f1) && ipp_dir= /home/ubuntu/opencv/opencv-/3rdparty/ippicv/downloads/linux-$ipp_hash && mkdir -p $ipp_dir && cp $ipp_file $ipp_dir
接下来准备使用cmake-gui ,所以需要安装一下cmake图形界面:
apt-get install cmake-qt-gui
使用命令:
cmake-gui
调出cmake图形界面,配置源码路径以及需要安装的路径:

点击,config,点击generate。
遇到的问题
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)

修改:
找到FindCUDA.cmake文件
找到行:
find_cuda_helper_libs(nppi)
改为:
find_cuda_helper_libs(nppial)
find_cuda_helper_libs(nppicc)
find_cuda_helper_libs(nppicom)
find_cuda_helper_libs(nppidei)
find_cuda_helper_libs(nppif)
find_cuda_helper_libs(nppig)
find_cuda_helper_libs(nppim)
find_cuda_helper_libs(nppist)
find_cuda_helper_libs(nppisu)
find_cuda_helper_libs(nppitc)
找到行:
set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppi_LIBRARY};${CUDA_npps_LIBRARY}")
改为:
set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")
找到行:
unset(CUDA_nppi_LIBRARY CACHE)
改为:
unset(CUDA_nppial_LIBRARY CACHE)
unset(CUDA_nppicc_LIBRARY CACHE)
unset(CUDA_nppicom_LIBRARY CACHE)
unset(CUDA_nppidei_LIBRARY CACHE)
unset(CUDA_nppif_LIBRARY CACHE)
unset(CUDA_nppig_LIBRARY CACHE)
unset(CUDA_nppim_LIBRARY CACHE)
unset(CUDA_nppist_LIBRARY CACHE)
unset(CUDA_nppisu_LIBRARY CACHE)
unset(CUDA_nppitc_LIBRARY CACHE)
找到文件OpenCVDetectCUDA.cmake
修改以下几行:
...
set(__cuda_arch_ptx "")
if(CUDA_GENERATION STREQUAL "Fermi")
set(__cuda_arch_bin "2.0")
elseif(CUDA_GENERATION STREQUAL "Kepler")
set(__cuda_arch_bin "3.0 3.5 3.7")
...
改为:
...
set(__cuda_arch_ptx "")
if(CUDA_GENERATION STREQUAL "Kepler")
set(__cuda_arch_bin "3.0 3.5 3.7")
elseif(CUDA_GENERATION STREQUAL "Maxwell")
set(__cuda_arch_bin "5.0 5.2")
...
将头文件cuda_fp16.h添加至 opencv\modules\cudev\include\opencv2\cudev\common.hpp,即在common.hpp中添加:
#include <cuda_fp16.h>
上述修改完成之后重新生成
nvcc fatal : Unsupported gpu architecture 'compute_20'
CMakeConfig-CUDA_CONFIGCMAKE.cmake 中删除:
-gencode arch=compute_20,code=sm_20
cmake-gui中将CUDA_ARCH_BIN 中的2.0去除,结果:

安装openCV
进入build目录中:
make make install
配置pkg-config
安装完成后,配置pkg-config,用于管理opencv安装库:
sudo vim /etc/ld.so.conf
添加:
sudo ldconfig -v export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
使用以下命令查看pkg-config配置信息:
pkg-config --libs opencv
查看opencv版本
pkg-config --modversion opencv
ubuntu16.04 + CUDA 9.0 + opencv3.3 安装的更多相关文章
- tensorflow 1.8, ubuntu 16.04, cuda 9.0, nvidia-390,安装踩坑指南。
被tensorflow 1.8, ubuntu 16.04, cuda 9.0, nvidia-390折磨了5天,终于上坑,留下指南,造福后人. 1.先把依赖搞清楚: tensorflow 1.8依赖 ...
- ubuntu16.04 NVIDIA CUDA8.0 以及cuDNN安装
下载CUDA 官网下载按照自己的实际情况进行选择,下载合适的版本. 官方安装指南 注意这里下载的是cuda8.0的runfile(local)文件. 安装CUDA 下载完成后,解压到当前目录,切换到该 ...
- Anaconda ubuntu16.04 Cuda 8.0安装pytorch
Pytorch 安装 Pytorch安装真的太让人省心了,在anaconda的环境下进行安装,只需要一个命令 具体命令请查看官网pytorch 找到适合你的版本进行安装 本机环境: anaconda3 ...
- Ubuntu16.04 Hadoop2.6.0伪分布式安装与启动中遇到的问题
1.安装JDK1.8,下载安装包解压至 /usr/lib/jdk vim /etc/profile #配置路径 export JAVA_HOME= /usr/lib/jdk export JRE_HO ...
- Caffe + Ubuntu 15.04 + CUDA 7.0 安装以及配置
作为小码农的我,昨天就在装这个东东了,主要参考第一篇博文,但是过程发现很多问题,经过反反复复,千锤百炼,终于柳暗花明,我把这个caffe给搞定了,是故,我发布出来,后之来者,欲将有感于斯文~ 本分分为 ...
- Ubuntu16.04 + gtx1060 + cuda8.0 + cudnn5.1 + caffe + Theano + Tensorflow
参考 ubuntu16.04+gtx1060+cuda8.0+caffe安装.测试经历 ,细节处有差异. 首先说明,这是在台式机上的安装测试经历,首先安装的win10,然后安装ubuntu16.04双 ...
- NVIDIA DIGITS 学习笔记(NVIDIA DIGITS-2.0 + Ubuntu 14.04 + CUDA 7.0 + cuDNN 7.0 + Caffe 0.13.0)
转自:http://blog.csdn.net/enjoyyl/article/details/47397505?from=timeline&isappinstalled=0#10006-we ...
- Ubuntu16.04系统美化、常用软件安装等,长期更新
Ubuntu16.04系统美化.常用软件安装等,长期更新 IT之家啊 18-09-0915:00 因为我个人偏向于玩VPS.服务器之类的东西,所以一般我都是用CentOS.不过对于桌面版的Linux, ...
- 初用Linux, 安装Ubuntu16.04+NVIDIA387+CUDA8.0+cudnn5.1+TensorFlow1.0.1
因为最近Deep Learning十分热门, 装一下TensorFlow学习一下. 本文主要介绍安装流程, 将自己遇到的问题说明出来, 并记录自己如何处理, 原理方面并没有能力解释. 由于本人之前从来 ...
随机推荐
- sql的一些知识_计算字段
创建计算字段 拼接字段 mysql中 使用concat拼接字段 得到的info可以被客户端使用 算术计算 对检索的数据进行运算并as为新的列名 ) ORDER BY weight
- C 标准库 - <locale.h>
C 标准库 - <locale.h> 简介 locale.h 头文件定义了特定地域的设置,比如日期格式和货币符号.接下来我们将介绍一些宏,以及一个重要的结构 struct lconv 和两 ...
- Html5学习笔记1 元素 标签 属性
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- [3 Jun 2015 ~ 9 Jun 2015] Deep Learning in arxiv
arXiv is an e-print service in the fields of physics, mathematics, computer science, quantitative bi ...
- was系统错误日志大量出现标识符缺失
原创作品.出自 "深蓝的blog" 博客,深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/46909941 近日 ...
- SpringBoot学习之pom文件常见错误
错误1 上图的错误需要添加jar包的版本号,springboot自动生成不需要添加版本号,手动添加的需要指定版本号. 所以pom.xml如下方式:
- 系统安全-PAM
Pluggable Authentication Modules(可插入验证模块,简称PAM) Linux-PAM(Pluggable Authentication Modules for Linux ...
- canvas 星空插件
(function(a){ a.fn.starBg=function(p){ var p=p||{}; var w_w=p&&p.window_width?p.window_width ...
- java stoi
package string.string1_4; import java.util.Scanner; public class StrToInt { /** * 将str转换为int整数 * 1. ...
- transient、volatile关键字
transient是在对象序列化的时候,不参与序列化的字段. 如LinkedList实现了Serializable,其中有变量transient int size = 0; 在Serializable ...