fnrizzi / kokkos-kernels

Kokkos C++ Performance Portability Programming EcoSystem: Math Kernels - Provides BLAS, Sparse BLAS and Graph Kernels
Other
0 stars 0 forks source link

Figure out the specialization of template function `spmv` #2

Closed fnrizzi closed 3 years ago

fnrizzi commented 3 years ago

@uhetmaniuk I was speaking with @MikolajZuzek and was wondering about when various specializations are triggered? Did you already figure this out for the spmv? I think that concurrently with writing an implementation for the block spmv, we also need a tentative plan/design for when to select the various impls. For example, Luc said that even if we might be able to use some alreayd avail CUDA library, he wants a basic implementation using CUDA that does not rely on external libraries. So one question is when are the various specializations activated? what conditions?

uhetmaniuk commented 3 years ago

@fnrizzi @MikolajZuzek

spmv allows to compute y <- beta y + alpha A^{M} x where M is N, C, T, H (similar to *gemv) Focusing on the case N and C, the computational routine is spmv_beta_no_transpose in the file KokkosSparse_spmv_impl.hpp. There is a switch by template between the different Kokkos Kernels (Serial, OpenMP, GPU). (And the same thing applies to the transpose / hermitian case). If CuSparse is enabled, there is also a switch in KokkosSparse_spmv.hpp. In the branch for the PR #1 , I have been looking at the no-transpose case and added the template-based switch.

fnrizzi commented 3 years ago

@uhetmaniuk ok, yes thanks! that is exactly what i was referring to.

XVector_Internal x_i = x;


do you why this has to be done? @MikolajZuzek offered to look into some of details to understand why of some things.

Just to clarify, I know that is work in progress, so I am not pressuring anything. Just asking questions :) 
uhetmaniuk commented 3 years ago
mzuzek commented 3 years ago

@fnrizzi @uhetmaniuk

I looked over KokkosSparse::spmv() implementation structure and specializations, here's the overview of calls going from user interface (orange) down to raw implementations (cyan): spmv uml (editable version: kk-spmv.plantuml.txt)

Summary:

fnrizzi commented 3 years ago

@MikolajZuzek this looks great!