Skip to content

Commit 28c63e7

Browse files
committed
add note on thread-safety
1 parent 6371481 commit 28c63e7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/implementation/allocator.jl‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@ block, which will thus still be managed using Julia's GC. The other tensors will
4242
struct ManualAllocator end
4343

4444
"""
45-
BufferAllocator([buffer])
45+
BufferAllocator(; sizehint = 0)
4646
4747
Allocator that uses a pre-allocated buffer for storing temporary tensors.
4848
When the buffer is full, the allocator falls back on Julia's default allocation mechanism
4949
to create temporary tensors, but keeps track of how much additional memory is required.
5050
When the buffer is fully reset, the buffer is automatically resized to ensure subsequent
5151
contractions will now fit in the buffer.
52+
53+
!!! warning
54+
This allocator is **not** thread-safe, and it is the user's responsibility to avoid running
55+
the same allocator on concurrent jobs.
5256
"""
5357
mutable struct BufferAllocator{Storage}
5458
buffer::Storage

0 commit comments

Comments
 (0)