Skip to content

Commit 8ac7b4f

Browse files
fix: add SAFETY message to kernel and remove unnecessary imports
1 parent 00135f5 commit 8ac7b4f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

samples/introduction/async_api/kernels/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use cuda_std::prelude::*;
22

33
#[kernel]
4+
// SAFETY: The user must ensure that the number of (threads * blocks * grids)
5+
// must not be greater than the number of elements in `g_data`.
46
pub unsafe fn increment(g_data: *mut u32, inc_value: u32) {
57
// This can also be obtained directly as
68
//

samples/introduction/async_api/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
use cust::context::Context;
21
use cust::device::Device;
32
use cust::event::{Event, EventFlags};
43
use cust::function::{BlockSize, GridSize};
4+
use cust::launch;
55
use cust::memory::{AsyncCopyDestination, DeviceBuffer, LockedBuffer};
66
use cust::module::Module;
77
use cust::prelude::EventStatus;
88
use cust::stream::{Stream, StreamFlags};
9-
use cust::{CudaFlags, launch};
109
use std::time::Instant;
1110

1211
static PTX: &str = include_str!(concat!(env!("OUT_DIR"), "/kernels.ptx"));

0 commit comments

Comments
 (0)