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

Method copy_strided

crates/blastoff/src/level1.rs:232–255  ·  view source on GitHub ↗

Same as [`CublasContext::copy`] 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: &mut impl GpuBuffer<T>,
        y_stride: Option<usize>,
    

Source from the content-addressed store, hash-verified

230 ///
231 /// Panics if the buffers are not long enough for the stride and length requested.
232 pub fn copy_strided<T: Level1>(
233 &mut self,
234 stream: &Stream,
235 n: usize,
236 x: &impl GpuBuffer<T>,
237 x_stride: Option<usize>,
238 y: &mut impl GpuBuffer<T>,
239 y_stride: Option<usize>,
240 ) -> Result {
241 check_stride(x, n, x_stride);
242 check_stride(y, n, y_stride);
243
244 self.with_stream(stream, |ctx| unsafe {
245 Ok(T::copy(
246 ctx.raw,
247 n as i32,
248 x.as_device_ptr().as_ptr(),
249 x_stride.unwrap_or(1) as i32,
250 y.as_device_ptr().as_mut_ptr(),
251 y_stride.unwrap_or(1) as i32,
252 )
253 .to_result()?)
254 })
255 }
256
257 /// Copies `n` elements from `x` into `y`, overriding any previous data inside `y`.
258 ///

Callers 1

copyMethod · 0.80

Calls 6

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

Tested by

no test coverage detected