Skip to content
Merged
8 changes: 2 additions & 6 deletions lectures/need_for_speed.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,9 @@ with qe.Timer():

让我们回顾一下科学计算中常用的两种主要 CPU 并行化方式,并讨论它们的优缺点。

#### 多进程

多进程是指使用多个处理器并发执行多条逻辑线程。

多进程可以在一台拥有多个 CPU 的机器上进行,也可以在通过网络连接的机器集群上进行。
#### 多线程

在多进程中,*每个进程都有自己的内存空间*,尽管物理内存芯片可能是共享的
多线程是指在单个进程中运行多个执行线程

所有线程共享同一内存空间,因此它们可以在不复制数据的情况下对同一数组进行读写。

Expand Down
12 changes: 6 additions & 6 deletions lectures/numba.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ translation:
Compiling Functions: 编译函数
Compiling Functions::An Example: 示例
Compiling Functions::How and When it Works: 工作原理与适用时机
Type Inference: 类型推断
Dangers and Limitations: 危险与局限
Dangers and Limitations::Limitations: 局限性
'Dangers and Limitations::A Gotcha: Global Variables': 一个陷阱:全局变量
Dangers and Limitations::Caching Compiled Code: 缓存编译代码
Sharp Bits: 注意事项
Sharp Bits::Typing: 类型推断
Sharp Bits::Global Variables: 全局变量
Multithreaded Loops in Numba: Numba 中的多线程循环
Exercises: 练习
---
Expand Down Expand Up @@ -185,7 +183,7 @@ timer1.elapsed / timer3.elapsed

让我们讨论一下这是如何工作的。

### 工作原理与适用场景
### 工作原理与适用时机

Numba 尝试使用 [LLVM Project](https://llvm.org/) 提供的基础设施生成快速机器码。

Expand Down Expand Up @@ -421,6 +419,8 @@ with qe.Timer():

注意,我们是跨家庭进行并行化,而非跨时间——单个家庭跨时期的更新本质上是顺序的。

关于基于 GPU 的并行化,请参阅我们{doc}`关于 JAX 的讲座 <jax_intro>`。

## 练习

```{exercise}
Expand Down
Loading