ThrustRTC icon indicating copy to clipboard operation
ThrustRTC copied to clipboard

Question: JCuda integration

Open davidpham87 opened this issue 5 years ago • 2 comments

Hello,

Thanks a lot for the library.

I wondered if you think one could integrate JCuda (https://github.com/jcuda/jcuda-main) in your java API? From my understanding, the device variables should be interchangeable between ThrustRTC and JCuda?

For the context, I am interesting to use ThurstRTC Java API from Clojure.

Best regards, David

davidpham87 avatar Oct 12 '20 09:10 davidpham87

Hi, I've just added some new interfaces to the JAVA API:

  • long DVVector.native_pointer(): You can use this to retrieve a native CUDA pointer from a DVVector object

  • class DVVectorAdaptor: You can use a native CUDA pointer from an external library to initialize a DVVectorAdaptor object, then use it similarity as a DVVector object.

Theoretically these 2 interfaces should enable the interoperation with jcuda. Basically, you get a native pointer from one library, then pass it to the other library to initialize an object in the 2nd library, by I haven't got a chance to try it yet.

Looks like getting a native pointer from jcuda is a little bit tricky: https://stackoverflow.com/questions/31993759/how-can-i-create-a-struct-of-native-pointers-in-jcuda

fynv avatar Oct 15 '20 02:10 fynv