pub struct Costs {
pub latency: f64,
pub up: f64,
pub down: f64,
pub gpu_gemm: f64,
pub gpu_direct: f64,
pub gpu_col: f64,
pub cpu_gemm: f64,
pub cpu_conv: f64,
pub cpu_act: f64,
pub gpu_act: f64,
}Expand description
实测的开销,单位都是秒。
Fields§
§latency: f64一次空的往返(交给工人、启动、等完成)。
up: f64每字节上传、下载。
down: f64§gpu_gemm: f64GPU 上每次乘加:SGEMM、深度卷积的直接内核;im2col 每个元素。
gpu_direct: f64§gpu_col: f64§cpu_gemm: f64CPU 上每次乘加:矩阵乘、卷积。
cpu_conv: f64§cpu_act: f64激活函数每个元素:CPU、GPU(以 GELU 为代表,它最贵)。
gpu_act: f64Implementations§
Source§impl Costs
impl Costs
Sourcepub fn gemm_on_gpu(
&self,
(m, n, k): (usize, usize, usize),
cached_b: bool,
) -> bool
pub fn gemm_on_gpu( &self, (m, n, k): (usize, usize, usize), cached_b: bool, ) -> bool
一次矩阵乘走 GPU 是否更快。cached_b 表示 b 已在显存。
Sourcepub fn conv_on_gpu(&self, s: &ConvShape, cached_w: bool) -> bool
pub fn conv_on_gpu(&self, s: &ConvShape, cached_w: bool) -> bool
一次卷积走 GPU 是否更快。cached_w 表示权重和偏置已在显存。
Sourcepub fn act_on_gpu(&self, n: usize) -> bool
pub fn act_on_gpu(&self, n: usize) -> bool
对 n 个元素做激活走 GPU 是否更快。
Trait Implementations§
impl Copy for Costs
impl StructuralPartialEq for Costs
Auto Trait Implementations§
impl Freeze for Costs
impl RefUnwindSafe for Costs
impl Send for Costs
impl Sync for Costs
impl Unpin for Costs
impl UnsafeUnpin for Costs
impl UnwindSafe for Costs
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