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
{{ message }}
Repository navigation
Commit 58c6e03
Browse filesBrowse the repository at this point in the historyBrowse files
* add CUDA buffer support
* update pagesize information
* docs: name CUDABufferAllocator in the cuTENSOR allocator section
The prose said `BufferAllocator` while the example below it constructs a
`CUDABufferAllocator`, which read as inconsistent.
Copy file name to clipboardExpand all lines: docs/src/man/backends.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,6 +137,8 @@ Optionally, it can be useful to use the `ManualAllocator`, as the manual memory
137
137
In particular in multi-threaded applications, this can sometimes lead to a significant performance improvement.
138
138
On the other hand, for repeated (but thread-safe!) `@tensor` calls, the `BufferAllocator` is a lightweight slab allocator that pre-allocates a buffer for temporaries, falling back to Julia's default if needed.
139
139
Upon repeated use it will automatically resize the buffer to accommodate the requested temporaries, avoiding repeated reallocation.
140
+
The container that backs the buffer is a type parameter, such that the same slab strategy can also be used for other kinds of memory.
141
+
In particular, a `CuArray`-backed buffer, which is constructed through `CUDABufferAllocator`, hands out `CuArray` temporaries that are carved out of a single device allocation, thus avoiding repeated round-trips to the CUDA memory pool.
140
142
141
143
Finally, users can also opt to use the `Bumper.jl` system, which pre-allocates a slab of memory that can be re-used afterwards.
142
144
This is available through a package extension for `Bumper`.
@@ -162,8 +164,20 @@ with respect to temporaries, as well as input and output tensors.
162
164
163
165
```@docs
164
166
TensorOperations.CUDAAllocator
167
+
TensorOperations.CUDABufferAllocator
165
168
```
166
169
170
+
Alternatively, the `CUDABufferAllocator` can also be used with the `cuTENSORBackend()`. This is simply a `BufferAllocator` backed by CUDA memory:
Here, all temporaries are taken from the pre-allocated device buffer, which is grown automatically until it is large enough to hold all temporaries of a single `@tensor` block.
179
+
Just like `CUDAAllocator`, this will produce `CuArray` outputs even when the inputs are regular host arrays.
180
+
167
181
### Custom Allocators
168
182
169
183
Users can also define their own allocators, to facilitate experimentation with new implementations.
@@ -189,3 +203,12 @@ For allocators that manage reusable buffers or maintain state across multiple co
189
203
190
204
Here we are guaranteeing that every created checkpoint will be restored, and all temporary allocations that are enclosed within this scope will no longer be accessed.
191
205
Additionally, if multiple checkpoints are created, they will be restored in a first-in-last-out order.
206
+
207
+
Finally, rather than writing an allocator from scratch, the built-in `BufferAllocator` can be reused with a different kind of storage, by implementing the two methods below.
208
+
The bookkeeping of the buffer itself, i.e. the high-water mark, the automatic resizing and the checkpointing, is then shared with the default implementation.
0 commit comments