Skip to content

Commit 82647fa

Browse files
committed
docs: document Docker build environment
1 parent c9ffbdb commit 82647fa

1 file changed

Lines changed: 70 additions & 1 deletion

File tree

README.md

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,31 @@ FlagFFT is an experimental C++ FFT library with a cuFFT-style API and
44
Triton/TLE-generated CUDA kernels. The public runtime interface is C; Python
55
is retained only for Triton/TLE JIT source generation (internal codegen).
66

7+
## Quick Start
8+
9+
Build and run the native CLI in an environment with CMake, Ninja, CUDA,
10+
Python, PyTorch, and the Triton/TLE dependencies available:
11+
12+
```sh
13+
python3 -m pip install .
14+
cmake -S . -B build -GNinja -DBACKEND=CUDA -DFLAGFFT_BUILD_CLI=ON
15+
cmake --build build --target flagfft-cli
16+
./build/flagfft-cli bench --rank 1 --api c2c --shape 4096 --batch 64 \
17+
--warmup 10 --iters 100 --json
18+
```
19+
20+
The repository also provides Dockerfiles for preparing a build environment.
21+
They do not compile FlagFFT into the image; after starting the container, run
22+
the same build commands inside the mounted source tree:
23+
24+
```sh
25+
docker build -f docker/Dockerfile -t flagfft-ubuntu2404:latest .
26+
docker run --rm -it --gpus all \
27+
-v "$PWD":/workspace/FlagFFT-dev \
28+
-w /workspace/FlagFFT-dev \
29+
flagfft-ubuntu2404:latest
30+
```
31+
732
## Current API
833

934
The public header is `include/flagfft.h` and exposes:
@@ -167,6 +192,50 @@ cmake --install build --prefix /path/to/flagfft-install
167192

168193
`FLAGFFT_BUILD_TESTS=ON` enables the C++ test suite (see [C++ Tests](#c-tests)).
169194

195+
### Docker Build Environment
196+
197+
`docker/Dockerfile` builds a base Ubuntu 24.04 environment with Python 3.12,
198+
PyTorch CUDA wheels, CUDA toolkit 13.2, FlagTree, CMake, Ninja, pybind11, and
199+
other native build dependencies. The image only contains the environment; it
200+
does not compile this repository during `docker build`.
201+
202+
```sh
203+
docker build -f docker/Dockerfile -t flagfft-ubuntu2404:latest .
204+
```
205+
206+
If GitHub access needs to be rewritten to a mirror, pass the optional build
207+
argument:
208+
209+
```sh
210+
docker build -f docker/Dockerfile \
211+
-t flagfft-ubuntu2404:latest \
212+
--build-arg GIT_URL_REWRITE_TO=https://example.com/github-mirror/ \
213+
.
214+
```
215+
216+
Run the container with GPU access and mount the source tree, then build
217+
FlagFFT inside the container:
218+
219+
```sh
220+
docker run --rm -it --gpus all \
221+
-v "$PWD":/workspace/FlagFFT-dev \
222+
-w /workspace/FlagFFT-dev \
223+
flagfft-ubuntu2404:latest
224+
225+
python3 -m pip install .
226+
cmake -S . -B build -GNinja -DBACKEND=CUDA -DFLAGFFT_BUILD_CLI=ON
227+
cmake --build build --target flagfft-cli
228+
```
229+
230+
`docker/Dockerfile.dev` is an optional developer shell image based on the base
231+
image. It adds zsh, Oh My Zsh, Node.js, and Codex tooling:
232+
233+
```sh
234+
docker build -f docker/Dockerfile.dev \
235+
--build-arg BASE_IMAGE=flagfft-ubuntu2404:latest \
236+
-t flagfft-dev:latest .
237+
```
238+
170239
When plan creation emits Triton JIT source, it uses `FLAGFFT_PYTHON` if set,
171240
otherwise `python3`, to run `python -m flagfft_codegen.jit_source`. The
172241
selected interpreter must have `flagfft-codegen` installed and provide the
@@ -379,7 +448,7 @@ early manual imports can trigger assertion-rewrite warnings.
379448
### Quick start
380449

381450
```sh
382-
# Build the CLI first
451+
# Build the CLI first, either on the host or inside the Docker environment
383452
cmake -S . -B build -GNinja -DBACKEND=CUDA -DFLAGFFT_BUILD_CLI=ON
384453
cmake --build build --target flagfft-cli
385454

0 commit comments

Comments
 (0)