Skip to content

Commit fae0692

Browse files
committed
Feat: rename dbox, dbuffer, fix format issues, fix intrinsics doctests
1 parent a05d791 commit fae0692

File tree

18 files changed

+4143
-4146
lines changed

18 files changed

+4143
-4146
lines changed

crates/cuda_std/src/intrinsics.rs

+2,980-2,980
Large diffs are not rendered by default.

crates/cust/CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
3+
Notable changes to this project will be documented in this file.
4+
5+
## [Unreleased]
6+
7+
- Rename `DBuffer` -> `DeviceBuffer`. This is how it was in rustacuda, but it was changed
8+
at some point, but now we reconsidered that it may be the wrong choice.
9+
- Renamed `DBox` -> `DeviceBox`.
10+
- Fixed some doctests that were using old APIs.

crates/cust/src/event.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,16 @@ impl Event {
232232
/// # use cust::stream::{Stream, StreamFlags};
233233
/// # use cust::launch;
234234
/// # use cust::module::Module;
235-
/// # use cust::memory::DBox;
235+
/// # use cust::memory::DeviceBox;
236236
/// # use std::error::Error;
237237
/// # use std::ffi::CString;
238238
/// # fn main() -> Result<(), Box<dyn Error>> {
239239
/// # let _context = quick_init()?;
240240
/// # let module_data = CString::new(include_str!("../resources/add.ptx"))?;
241241
/// # let module = Module::load_from_string(&module_data)?;
242-
/// # let mut x = DBox::new(&10.0f32)?;
243-
/// # let mut y = DBox::new(&20.0f32)?;
244-
/// # let mut result = DBox::new(&0.0f32)?;
242+
/// # let mut x = DeviceBox::new(&10.0f32)?;
243+
/// # let mut y = DeviceBox::new(&20.0f32)?;
244+
/// # let mut result = DeviceBox::new(&0.0f32)?;
245245
/// use cust::event::{Event, EventFlags};
246246
///
247247
/// let stream = Stream::new(StreamFlags::NON_BLOCKING, None)?;

crates/cust/src/function.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,8 @@ impl<'a> Function<'a> {
226226
/// # use std::ffi::CString;
227227
/// # let ptx = CString::new(include_str!("../resources/add.ptx"))?;
228228
/// # let module = Module::load_from_string(&ptx)?;
229-
/// # let name = CString::new("sum")?;
230229
/// use cust::function::FunctionAttribute;
231-
/// let function = module.get_function(&name)?;
230+
/// let function = module.get_function("sum")?;
232231
/// let shared_memory = function.get_attribute(FunctionAttribute::SharedMemorySizeBytes)?;
233232
/// println!("This function uses {} bytes of shared memory", shared_memory);
234233
/// # Ok(())
@@ -270,9 +269,8 @@ impl<'a> Function<'a> {
270269
/// # use std::ffi::CString;
271270
/// # let ptx = CString::new(include_str!("../resources/add.ptx"))?;
272271
/// # let module = Module::load_from_string(&ptx)?;
273-
/// # let name = CString::new("sum")?;
274272
/// use cust::context::CacheConfig;
275-
/// let mut function = module.get_function(&name)?;
273+
/// let mut function = module.get_function("sum")?;
276274
/// function.set_cache_config(CacheConfig::PreferL1)?;
277275
/// # Ok(())
278276
/// # }
@@ -298,9 +296,8 @@ impl<'a> Function<'a> {
298296
/// # use std::ffi::CString;
299297
/// # let ptx = CString::new(include_str!("../resources/add.ptx"))?;
300298
/// # let module = Module::load_from_string(&ptx)?;
301-
/// # let name = CString::new("sum")?;
302299
/// use cust::context::SharedMemoryConfig;
303-
/// let mut function = module.get_function(&name)?;
300+
/// let mut function = module.get_function("sum")?;
304301
/// function.set_shared_memory_config(SharedMemoryConfig::EightByteBankSize)?;
305302
/// # Ok(())
306303
/// # }
@@ -487,8 +484,7 @@ impl<'a> Function<'a> {
487484
/// result?;
488485
///
489486
/// // Launch the kernel again using the `function` form:
490-
/// let function_name = CString::new("sum")?;
491-
/// let sum = module.get_function(&function_name)?;
487+
/// let sum = module.get_function("sum")?;
492488
/// // Launch with 1x1x1 (1) blocks of 10x1x1 (10) threads, to show that you can use tuples to
493489
/// // configure grid and block size.
494490
/// let result = launch!(sum<<<(1, 1, 1), (10, 1, 1), 0, stream>>>(

0 commit comments

Comments
 (0)