Rust-GPU / Rust-CUDA

Ecosystem of libraries and tools for writing and executing fast GPU code fully in Rust.
Apache License 2.0
3.02k stars 115 forks source link

Add pitched malloc and 2d memcpy to cust #64

Open kjetilkjeka opened 2 years ago

kjetilkjeka commented 2 years ago

Fixes #56

Add pitched malloc and 2d memcpy to cust::memory.

The memcpy_2d functions is working on elements in width/height instead of bytes. This does not correspond to what the other memcpy functions are currently doing but corresponds to what malloc (including malloc_pitched) is currently doing.

I see many good arguments for using bytes and many good arguments for using elements. The important thing is that the interface is consistent. My assumption is that it is more important with consistency between malloc and memcpy than between memcpys. Making the module completely consistent is outside the scope of this PR as discussed in #56

I also updated cust from 2018 edition to 2021 edition. This was mainly to get TryInto automatically into scope. I hope that was Ok.