Apollo9.0源码部署(Nvidia显卡)
本文参照Apollo官方部署例程,进行修改。解决在部署期间遇到的网络不通、编译卡死、编译失败等问题。(安装具有时效性,仅供参考)
步骤1.
安装docker,显卡驱动、nvidia插件,此步骤可见专栏第一、二 节
步骤2.
拉取代码
# SSH 方式
git clone git@github.com:ApolloAuto/apollo.git# HTTPS 方式
git clone https://github.com/ApolloAuto/apollo.git
备注,若git不通,可此处下压缩包
步骤3 编译操作
3.1 修改镜像启动脚本(40系列显卡新镜像支持_Apollo开发者社区)
40系显卡必须,40系以下不用修改
修改docker/scripts/dev_start.sh
VERSION_X86_64="dev-x86_64-18.04-20231128_2222"
3.2修改编译配置(可选,建议操作)
修改编译代码并行job数,不修改,配置差的电脑可能卡死
修改工程根目录 /script/apollo_base.sh文件
修改前:
修改${count}为小一点,具体数值可以根据自己配置来
修改后,我这里时修改为6
3.3开启并进入容器,此步一般没问题,网络直连国内百度的镜像仓库
# 开启开发环境镜像
bash docker/scripts/dev_start.sh#此处等若干分钟#进入开发容器
bash docker/scripts/dev_into.sh
3.4进入容器后,修改bazel资源地址
40系显卡必须,40系以下跳过此步
文件1:third_party/centerpoint_infer_op/workspace.bzl
"""Loads the paddlelite library"""# Sanitize a dependency so that it works correctly from code that includes
# Apollo as a submodule.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")def clean_dep(dep):return str(Label(dep))def repo():http_archive(name = "centerpoint_infer_op-x86_64",sha256 = "038470fc2e741ebc43aefe365fc23400bc162c1b4cbb74d8c8019f84f2498190",strip_prefix = "centerpoint_infer_op",urls = ["https://apollo-pkg-beta.bj.bcebos.com/archive/centerpoint_infer_op_cu118.tar.gz"],)http_archive(name = "centerpoint_infer_op-aarch64",sha256 = "e7c933db4237399980c5217fa6a81dff622b00e3a23f0a1deb859743f7977fc1",strip_prefix = "centerpoint_infer_op",urls = ["https://apollo-pkg-beta.bj.bcebos.com/archive/centerpoint_infer_op-linux-aarch64-1.0.0.tar.gz"],)
文件2:third_party/paddleinference/workspace.bzl
"""Loads the paddlelite library"""# Sanitize a dependency so that it works correctly from code that includes
# Apollo as a submodule.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")def clean_dep(dep):return str(Label(dep))def repo():http_archive(name = "paddleinference-x86_64",sha256 = "7498df1f9bbaf5580c289a67920eea1a975311764c4b12a62c93b33a081e7520",strip_prefix = "paddleinference",urls = ["https://apollo-pkg-beta.cdn.bcebos.com/archive/paddleinference-cu118-x86.tar.gz"],)http_archive(name = "paddleinference-aarch64",sha256 = "048d1d7799ffdd7bd8876e33bc68f28c3af911ff923c10b362340bd83ded04b3",strip_prefix = "paddleinference",urls = ["https://apollo-pkg-beta.bj.bcebos.com/archive/paddleinference-linux-aarch64-1.0.0.tar.gz"],)
3.5 移除部分驱动(可选,建议操作)
本文在实际部署时,部分驱动会报错,可以移除这部分驱动,然后再进行编译。(后续这个问题驱动厂商可能会解决)
#进入雷达驱动,备份发生错误的雷达驱动代码
cd modules/drivers/lidar && mkdir error_lidar_driver
mv ./rsliadr ./error_lidar_driver
mv ./seyond ./error_lidar_driver
mv ./vanjeelidar ./error_lidar_driver
#备份移送到/apollo目录下,不移动放置在原位会报错
mv ./error_lidar_driver /apollo
3.6 编译
首先检查工作空间是否存在.apollo.bazelrc文件,如果存在先删除
由于bazel进行编译过程会,联网拉取代码,实际过程中,此步极易不通导致失败。在这里,我提供下我缓存下来30系显卡,40系显卡cache文件,大家下载后,进行解压即可(可选,如无网络连接问题,建议自行编译)
下载对应的缓存后,移到Apollo工程根目录下,小文件很多,耐心等待解压完毕
#解压
tar -xzvf cache.tar.gz
#编译
./apollo.sh build
3.7 测试(启动 Dreamview+)
bash scripts/bootstrap.sh start_plus