Rust-GPU / Rust-GPU/rust-cuda

LockedBox use examples

Open
#99 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.4k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

Could you please give some examples how to use LockedBox?
I have a code like this:

#[repr(C, packed)]
#[derive(Debug, Clone, Copy, DeviceCopy)]
pub struct SomeResult {
    pub field: u32
}
...
let mut some_result = SomeResult::default();
let mut lb_some_result = LockedBox::new(&some_result).unwrap();

What should I do to copy it to DeviceBox and back from DeviceBox after the kernel finishes? Things like
let dev_results = DeviceBox::new(&lb_some_result).unwrap();
are not working.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names LockedBox, DeviceBox, and SomeResult but does not mention a source file or test. Start by tracing the available operations for those types from the example, especially copying to device and back after the kernel finishes. Done means providing a working end-to-end usage example.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.