Building DGL with debug mode

Hello Team,

We are trying to use cuda-gdb along with DGL, and we need to step through GPU kernels to debug some issue.
While building we have used this flag -DCMAKE_BUILD_TYPE=DEBUG, but after inspecting the CUDA_NVCC_FLAGS passed in cmake, we found -G to be missing.

- CUDA_NVCC_FLAGS: -Xcompiler;-fopenmp,-Wall,-fPIC,,-O0,-g3,-ggdb,-DUSE_LIBXSMM,-DDGL_CPU_LLC_SIZE=40000000,-DUSE_EPOLL,-DIDXTYPEWIDTH=64,-DREALTYPEWIDTH=32;--expt-relaxed-constexpr;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_86,code=compute_86;--expt-extended-lambda;-Wno-deprecated-declarations;-std=c++17

We modified the makefile to add -G flag in the CUDA.cmake file:

# list(APPEND CUDA_NVCC_FLAGS "-G")

But it throws the following error:

Error:
ptxas fatal   : Unresolved extern function 'cudaGetParameterBuffer'                                                                                                              
CMake Error at dgl_generated_spmat_op_impl_csr.cu.o.DEBUG.cmake:277 (message):                                                                                                   
  Error generating file                                                                                                                                                          
  /media/utkrisht/dgl_test/deepgraph/build/CMakeFiles/dgl.dir/src/array/cuda/./dgl_generated_spmat_op_impl_csr.cu.o                                                              
                                                                                                                                                                                 
                                                                                                                                                                                 
make[2]: *** [CMakeFiles/dgl.dir/build.make:252: CMakeFiles/dgl.dir/src/array/cuda/dgl_generated_spmat_op_impl_csr.cu.o] Error 1                                                 
make[2]: *** Waiting for unfinished jobs....                                                                                                                                     
ptxas fatal   : Unresolved extern function 'cudaGetParameterBuffer'                                                                                                              
CMake Error at dgl_generated_csr2coo.cu.o.DEBUG.cmake:277 (message):                                                                                                             
  Error generating file                                                                                                                                                          
  /media/utkrisht/dgl_test/deepgraph/build/CMakeFiles/dgl.dir/src/array/cuda/./dgl_generated_csr2coo.cu.o                                                                        
                                                                                                                                                                                 
                                                                                                                                                                                 
make[2]: *** [CMakeFiles/dgl.dir/build.make:133: CMakeFiles/dgl.dir/src/array/cuda/dgl_generated_csr2coo.cu.o] Error 1                                                           
ptxas fatal   : Unresolved extern function 'cudaGetParameterBuffer'                                                                                                              
CMake Error at dgl_generated_utils.cu.o.DEBUG.cmake:277 (message):                                                                                                               
  Error generating file                                                                                                                                                          
  /media/utkrisht/dgl_test/deepgraph/build/CMakeFiles/dgl.dir/src/array/cuda/./dgl_generated_utils.cu.o      

Environment details:

torch                    1.13.0a0+git7c98e70
dgl                      1.2

FYI: Torch has been built with source with debug mode.
TIA.

cc @TristonC on CUDA related building issues