pub struct GpuArch {
pub base: usize,
pub suffix: Option<String>,
}Expand description
GPU architecture specification
Supports both numeric (80, 90) and string-based (90a, 100a) formats.
Fields§
§base: usizeBase compute capability number (e.g., 90, 100, 120)
suffix: Option<String>Optional suffix for accelerated variants (e.g., “a” for async)
Implementations§
Source§impl GpuArch
impl GpuArch
Sourcepub fn with_suffix(base: usize, suffix: &str) -> Self
pub fn with_suffix(base: usize, suffix: &str) -> Self
Create a new GPU architecture with suffix (e.g., 90a, 100a)
Sourcepub fn parse(s: &str) -> Result<Self>
pub fn parse(s: &str) -> Result<Self>
Parse from string like “90”, “90a”, “100a”, “sm_90a”
If no suffix is provided (e.g., “90”), auto-suffix is applied for sm_90+. To explicitly disable the suffix, use the numeric API directly.
Sourcepub fn auto_suffix(base: usize) -> Self
pub fn auto_suffix(base: usize) -> Self
Create GPU arch with auto-detected suffix for newer architectures
Architectures >= sm_90 generally benefit from the ‘a’ suffix for async/accelerated features. This is the recommended default.
Sourcepub fn to_nvcc_arch(&self) -> String
pub fn to_nvcc_arch(&self) -> String
Get the nvcc –gpu-architecture string (e.g., “sm_90a”, “sm_80”)
Sourcepub fn to_gencode_arg(&self) -> String
pub fn to_gencode_arg(&self) -> String
Get the nvcc -gencode argument (e.g., “-gencode=arch=compute_90a,code=sm_90a”)
This format is preferred for fat binary support and explicit architecture targeting.
Trait Implementations§
impl Eq for GpuArch
impl StructuralPartialEq for GpuArch
Auto Trait Implementations§
impl Freeze for GpuArch
impl RefUnwindSafe for GpuArch
impl Send for GpuArch
impl Sync for GpuArch
impl Unpin for GpuArch
impl UnwindSafe for GpuArch
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 more