Skip to content

Commit 66a97fa

Browse files
Added documentation
1 parent 4fdd643 commit 66a97fa

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

docs/Developer/AsyncPhilox.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# AsyncPhilox_d Class
2+
3+
## Overview
4+
5+
`AsyncPhilox_d` is a GPU-based random number generator class that uses NVIDIA's [CURAND](https://docs.nvidia.com/cuda/curand/index.html) library and the **Philox** counter-based RNG engine. It is designed for high-throughput simulations and supports asynchronous random number generation via an internal CUDA stream.
6+
7+
The class provides a **double-buffered**, asynchronous mechanism to produce random floating-point numbers (normally distributed) directly on the GPU. This enables overlapping random number generation with compute or memory transfer tasks in other streams.
8+
9+
---
10+
11+
## Purpose
12+
13+
`AsyncPhilox_d` enables:
14+
15+
- **Per-thread RNG state initialization** on the GPU
16+
- **Segmented random number generation** using `curand_normal`
17+
- **Double-buffering** for non-blocking buffer filling
18+
- **Asynchronous execution** using a CUDA stream created and managed internally
19+
20+
This design improves parallelism and simulation throughput by decoupling RNG generation from synchronous host and device execution.
21+
22+
---
23+
24+
## CURAND Philox Generator
25+
26+
Philox is a **counter-based** RNG suitable for parallel applications. It is:
27+
28+
- **Stateless** across launches (state only encodes seed, counter, and thread ID)
29+
- **Efficient** on GPUs due to its low register and instruction overhead
30+
- **Deterministic**, producing reproducible sequences across threads
31+
32+
NVIDIA’s CURAND provides the Philox generator via the `curandStatePhilox4_32_10_t` type, which is initialized on a per-thread basis using `curand_init`.
33+
34+
You can find more details in the [CURAND Device API Overview](https://docs.nvidia.com/cuda/curand/device-api-overview.html).
35+
36+
37+
## CUDA Documentation Links
38+
39+
- [CURAND API Reference](https://docs.nvidia.com/cuda/curand/index.html)
40+
- [Philox Generator in CURAND](https://docs.nvidia.com/cuda/curand/device-api-overview.html#bit-generation-3)

docs/Developer/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Students, use this [quickstart guide](StudentSetup.md) to help setup, use, and d
4646
- [Neuro Implementation](NeuroImplementation.md)
4747
- [GraphManager and InputManager classes](GraphAndEventInputs.md)
4848
- [Configuration](../User/configuration.md)
49-
49+
- [AsyncPhilox RNG class](AsyncPhilox.md)
5050

5151
---------
5252
[<< Go back to the Graphitti home page](../index.md)

0 commit comments

Comments
 (0)