BlackCat_Tensors
A GPU-supported autograd and linear algebra library, designed for neural network construction
|
A Logging_Stream object does not actually allocate any memory. More...
#include <logging_stream.h>
A Logging_Stream object does not actually allocate any memory.
It simply stores the required amount of memory that is has logged. It is used in conjunction with a stream object when parsing an expression.
Once an entire expression is created, it first attempts to evaluate the expression while skipping all allocations and any of the enqueued functions.
Once it has recorded all memory changes (allocations/deallocations) the logging allocator has calculated the max amount of memory required for this calculation. We than use this max_allocated in our Workspace Allocator (inside a stream) to reserve the amount required.
This ensures that the maximum number of allocations required per expression is 1. If the amount of memory reserved exceeds the required amount we do nothing.