You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
## Sampling random matrices on the GPU
6
6
7
-
We have introduced an experimental implementation of sampling of random matrices and random quantum objects on the GPU. In order to use this feature, the `CUDA` package is required. To import `MatrixEnsembles` with GPU support use
7
+
We have introduced an experimental implementation of sampling of random matrices and random quantum objects on the GPU using `KernelAbstractions.jl`. In order to use this feature, the `CUDA` package is required to load the necessary extension. To import `MatrixEnsembles` with GPU support use
Copy file name to clipboardExpand all lines: docs/src/man/random.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,6 +159,24 @@ o*o'
159
159
```
160
160
For convenience we provide the following type aliases `const COE = CircularEnsemble{1}`, `const CUE = CircularEnsemble{2}`, `const CSE = CircularEnsemble{4}`.
161
161
162
+
## GPU Sampling
163
+
164
+
`MatrixEnsembles.jl` supports sampling random matrices directly on the GPU using `CUDA.jl`. This functionality is provided via a package extension that is loaded automatically when `CUDA` is imported.
165
+
166
+
To use GPU sampling:
167
+
```julia
168
+
using CUDA
169
+
using MatrixEnsembles
170
+
171
+
# Create an ensemble (e.g., Circular Unitary Ensemble)
172
+
c =CUE(1024)
173
+
174
+
# Sample directly to a CuArray
175
+
u = MatrixEnsembles.curand(c)
176
+
```
177
+
178
+
The `curand` function mimics `rand` but uses the `CUDA.default_rng()` and optimized kernels (implemented with `KernelAbstractions.jl`) to generate matrices directly on the device, minimizing host-device data transfer.
179
+
162
180
## [References](@id refs_rand)
163
181
164
182
[1] B. Collins, I. Nechita, *Random matrix techniques in quantum information theory*, Journal of Mathematical Physics, 2016;57(1):015215.
0 commit comments