TPUs: float64 without float64 hardware, and QuantEcon's JAX workloads on Google Cloud
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- google-cloud, python
- 领域
- performance
调研方向
Start with the precision/ probe for Question 1 and the existing W1–W3 benchmarks in precision/; read the method and results referenced in #1 before comparing measurements. Phase 0 can run as a diagnostic on Colab's free v5e; Phase 1 requires TPU quota and approval to spend on Google Cloud. Done when Question 1 is answered, any Phase 1 results are saved under results/<host>/<date>.jsonl, and a summary is posted here.
由索引模型根据 Issue 内容生成。
描述
Google's TPUs have no float64 hardware. This issue records what is known about float64 on a TPU, and sets out a comparison to run on Google Cloud later: what JAX does with float64 there, what each precision costs, and how QuantEcon's JAX workloads run on a TPU against the CPUs and GPUs measured in #1. It is not scheduled: Phase 1 needs a Google Cloud project with TPU quota, and a yes on spend.
What is known (read 2026-11-03)
| Source | |
|---|---|
| "TPUs have no true float64 hardware." JAX's float64 accuracy tables cover CPUs and NVIDIA GPUs only, though its platform list includes TPU v2 to v5e, v5p, v6e and TPU7x | JAX: accuracy of operations |
| The matrix unit (MXU) multiplies bfloat16 inputs, with int8 on v5e and v6e and FP8 on v5p and TPU7x, and accumulates in float32 | Cloud TPU system architecture |
A float32 matmul in JAX runs in bfloat16 on a TPU by default. Full float32 takes precision=jax.lax.Precision.HIGHEST, or jax_default_matmul_precision set to it |
A JAX maintainer on jax-ml/jax#9973 (2022) |
| For float64 FFTs, "you may need to use CPU or GPU implementations for now" | A JAX maintainer on jax-ml/jax#9881 (2022, still open) |
Not documented: what JAX does with a float64 array on a TPU when jax_enable_x64 is on. It could raise an error, compute in float32 behind a float64 dtype, or emulate float64 in software, possibly short of IEEE float64 in precision or range. Question 1 finds out.
Why
- Readers can pick a TPU. Colab's free tier offers a single v5e chip when one is available (MaxText's guide), beside its free T4, and Colab has added a v6e chip (release notes), though not necessarily on the free tier. A reader who opens a lecture in Colab and picks the TPU runtime gets whatever JAX does there, and for a float64 lecture we don't know what that is.
- Both precisions are in question. A float64 lecture on a TPU meets the unknown above. A float32 lecture meets bfloat16 matrix products by default, so its printed answers could change although it never asks for float64.
- Most of lecture-jax's float64 lectures may not need float64. Of the 13, only
arellano_jaxneeds it for its answer (Part 1's summary on #11). That was measured on CPUs and GPUs, where a float32 matrix product is full float32, so it doesn't yet carry over to a TPU. - It is the far end of QuantEcon/project-econ-on-ai-hardware's question: hardware built for AI, with no float64 at all.
Questions
- What float64 does on a TPU. With
jax_enable_x64on: an error, float32 behind a float64 dtype, or emulation; and the accuracy against CPU float64 of elementwise arithmetic, transcendentals, a matmul,linalg.solve,eighand an FFT. - What each precision costs, on #1's workloads W1 to W3: float64 if it runs, float32 at
HIGHEST, and float32 at the default. - Whether the default changes answers: lecture-jax's float32 lectures, and its float64 lectures run in float32, at the default and at
HIGHEST, against their float64 answers on a CPU. - As used: lecture-jax's lectures on a TPU in a fresh process, compile time counted, against the T4 and the M6 from #4. That is the comparison a Colab reader faces: CPU, T4 or TPU.
Workloads
| Question | Workload |
|---|---|
| 1 | A short probe, new, under precision/: the cases in question 1, each result's dtype printed and its error against CPU float64 recorded in ULPs |
| 2 | precision/'s W1 to W3 (#1), with matmul precision as an added axis |
| 3 and 4 | lectures/whole/'s runner (#4), recording each lecture's answers as #11's method does |
Platforms
| Device | Where | Why |
|---|---|---|
| TPU v5e, one chip, 16 GB | Google Cloud; Colab's free tier for Phase 0 | The chip a Colab reader gets |
| TPU v6e (Trillium), one chip, 32 GB | Google Cloud | The next generation, with twice the memory |
| TPU7x (Ironwood) | Google Cloud, optional | The newest, with FP8 |
| The TPU VM's own CPU | The same VM | The same-box baseline, as on qe-wharton1-gpu |
The comparison points are already in results/: the M6, the T4 and its Xeon, the TITAN RTX, and Phase 2's rented cards. They need no re-run if the JAX release matches.
Method
#1's method holds: one fresh process per cell, cold and warm times apart, the same JAX release everywhere. On a TPU, also:
- A float64 dtype proves nothing. #1 asserts the result dtype so that a silent float32 can't pass as float64. On a TPU the dtype could say float64 whatever the hardware did, so every float64 cell is checked against CPU float64 as well.
- Matmul precision is an axis. Run float32 at the default and at
HIGHEST, and recordjax_default_matmul_precisionin each cell's environment block. - The environment block adds the TPU generation, the chip count and the
libtpuversion. Installjax[tpu]at the pinned 0.12.0.1 iflibtpuhas a matching release; otherwise record the version used. - Colab runs are diagnostics, not measurements. The runtime is shared and its JAX comes preinstalled. Question 1's answer can come from Colab; the timings can't.
Phases
- Phase 0, free: question 1's probe on Colab's free v5e, as a diagnostic. It takes minutes, and its answer decides how much of Phase 1 is worth running.
- Phase 1, needs a yes on spend: questions 2 to 4 on one v5e chip and one v6e chip on Google Cloud. v5e lists at about USD 1.20 a chip-hour on demand in us-central1 (pricing, 2026-11-03); v6e's price wasn't confirmed. Request TPU quota in the project's region first.
- Longer term: the TPU Research Cloud gives researchers TPU time free, by application. It is worth applying if TPUs become a platform we re-run on.
What the results would change
| If | Then |
|---|---|
| float64 raises an error on a TPU | float64 lectures can't run there. A lecture could say so, or choose its device |
| float64 runs as float32 behind a float64 dtype | A silent wrong answer, the worst case. arellano_jax, and any lecture that needs float64, should refuse a TPU |
| float64 is emulated close to IEEE accuracy | It becomes a cost question by kernel type, as on the GPUs, and question 2 answers it |
| The default matmul precision changes a lecture's printed answers | That lecture sets HIGHEST, or says why a TPU's answers differ |
| A v5e chip beats Colab's T4 on lectures as used | Readers could be pointed to Colab's TPU runtime |
Done when
Question 1 is answered, from Colab if need be; questions 2 to 4 have results in results/<host>/<date>.jsonl, if Phase 1 runs; and a summary is posted here.
- 主要语言
- Python
- 星标
- 0
- 派生
- 1
- 平均合并
- 3 小时 29 分钟
- 30 天内合并 PR
- 64
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
QuantEcon/benchmarks 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
QuantEcon/benchmarks#78 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
QuantEcon/benchmarks#72 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 45/100
QuantEcon/benchmarks#47 ·
维护者通常 1 天内回复
-
Float32 fidelity: which float64 lectures need float64, and can the heaviest step drop to float32?未关闭
难度 5/5 一周以上 新手友好度 25/100
QuantEcon/benchmarks#11 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 32/100
QuantEcon/benchmarks#5 · 2 条评论 ·
维护者通常 1 天内回复
查看 QuantEcon/benchmarks 的全部 Issue
相似的 Issue
-
needs-triage
难度 1/5 1 小时以内 新手友好度 88/100
flashinfer-ai/flashinfer#9803 ·
维护者通常 1 天内回复
-
bug frontend good first issue help wanted
难度 2/5 1-3 小时 新手友好度 72/100
oscarbol09/thesisforge#61 ·
-
api bug performance
难度 2/5 1-3 小时 新手友好度 82/100
oscarbol09/audiobard#159 ·
-
area:web p2 product:business triage:active type:bug
难度 1/5 1 小时以内 新手友好度 89/100
cuadrao-ai/argus#2328 ·
维护者通常 1 天内回复
-
bug frontend good first issue help wanted
难度 2/5 1-3 小时 新手友好度 88/100
nikhilb2/simple_invoicing#907 ·