看看一个小时能Install CUDA 5 on Ubuntu 12.04 LTS

本文记录了在Ubuntu 12.04 LTS上安装CUDA 5.5的过程,包括选择安装方式、遇到的问题及解决方案,特别是针对OpenCV和ffmpeg的兼容性问题。安装过程中,发现CUDA官方仅提供适用于Ubuntu 11.10的版本,但通过更新repository并采用RPM/DEB packages方式进行安装。安装过程中,由于ffmpeg的libavcodec版本问题导致OpenCV编译失败,最终通过重新编译ffmpeg解决。整个过程耗时较长,但最终成功安装并验证CUDA驱动加载。
摘要由CSDN通过智能技术生成

1. 傻瓜教程

google一下,还是比较promising(of coz it should be!!)。先看这两个今年的帖子

How to install CUDA 5.0 Toolkit in Ubuntu

How to install CUDA 5.0 on Ubuntu 12.04 LTS


等等等等,两片都是关于5.0的,网站上也只有for Ubuntu 11.10的版本。刚才扫了几个帖子说应该没有问题。不过既然网站提示5.5rc都out了,而且OpenCV 2.4.6也加了对5.5的支持---改装最新的吧

Linux Getting Started Guide 上顺便了解到  NVIDIA CUDA Toolkit有两种基本安装方式:

RPM/DEB packages (recommended):先下个很小的deb包更新repository的cuda源,再按标准方式从package manager里安装

stand-alone install :凡是下了几百M的run file都是这种方式


CUDA 5.5只提供了第一种方式的安装---没有选择,真好!


2. 安装

开始安装了。。。。。坑阿,太慢了。20多k的下载速度,第一个nvidia-current都没下完,这5.5放哪个服务器上的阿?越南还是Ecuador阿

1个小时肯定装不完了,能下完就不错了。吃饭去吧,回来更新

。。。。。

没想象中糟,下载其实总共35min,估计装就几分钟。没发现错误,目前。在末尾copy一些信息,也许以后会看

重启。。。


3. 问题

没问题能叫linux吗?没有2个小时就能装好,那不是变成Windows了。。。。

CUDA确实不到一个小时就好了,没有任何问题。问题在opencv和ffmpeg上。

bug在http://code.opencv.org/issues/2916

原因是ffmpeg libavcodec > 53.25.0 (怀疑应该是54.25.0,原因见下面) 后 “the enum CodecID was changed to AVCodecID

让我困惑的是,这是2.4.4就fixed的bug,怎么现在还有?

我下了2.4.4,2.4.5,2.4.6和2.4.6.1测试(不停敲同样的命令,恶心坏了)

其中4和5有cmake找不到gpu的错误,估计是我用的CUDA 5.5有新路径的缘故,因为两个2.4.6版本都没有问题

但两个6版本始终有上面的错误。

查看源码 modules/highgui/src//cap_ffmpeg_impl.hpp 中也确实打上补丁了。(但到处都是CALC_FFMPEG_VERSION(54,25,0) )


4.原因& 解决

尽管ffmpeg显示libavcodec版本大于54.25.0,实际/usr/local/include/libavcodec/avcodec.h还是老文件!!!

也就是说enum还是定义成CodecID。

在ffmpeg_cvg运行一下make install旧好了


5. 意外

之前看过一点点libav和ffmpeg的恩怨。解决这个问题的过程中无意中发现

/usr/include/libavcodec/avcodec.h是libav的

/usr/local/include/libavcodec/avcodec.h是ffmpeg

两个文件几乎完全一样,除了Libav<===>ffmpeg的替换。。。。


6. 结局

最后编译 OpenCV 花了很多时间,主要是编CUDA的部分(NVCC)


-The End


PS. 今天还是决定make install昨天编译的这个最新版了。最大不同应该是对每个库都加了cuda的runtime path

