You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am using this great library for my work and really appreciate to the author in advance.
I have encountered a problem recently when initializing the struct(that is generated by bindgen) that has pointer as fields in Rust side. For clarity, let's assume the following C structs(that are both binding types).
structBar {};
structFoo {
structBar*bar
};
bindgen would generate the following Rust structs.
So now I tried to create Foo struct from Rust side and then pass to CUDA.
So I did the following step,
malloc bar field and obtained CudaSlice<Bar>
and tried to initialize Foo with *mut Bar but I realized the pointer value field is private in CudaSlice
I was thinking about how to overcome this issue, and just tried to add one additional method that interprets pointer value to raw pointer *T in Rust like below.
This code seems a bit awkward, because the returned raw pointer actually does not point to T in host memory(it points to the device memory). So, I'm not sure whether this approach makes sense. Is there any other way to overcome this? @coreylowman
The text was updated successfully, but these errors were encountered:
Hello, I am using this great library for my work and really appreciate to the author in advance.
I have encountered a problem recently when initializing the struct(that is generated by
bindgen
) that has pointer as fields in Rust side. For clarity, let's assume the following C structs(that are both binding types).bindgen
would generate the following Rust structs.So now I tried to create
Foo
struct from Rust side and then pass to CUDA.So I did the following step,
bar
field and obtainedCudaSlice<Bar>
Foo
with*mut Bar
but I realized the pointer value field is private inCudaSlice
I was thinking about how to overcome this issue, and just tried to add one additional method that interprets pointer value to raw pointer
*T
in Rust like below.This code seems a bit awkward, because the returned raw pointer actually does not point to
T
in host memory(it points to the device memory). So, I'm not sure whether this approach makes sense. Is there any other way to overcome this? @coreylowmanThe text was updated successfully, but these errors were encountered: