I encountered issues with the code when checking it using compute-sanitizer. A total of 30,335 errors were reported. The first issue appears to involve an illegal read to global memory. These bugs are likely to cause undefined behavior in the program, making its results unreliable, which might explain why the total error sum is so high on many cases.
Additionally, I was wondering why the comparison is based on the total error sum instead of an element-wise comparison.
Here is the command I used:
compute-sanitizer --print-limit=1 ./spmm_test 4096 4096 16 80 7
Here is the reported error:

I encountered issues with the code when checking it using compute-sanitizer. A total of 30,335 errors were reported. The first issue appears to involve an illegal read to global memory. These bugs are likely to cause undefined behavior in the program, making its results unreliable, which might explain why the total error sum is so high on many cases.
Additionally, I was wondering why the comparison is based on the total error sum instead of an element-wise comparison.
Here is the command I used:
Here is the reported error:
