pub struct BufferManager {
pub buffers: Vec<ManagedBuffer>,
pub total_allocated: usize,
pub max_budget: usize,
}Expand description
Manages the lifecycle of all GPU buffers for a quantum chemistry calculation.
Fields§
§buffers: Vec<ManagedBuffer>§total_allocated: usize§max_budget: usizeImplementations§
Source§impl BufferManager
impl BufferManager
pub fn new(max_budget_mb: usize) -> Self
Sourcepub fn allocate(
&mut self,
role: BufferRole,
size_bytes: usize,
label: &str,
) -> Result<usize, String>
pub fn allocate( &mut self, role: BufferRole, size_bytes: usize, label: &str, ) -> Result<usize, String>
Allocate a new managed buffer. Returns error if it exceeds WebGPU limits.
Sourcepub fn allocate_with_data(
&mut self,
role: BufferRole,
data: Vec<u8>,
label: &str,
) -> Result<usize, String>
pub fn allocate_with_data( &mut self, role: BufferRole, data: Vec<u8>, label: &str, ) -> Result<usize, String>
Allocate a buffer with initial CPU data.
Sourcepub fn matrix_size(n_basis: usize) -> usize
pub fn matrix_size(n_basis: usize) -> usize
Compute buffer size for a dense n×n matrix of f32.
Sourcepub fn plan_scf_buffers(
&mut self,
n_atoms: usize,
n_basis: usize,
n_primitives: usize,
) -> Result<ScfBufferPlan, String>
pub fn plan_scf_buffers( &mut self, n_atoms: usize, n_basis: usize, n_primitives: usize, ) -> Result<ScfBufferPlan, String>
Plan all buffers needed for an SCF calculation.
Sourcepub fn release_all(&mut self)
pub fn release_all(&mut self)
Release all buffers and reset allocation tracking.
Auto Trait Implementations§
impl Freeze for BufferManager
impl RefUnwindSafe for BufferManager
impl Send for BufferManager
impl Sync for BufferManager
impl Unpin for BufferManager
impl UnsafeUnpin for BufferManager
impl UnwindSafe for BufferManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.