Dive into DGL Kernel using NVIDIA Nsight Compute

Hello everyone,
I am a student interested in CUDA kernel design in graph learning system, and I’d like to profile kernel using Nvidia Nsight Compute. I used to get source and SASS code in Nsight Compute with nvcc -lineinfo compile flag:


Question: How can I do that when install DGL from source?Maybe I should add extra_compile_args={'nvcc': ['-lineinfo']} in setup.py? Thanks a lot!

I suppose appending these flags:

to CMAKE_CUDA_FLAGS in dgl/CUDA.cmake at 7ee550f004e29931fbadc2c75d056639231dc44a · dmlc/dgl · GitHub

would work.

1 Like

Hi @yofufufufu,

Following the suggestion of @zihao, you can try to add the flag to CUDA_NVCC_FLAGS in DGL to see whether it works. Be careful that how to add CUDA flags could also depends on you CMake versions (passing flags to nvcc via CMake - CUDA Programming and Performance - NVIDIA Developer Forums).

1 Like

@yofufufufu Follow the guide to build the dynamic library first. You can pass the -DCMAKE_CUDA_FLAGS=-lineinfo in the cmake command in the cuda build section.

As @czkkkkkk mentioned, it may dependent on the cmake version the way to pass the nvcc flags to the nvcc compiler may be different.

One way that I saw the flag successfully passed to the nvcc compiler is to modify the cmake/modules/CUDA.cmake file. Adding the following line near the line 300 in the file

list(APPEND CUDA_NVCC_FLAGS "-lineinfo" "${CXX_HOST_FLAGS}")

Thank you all for your suggestion, now I can see source and SASS code in Nsight Compute when profiling kernel, which helps me a lot learning DGL.

1 Like

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