MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / dot_strided

Method dot_strided

crates/blastoff/src/level1.rs:300–325  ·  view source on GitHub ↗

Same as [`CublasContext::dot`] but with an explicit stride. # Panics Panics if the buffers are not long enough for the stride and length requested.

(
        &mut self,
        stream: &Stream,
        n: usize,
        x: &impl GpuBuffer<T>,
        x_stride: Option<usize>,
        y: &impl GpuBuffer<T>,
        y_stride: Option<usize>,
        

Source from the content-addressed store, hash-verified

298 ///
299 /// Panics if the buffers are not long enough for the stride and length requested.
300 pub fn dot_strided<T: FloatLevel1>(
301 &mut self,
302 stream: &Stream,
303 n: usize,
304 x: &impl GpuBuffer<T>,
305 x_stride: Option<usize>,
306 y: &impl GpuBuffer<T>,
307 y_stride: Option<usize>,
308 result: &mut impl GpuBox<T>,
309 ) -> Result {
310 check_stride(x, n, x_stride);
311 check_stride(y, n, y_stride);
312
313 self.with_stream(stream, |ctx| unsafe {
314 Ok(T::dot(
315 ctx.raw,
316 n as i32,
317 x.as_device_ptr().as_ptr(),
318 x_stride.unwrap_or(1) as i32,
319 y.as_device_ptr().as_ptr(),
320 y_stride.unwrap_or(1) as i32,
321 result.as_device_ptr().as_mut_ptr(),
322 )
323 .to_result()?)
324 })
325 }
326
327 /// Computes the dot product of two vectors:
328 ///

Callers 1

dotMethod · 0.80

Calls 7

check_strideFunction · 0.85
with_streamMethod · 0.80
as_ptrMethod · 0.80
dotFunction · 0.50
to_resultMethod · 0.45
as_device_ptrMethod · 0.45
as_mut_ptrMethod · 0.45

Tested by

no test coverage detected