本仓库包含 Coral 设备 用户空间级运行时驱动程序的源代码。该软件以二进制形式分发在 coral.ai/software。
有三种方法可以构建 libedgetpu:
对于 Debian/Ubuntu,安装以下库:
$ sudo apt install docker.io devscripts
在 Docker 容器内构建 Linux 二进制文件(适用于 Linux 和 macOS):
DOCKER_CPUS="k8" DOCKER_IMAGE="ubuntu:22.04" DOCKER_TARGETS=libedgetpu make docker-build
DOCKER_CPUS="armv7a aarch64" DOCKER_IMAGE="debian:bookworm" DOCKER_TARGETS=libedgetpu make docker-build
所有构建的二进制文件都放在 out
目录中。请注意,bazel-* 不会从 Docker 容器复制到主机。
分别为 arm64
、armhf
、amd64
打包 Debian deb:
debuild -us -uc -tc -b -a arm64 -d
debuild -us -uc -tc -b -a armhf -d
debuild -us -uc -tc -b -a amd64 -d
bazel
的版本需要与相应 tensorflow 版本推荐的版本相同。例如,编译 TF 2.16.1 需要 Bazel 6.5.0
。
当前支持的 tensorflow 版本是 2.16.1
。
在 Linux 和 macOS 上构建本机二进制文件:
$ make
Linux 所需的库:
$ sudo apt install python3-dev
在 Windows 上构建本机二进制文件:
$ build.bat
在 Linux 上交叉编译 ARMv7-A(32 位)和 ARMv8-A(64 位):
$ CPU=armv7a make
$ CPU=aarch64 make
打包 Debian deb:
debuild -us -uc -tc -b
MacOS 注意事项:在 MacOS 上编译失败。两个要求:
flatbuffers
(通过 macports)/var/tmp/_bazl_xxxxx/xxxxxxxxxxxxx/external/local_config_cc/BUILD
第 48 行添加以下内容:"darwin_x86_64": ":cc-compiler-darwin",
重复编译。
如果只为本机系统构建,可以通过移除 Bazel(和 Docker)来显著降低构建的复杂性。这种简单方法只构建所需内容,移除构建时依赖获取,提高速度,并使用上游 Debian 包。
准备系统需要以下包(在 Debian Bookworm、Bullseye 或 Buster-Backports 上可用):
sudo apt install libabsl-dev libflatbuffers-dev
接下来,需要在所需的检出点克隆 Tensorflow 仓库(不建议使用 TF 最新版本)。如果计划使用 libcoral 或 pycoral 库,这应与这些仓库 WORKSPACE 文件中的版本匹配。例如,如果使用 TF2.15,我们可以查看 TF 仓库中的该标签,获取该稳定版本的最新提交,然后检出该地址:
git clone https://github.com/tensorflow/tensorflow
git checkout v2.16.1
构建库:
TFROOT=<Tensorflow 目录> make -f makefile_build/Makefile -j$(nproc) libedgetpu
如果您对该库有疑问、评论或请求,请联系 coral-support@google.com