Advertisement

Ubuntu16.04源码安装显卡驱动和自动驾驶仿真软件Carla

阅读量:

Ubuntu16.04源码安装显卡驱动和自动驾驶仿真软件Carla

Carla是用于自动驾驶算法测试的仿真软件,详细信息可参考官方文档,其中也有安装说法说明,它需要显卡支持。本文针对自身安装过程中出现的问题,供大家参考。

NVIDIA驱动和CUDA9.0安装

硬件和系统配置

  • 显卡类型:NVIDIA GTK1060
  • 操作系统:Ubuntu 16.04 LTS
  • 驱动版本:NVIDIA-Linux-x86_64-430.14.run(下载地址
  • CUDA版本及补丁:cuda_9.0.176_384.81_linux.run,cuda_9.0.176.*–_linux.run(下载地址

安装过程

安装dkms和kernel header

复制代码
      sudo apt-get install dkms

    	sudo apt-get install linux-headers-$(uname -r)

添加权限

复制代码
      chmod +x NVIDIA-Linux-x86_64-430.14.run

    	chmod +x cuda_9.0.176_384.81_linux.run
    	chmod +x cuda_9.0.176.1_linux.run
    	chmod +x cuda_9.0.176.2_linux.run
    	chmod +x cuda_9.0.176.3_linux.run
    	chmod +x cuda_9.0.176.4_linux.run

禁用nouveau

复制代码
      #create blacklist file

    	sudo touch /etc/modprobe.d/blacklist-nouveau.conf
    	#add 2 lines content
    	sudo bash -c "echo 'blacklist nouveau
    	options nouveau modeset=0' > /etc/modprobe.d/blacklist-nouveau.conf"
    	#update file
    	sudo update-initramfs -u

检查
输入后终端无任何输出。

复制代码
    	lsmod | grep nouveau

切换到文字界面

Ctrl + Alt+ F1

禁用X-server

复制代码
      sudo service lightdm stop

安装显卡驱动
打开下载文件所在目录,执行:

复制代码
      sudo ./NVIDIA-Linux-x86_64-430.14.run

有说法要在后面添加参数-no-opengl-files来防止出现循环登录的问题,但Carla需要OpenGL支持,因此我没有添加,也没有出现循环登录问题。安装过程中出现的选项均为默认选项即可。

安装CUDA

复制代码
      sudo ./cuda_9.0.176_384.81_linux.run

安装过程中出现的问题选项:
1)EULA conditions: accept
2)installing the nvidia drivers: no
3)installing the cuda toolkit: yes
4)installing the cuda samples: yes
5)creating a symbolic link for cuda: yes

设置环境变量

复制代码
      sudo bash -c "echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc"

    	sudo bash -c "echo '/usr/local/cuda/lib64/' > /etc/ld.so.conf.d/cuda.conf"
    	source ~/.bashrc
    	sudo ldconfig

返回图形界面

复制代码
      sudo service lightdm start

查看显卡信息

复制代码
      nvidia-smi

打补丁(可选)

复制代码
      sudo ./cuda_9.0.176.1_linux.run  # accept and Enter

       	sudo ./cuda_9.0.176.2_linux.run  # accept and Enter
       	sudo ./cuda_9.0.176.3_linux.run  # accept and Enter
       	sudo ./cuda_9.0.176.4_linux.run  # accept and Enter

卸载
如果出现问题,卸载重启即可恢复正常。

复制代码
      sudo /usr/bin/nvidia-uninstall

       	sudo /usr/local/cuda-9.0/bin/uninstall_cuda_9.0.pl

Carla源码安装

整个过程下载量较大,建议在网速较好时进行,具体过程参照官方文档进行,此处列出我在安装时出现的问题。

问题

  1. 问题语句
复制代码
      make PythonAPI
  1. 报错内容
复制代码
      gcc: error: /home/tmac/workspace/git_workspace/carla/PythonAPI/dependencies/lib/libboost_python36.a: No such file or directory

    	error: command 'gcc' failed with exit status 1
    	Util/BuildTools/Linux.mk:65: recipe for target 'PythonAPI' failed
    	make: *** [PythonAPI] Error 1

解决方法

检测python版本

复制代码
      /usr/bin/env python3

    	/usr/bin/python3

执行完后,输出的是不一样的版本:python3.6.7(自己安装的)和python3.5 (系统自带)。

将3.6版本从PATH中删除

复制代码
      gedit ~/.bashrc

找到代表python3.6安装位置的语句注释或删掉,我的如下:

export PATH=/opt/python3.6/bin:$PATH

使修改生效

复制代码
      source ~/.bashrc

重新编译
回到carla\目录下,执行以下操作:

复制代码
      rm -r Build/boost-*

    	make clean
    	git pull
    	./Update.sh
    	make launch
    	make PythonAPI
    	make package

全部评论 (0)

还没有任何评论哟~