| 19 | |
| 20 | template <typename T> |
| 21 | __global__ void traceKernel(T* mat, T* result, size_s N) { |
| 22 | // mat is the input square matrix, and result is a scalar output |
| 23 | size_l idx = threadIdx.x + blockIdx.x * blockDim.x; |
| 24 | if(idx < N){ |
| 25 | atomicAdd(&result[0], mat[idx*N+idx]); |
| 26 | } |
| 27 | |
| 28 | } |
| 29 | |
| 30 | template <typename T> |
| 31 | inline void trace(DeviceDnTen<T>& mat, T* result){ |
nothing calls this directly
no outgoing calls
no test coverage detected