跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
MediaWiki帮助
Mcuzone Wiki
搜索
搜索
登录
个人工具
登录
查看“0006 MPTPU(M.2 E)”的源代码
页面
讨论
大陆简体
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
常规
链入页面
相关更改
特殊页面
页面信息
←
0006 MPTPU(M.2 E)
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== '''关键词''' == 树莓派5、PCIE、TPU、DTPU、驱动安装、操作演示、AI、google、Coral == '''一、简介''' == MPW7/TPU是一款专为树莓派5设计的TPU扩展板,通过PCIE 1x Gen2驱动来自Coral的TPU模组。树莓派系统下使用TPU模块需要安装驱动以及操作环境配置,本文操作演示基于MPW7/TPU扩展板,对于双TPU的驱动安装也适用。 '''''注意:此操作演示需要确保能连通外网(需自备方法),否则许多文件无法下载。''''' == '''二、硬件资源''' == 关于双TPU的官方描述(本文档所演示的单TPU也可参考此描述): PRODUCT DETAILS The Coral M.2 Accelerator with Dual Edge TPU is an M.2 module that brings two Edge TPU coprocessors to existing systems and products with an available M.2 E-key slot. Features Performs high-speed ML inferencing: Each Edge TPU coprocessor is capable of performing 4 trillion operations per second (4 TOPS), using 2 watts of power. For example, it can execute state-of-the-art mobile vision models such as MobileNet v2 at almost 400 FPS, in a power-efficient manner. With the two Edge TPUs in this module, you can double the inferences per second (8 TOPS) in several ways, such as by running two models in parallel or pipelining one model across both Edge TPUs. Works with Debian Linux and Windows: Integrates with Debian-based Linux or Windows 10 systems with a compatible card module slot. Supports TensorFlow Lite: No need to build models from the ground up. TensorFlow Lite models can be compiled to run on the Edge TPU. Supports AutoML Vision Edge: Easily build and deploy fast, high-accuracy custom image classification models to your device with AutoML Vision Edge. Description The Coral M.2 Accelerator with Dual Edge TPU is an M.2 module (E-key) that includes two Edge TPU ML accelerators, each with their own PCIe Gen2 x1 interface. The Edge TPU is a small ASIC designed by Google that accelerates TensorFlow Lite models in a power efficient manner: each one is capable of performing 4 trillion operations per second (4 TOPS), using 2 watts of power—that's 2 TOPS per watt. For example, one Edge TPU can execute state-of-the-art mobile vision models such as MobileNet v2 at almost 400 frames per second. This on-device ML processing reduces latency, increases data privacy, and removes the need for a constant internet connection. With the two Edge TPUs in this module, you can double the inferences per second (8 TOPS) in several ways, such as by running two models in parallel or pipelining one model across both Edge TPUs. == '''三、系统烧写''' == 3.1 本文档使用的镜像为2024-07-04-raspios-bookworm-arm64-full.img.xz(树莓派OS,Raspberry Pi OS with desktop and recommended software)。 树莓派OS下载地址: https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit 3.2 系统烧写在SD(TF)卡上,[http://wiki.mcuzone.com/index.php?title=0005_MPS2242_2280%EF%BC%88%E5%8D%95SSD%E6%89%A9%E5%B1%95%E6%9D%BF%EF%BC%89#%E4%B8%89%E3%80%81%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99%E5%8F%8A%E8%AE%BE%E7%BD%AE 点击直达烧写方法说明]。 == '''四、驱动安装与配置''' == === 4.1 配置config.txt === 系统启动后打开树莓派终端输入命令: <code>sudo nano /boot/firmware/config.txt</code> 在文件最下方添加以下代码: <code>dtparam=pciex1</code> <code>kernel=kernel8.img</code> <code>dtoverlay=pineboards-hat-ai</code> 01 02 代码添加成功后,保存并重启系统: <code>sudo reboot</code> === 4.2 确认软件环境 === 系统重启后打开打开树莓派终端输入命令: <code>uname -r</code> 确保内核版本大于4.18后输入: <code>lsmod | grep apex</code> 确保没有输出则可以开始安装TPU驱动。 03 === 4.3 安装必要软件 === 确保网络能连通外网(需自备方法)后,添加Google TPU软件库: <code>echo "deb <nowiki>https://packages.cloud.google.com/apt</nowiki> coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list</code> <code>curl <nowiki>https://packages.cloud.google.com/apt/doc/apt-key.gpg</nowiki> | sudo apt-key add -</code> 04 05 添加完成后更新软件列表: <code>sudo apt-get update</code> 06 更新完成后安装必要的软件: <code>sudo apt-get install cmake libedgetpu1-std devscripts debhelper dkms dh-dkms</code> 07 08 === 4.4 安装Gasket Driver === 依次输入以下命令安装Gasket Driver: <code>git clone <nowiki>https://github.com/google/gasket-driver.git</nowiki></code> <code>cd gasket-driver</code> <code>sudo debuild -us -uc -tc -b</code> <code>cd ..</code> <code>sudo dpkg -i gasket-dkms_1.0-18_all.deb</code> 09 10 11 安装完成后输入以下命令确保驱动以及软件安装成功: <code>sudo apt-get install gasket-dkms libedgetpu1-std</code> 12 接下来添加udev rule去获得设备操作权限: <code>sudo sh -c "echo 'SUBSYSTEM==\"apex\", MODE=\"0660\", GROUP=\"apex\"' >> /etc/udev/rules.d/65-apex.rules"</code> 添加用户到apex <code>sudo groupadd apex</code> <code>sudo adduser $USER apex</code> 13 设置完成后重启系统: <code>sudo reboot</code> === 4.5 验证模块检测以及驱动安装 === 系统启动后验证模块检测以及驱动安装: <code>lspci -nn | grep 089a</code> <code>ls /dev/apex_0</code> 14 这里板载单TPU,因此可以看到一个TPU模块。 输入<code>sudo lspci -v</code>可以看到驱动加载: 15 16 === 4.6 代码运行环境配置 === Google TPU模块代码运行需要在Python3.6-3.9之间,而树莓派最新系统的Python版本为3.11,因此我们需要使用Pyenv来下载老版本Python。 首先进行依赖安装: <code>sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl</code> 17 18 依赖安装完成后进行pyenv的安装: <code>curl <nowiki>https://pyenv.run</nowiki> | bash</code> 18 19 输入sudo nano ~/.bashrc,在文件最下面添加以下代码: <code>export PYENV_ROOT="$HOME/.pyenv"</code> <code>[[-d $PYENV_ROOT/bin]] && export PATH="$PYENV_ROOT/bin:$PATH"</code> <code>eval "$(pyenv init -)"</code>
本页使用的模板:
模板:联系我们 图标
(
查看源代码
)
返回
0006 MPTPU(M.2 E)
。
开关有限宽度模式