-- Set runtime path of "/usr/local/lib/libopencv_core.so.2.4.6" to "/usr/local/lib:/usr/local/cuda/lib64"
-- Installing: /usr/local/include/opencv2/core/gpumat.hpp
-- Installing: /usr/local/include/opencv2/core/internal.hpp
-- Installing: /usr/local/include/opencv2/core/operations.hpp
-- Installing: /usr/local/include/opencv2/core/version.hpp
-- Installing: /usr/local/include/opencv2/core/mat.hpp
-- Installing: /usr/local/include/opencv2/core/opengl_interop_deprecated.hpp
-- Installing: /usr/local/include/opencv2/core/eigen.hpp
-- Installing: /usr/local/include/opencv2/core/devmem2d.hpp
-- Installing: /usr/local/include/opencv2/core/core.hpp
-- Installing: /usr/local/include/opencv2/core/opengl_interop.hpp
-- Installing: /usr/local/include/opencv2/core/wimage.hpp
-- Installing: /usr/local/include/opencv2/core/cuda_devptrs.hpp
-- Installing: /usr/local/include/opencv2/core/types_c.h
-- Installing: /usr/local/include/opencv2/core/core_c.h
-- Installing: /usr/local/lib/libopencv_imgproc.so.2.4.6
-- Installing: /usr/local/lib/libopencv_imgproc.so.2.4
-- Up-to-date: /usr/local/lib/libopencv_imgproc.so
-- Set runtime path of "/usr/local/lib/libopencv_imgproc.so.2.4.6" to "/usr/local/lib:/usr/local/cuda/lib64"
-- Installing: /usr/local/include/opencv2/imgproc/imgproc.hpp
-- Installing: /usr/local/include/opencv2/imgproc/types_c.h
-- Installing: /usr/local/include/opencv2/imgproc/imgproc_c.h
-- Installing: /usr/local/lib/libopencv_flann.so.2.4.6
-- Installing: /usr/local/lib/libopencv_flann.so.2.4
-- Up-to-date: /usr/local/lib/libopencv_flann.so
-- Set runtime path of "/usr/local/lib/libopencv_flann.so.2.4.6" to "/usr/local/lib:/usr/local/cuda/lib64"
-- Installing: /usr/local/include/opencv2/flann/flann.hpp
-- Installing: /usr/local/include/opencv2/flann/miniflann.hpp
-- Installing: /usr/local/include/opencv2/flann/flann_base.hpp
-- Installing: /usr/local/include/opencv2/flann/result_set.h
-- Installing: /usr/local/include/opencv2/flann/hdf5.h
-- Installing: /usr/local/include/opencv2/flann/config.h
-- Installing: /usr/local/include/opencv2/flann/index_testing.h
-- Installing: /usr/local/include/opencv2/flann/heap.h
-- Installing: /usr/local/include/opencv2/flann/dist.h
-- Installing: /usr/local/include/opencv2/flann/kdtree_single_index.h
-- Installing: /usr/local/include/opencv2/flann/matrix.h
-- Installing: /usr/local/include/opencv2/flann/sampling.h
-- Installing: /usr/local/include/opencv2/flann/timer.h
-- Installing: /usr/local/include/opencv2/flann/simplex_downhill.h
-- Installing: /usr/local/include/opencv2/flann/kmeans_index.h
-- Installing: /usr/local/include/opencv2/flann/object_factory.h
-- Installing: /usr/local/include/opencv2/flann/nn_index.h
-- Installing: /usr/local/include/opencv2/flann/allocator.h
-- Installing: /usr/local/include/opencv2/flann/params.h
-- Installing: /usr/local/include/opencv2/flann/general.h
-- Installing: /usr/local/include/opencv2/flann/any.h
-- Installing: /usr/local/include/opencv2/flann/lsh_table.h
-- Installing: /usr/local/include/opencv2/flann/lsh_index.h
-- Installing: /usr/local/include/opencv2/flann/random.h
-- Installing: /usr/local/include/opencv2/flann/kdtree_index.h
-- Installing: /usr/local/include/opencv2/flann/dummy.h
-- Installing: /usr/local/include/opencv2/flann/autotuned_index.h
-- Installing: /usr/local/include/opencv2/flann/saving.h
-- Installing: /usr/local/include/opencv2/flann/all_indices.h
-- Installing: /usr/local/include/opencv2/flann/logger.h
-- Installing: /usr/local/include/opencv2/flann/hierarchical_clustering_index.h
-- Installing: /usr/local/include/opencv2/flann/ground_truth.h
-- Installing: /usr/local/include/opencv2/flann/composite_index.h
-- Installing: /usr/local/include/opencv2/flann/dynamic_bitset.h
-- Installing: /usr/local/include/opencv2/flann/defines.h
-- Installing: /usr/local/include/opencv2/flann/linear_index.h
-- Installing: /usr/local/lib/libopencv_highgui.so.2.4.6
-- Installing: /usr/local/lib/libopencv_highgui.so.2.4
-- Up-to-date: /usr/local/lib/libopencv_highgui.so
-- Set runtime path of "/usr/local/lib/libopencv_highgui.so.2.4.6" to "/usr/local/lib:/usr/local/lib:/usr/local/cuda/lib64"
--

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值