Finding location of Warning: Cannot do atomic on local memory

I have a big code repository with large kernels consisting of 100’s of device functions. I get the following warning on compilation:

cu files are: ./main.cu
nvcc -g -Xcompiler -fopenmp -lineinfo -O3 -arch=sm_80 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_80,code=compute_80  -c main.cu -o build1/obj/main.cu.o
warning: /usr/local/cuda/bin/../targets/x86_64-linux/include/device_atomic_functions.hpp(107): Warning: Cannot do atomic on local memory
warning: /usr/local/cuda/bin/../targets/x86_64-linux/include/device_atomic_functions.hpp(107): Warning: Cannot do atomic on local memory
warning: /usr/local/cuda/bin/../targets/x86_64-linux/include/device_atomic_functions.hpp(107): Warning: Cannot do atomic on local memory
nvcc -o build/main.exe ./build1/obj/main.cu.o -lcuda -lgomp

Since I have a big repo, I would like to have more information about the call stack of the warning. I have tried using the flag --Werror hoping that the compiler would through more information about the call stack but I get the same info.

compute-sanitizer --tool racecheck hasn’t been helpful either (doesn’t throw any errors).

Please help.

I was able to find the location of the warning through the painful (brute-force) way. Would like to know if there is a neat way though!