以下是对原网站内容的翻译
https://spatial-lang.readthedocs.io/en/legacy/tutorial/starting.html
以下是您提供的Spatial框架入门指南的中英对照翻译:
0. Getting Started | 0. 开始使用
Prerequisites | 先决条件
First, make sure to download and install the following prerequisites:
首先,请确保下载并安装以下先决条件:
-
Scala SBT
-
Java JDK
While it’s not at all required, it may be easier to learn to use Spatial if you’ve had experience with Scala or a similar functional programming language in the past. Knowledge of Scala will allow you to use meta-programming to assist your Spatial designs.
虽然这不是必需的,但如果您以前有使用 Scala 或类似函数式编程语言的经验,学习使用 Spatial 可能会更容易。Scala 知识将使您能够使用元编程来辅助您的 Spatial 设计。
If you’d like, check out this Scala tutorial.
如果您愿意,可以查看这个 Scala 教程。
Finally, please sign up for the Spatial users google group if you have any questions.
最后,如果您有任何问题,请注册 Spatial 用户的 Google 群组。
Installation via Quickstart (Recommended) | 通过快速开始安装(推荐)
To get started with Spatial, you simply need to clone the spatial-quickstart repo and set your environment:
要开始使用 Spatial,您只需要克隆 spatial-quickstart
代码库并设置您的环境:
You can start writing your apps directly in spatial-lang/src/<filename>.scala
. To run a quick test, you can run the following:
您可以直接在 spatial-lang/src/<文件名>.scala
中开始编写您的应用程序。要运行一个快速测试,您可以执行以下命令:
The app called “Quicktest” is in spatial-quicktest/src/Applications.scala
. It has one input register, reads and adds 4 to it in the Accel, and then writes this to an output register.
名为 “Quicktest” 的应用程序位于 spatial-quicktest/src/Applications.scala
。它有一个输入寄存器,在 Accel 中读取该值并加 4,然后将其写入输出寄存器。
Installation From Source | 从源码安装
Run the following (bash) commands to clone and update the spatial-lang repository:
运行以下 (bash) 命令来克隆和更新 spatial-lang
代码库:
This will pull Spatial’s submodules argon, apps, and scala-virtualized.
这将拉取 Spatial 的子模块 argon、apps 和 scala-virtualized。
You may need to export your JAVA_HOME
environment variable to point to your Java installation (usually /usr/bin
)
您可能需要导出您的 JAVA_HOME
环境变量,以指向您的 Java 安装路径(通常是 /usr/bin
)。
You are now ready to compile the language. Run the following:
现在您已准备好编译此语言。运行以下命令:
A good habit would be to pull from these repositories often and run sbt compile
in your spatial-lang
directory.
一个好的习惯是经常从这些代码库拉取更新,并在您的 spatial-lang
目录中运行 sbt compile
。
To run a quick test, you can run the following:
要运行一个快速测试,您可以执行以下命令:
The app called “InOutArg” is in spatial-lang/apps/src/UnitTests.scala
. It has one input register, reads and adds 4 to it in the Accel, and then writes this to an output register.
名为 “InOutArg” 的应用程序位于 spatial-lang/apps/src/UnitTests.scala
。它有一个输入寄存器,在 Accel 中读取该值并加 4,然后将其写入输出寄存器。
That’s it! Up next... | 就是这样!接下来...
That’s it! Up next, you will learn how to use the language by working through a series of examples. The concepts you will learn in these tutorials are listed below. Feel free to skip around the apps as you find convenient:
就是这样!接下来,您将通过一系列示例学习如何使用该语言。您将在这些教程中学到的概念如下所列。请根据您的方便随意跳转学习不同的应用程序:
-
Hello, World! (你好,世界!)
-
Application skeleton (import statements, application creation, accel scope, host scope) (应用程序骨架(import 语句、应用程序创建、accel 作用域、host 作用域))
-
ArgIn
-
ArgOut
-
HostIO
-
DRAM
-
SRAM
-
Reg
-
Typing system (类型系统)
-
Data transfer between host and accel (setArg, setMem, getArg, getMem, load, store, gather, scatter) (主机与加速器之间的数据传输)
-
Basic debugging hooks (基本调试钩子)
-
Compiling an app (编译应用程序)
-
Dot Product (点积)
-
Tiling (分块/平铺)
-
Reduce and Fold (Reduce 和 Fold 操作)
-
Sequential execution and Coarse-grain pipelining (顺序执行和粗粒度流水线)
-
Parallelization (并行化)
-
Basic buffering and banking (基本缓冲和存储体配置)
-
General Matrix Multiply (GEMM) (通用矩阵乘法)
-
MemReduce and MemFold
-
Debugging with instrumentation (使用插桩进行调试)
-
Advanced banking (高级存储体配置)
-
Advanced buffering (高级缓冲)
-
Differentiator & Sobel Filter (微分器和 Sobel 滤波器)
-
LineBuffer
-
ShiftRegister
-
LUT (查找表)
-
Spatial Functions and Multifile Projects (Spatial 函数和多文件项目)
-
Needleman-Wunsch
-
FSM (有限状态机)
-
Branching (分支)
-
FIFO
-
Systolic Arrays (脉动阵列)
-
File IO and text management (文件 IO 和文本管理)
-
Asserts, Breakpoints, and Sleep (断言、断点和休眠)