bheisler / RustaCUDA

Rusty wrapper for the CUDA Driver API
Apache License 2.0
758 stars 60 forks source link

Update prelude in API documentation, old re-exports #33

Closed saona-raimundo closed 4 years ago

saona-raimundo commented 5 years ago

It seems to me that the re-exports in https://bheisler.github.io/RustaCUDA/rustacuda/prelude/index.html are outdated.

I tried to use DeviceBox, which is in rustacuda::memory::, together with DeviceBuffer, but I couldn't. I had to include pub use rustacuda::memory::;

Moreover, when replacing use rustacuda::prelude::*; by

pub use crate::context::Context; pub use crate::context::ContextFlags; pub use crate::device::Device; pub use crate::module::Module; pub use crate::stream::Stream; pub use crate::stream::StreamFlags; pub use crate::CudaFlags;

I could not use DeviceBuffer any longer.

Thanks and cheers!!

bheisler commented 5 years ago

Hey, thanks for the suggestion.

I think the prelude is correct as-is. I expect DeviceBox to be used quite a bit less often than DeviceBuffer, so it's OK that code that uses it will have to import that type explicitly. The prelude is not intended to be a single import for everything in RustaCUDA.

As for the other problem, yes? use crate means that you're importing something from your own crate, not from RustaCUDA, so that won't work. Further, you can't use DeviceBuffer because you haven't imported DeviceBuffer - that would be use rustacuda::memory::DeviceBuffer.

saona-raimundo commented 5 years ago

You are right... I just noticed that my message was a mess... sorry. (I meant everything without the "pub" and "rustacuda" instead of "crate"). What I actually wanted to say is the following.

In the documentation the re-exports presented says something different than the code:

the exports from the memory module are missing.

bheisler commented 5 years ago

Hey, yeah. I'd never noticed that before.

I have no idea why rustacuda::stream::Stream is being displayed differently in the docs from rustacuda::memory::DeviceBuffer. I don't think there's any way that I can fix it directly though; you might want to raise a bug with the developers of Rustdoc.