Improving Csr::strategy_type #320
Labels
is:interface-breaking
This change may break interface compatibility. Can only be done through a major release.
is:proposal
Maybe we should do something this way.
mod:core
This is related to the core module.
mod:cuda
This is related to the CUDA module.
type:matrix-format
This is related to the Matrix formats
Currently, all strategies for CSR are tailored for CUDA, which is fine for the most part.
However, also the names are CUDA specific (see
Csr::cusparse
), which should be changed in my opinion since we want to support multiple platforms. I would prefer to go with a more neutral name likeCsr::sparse_library
in that case (maybe there is even an OpenMP sparse library we could use for that).Also,
automatical
only works on CUDA devices and even requires aCudaExecutor
to work. I would prefer a solution where it is possible to also adapt to certain OpenMP properties (which we should have as soon as we have a more sophisticated SpMV there).Additionally, I am not sure why we use an
std::shared_ptr
for these strategies. Currently, we always have to callstd::make_shared
to generate a strategy, which is both not intuitive and not necessary since there is not much stored inside a strategy object (at most anstd::string
and anint64_t
). I think copying the object would be faster than allocating memory on the heap, although it should not really matter much (the more important part for me is the intuitiveness).We could also encapsulate the strategies in a class named
strategy
, so it is clear thatCsr::spmv_strategy::automatical
is an SpMV strategy.In summary, I think the following changes should be introduced:
cusparse
->sparse_library
automatical
to actually be automatical and dependent on the executor (CUDA vs. OpenMP vs. Reference) without requiring a CudaExecutorstd::shared_ptr
to just a plain object since the most one of these objects contain is anint64_t
and anstd::string
spmv_strategy
(or similar), so you call it withCsr::spmv_strategy::automatical
, which is more descriptiveAdditionally, some functionality/performance changes can also be incorporated into the strategies:
make_srow
to keep data persistent over manyapply
calls optimizing the apply calls. See discussion here.The text was updated successfully, but these errors were encountered: