How to use nvidia gpu uvm in dgl?

hello.I want to use uvm in my operator. how to transfer dgl tensor to uvm tensor?I try to use the ffi in the doc. but I do not konw how to transfer it. if I use torch::from_blob to load the tensor I malloc by cudaMallocManaged, will it works? and how to change it to NDArray?

Are you trying to write the c-code for your operator? You can check our cuda code https://github.com/dmlc/dgl/blob/master/graphbolt/src/cuda/neighbor_sampler.cu as example.

Thanks.I want to know the different between NDarray and pytorch Tensor?

can I use libtorch in dgl/src? It seems that I need create new folder like graphbolt if I want to use torch. but the cmakeLists file is too difficult for me.Any tutorial?

NDarray is an abstraction of pytorch Tensor, we create NDarray to share code between pytorch Tensor and tensorflow tensor.

Yes, you can use libtorch, depending on whether you want to introduce new dependency, you may or may not need to update CMAKE. For tutorial, please refer to public CMAKE Tutorials.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.