Skip to content

Commit 00135f5

Browse files
chore: make the context creation code more ergonomic by using quick_init()
1 parent cf47dcd commit 00135f5

File tree

1 file changed

+2
-5
lines changed
  • samples/introduction/async_api/src

1 file changed

+2
-5
lines changed

samples/introduction/async_api/src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ fn correct_output(data: &[u32], x: u32) -> bool {
2323
}
2424

2525
fn main() -> Result<(), cust::error::CudaError> {
26-
cust::init(CudaFlags::empty()).expect("Couldn't initialize CUDA environment!");
27-
26+
// Set up the context, load the module, and create a stream to run kernels in.
27+
let _ctx = cust::quick_init();
2828
let device = Device::get_device(0).expect("Couldn't find Cuda supported devices!");
29-
3029
println!("Device Name: {}", device.name().unwrap());
3130

32-
// Set up the context, load the module, and create a stream to run kernels in.
33-
let _ctx = Context::new(device);
3431
let module = Module::from_ptx(PTX, &[]).expect("Module couldn't be init!");
3532
let increment = module
3633
.get_function("increment")

0 commit comments

Comments
 (0)