8000 Improving Csr::strategy_type · Issue #320 · ginkgo-project/ginkgo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Improving Csr::strategy_type #320
Open
@thoasm

Description

@thoasm

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 like Csr::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 a CudaExecutor 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 call std::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 an std::string and an int64_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 that Csr::spmv_strategy::automatical is an SpMV strategy.

In summary, I think the following changes should be introduced:

  • Change the names of the strategies to more neutral ones, e.g. cusparse -> sparse_library
  • Make automatical to actually be automatical and dependent on the executor (CUDA vs. OpenMP vs. Reference) without requiring a CudaExecutor
  • Change the type of the strategy from std::shared_ptr to just a plain object since the most one of these objects contain is an int64_t and an std::string
  • put all strategy classes in a separate class spmv_strategy (or similar), so you call it with Csr::spmv_strategy::automatical, which is more descriptive

Additionally, some functionality/performance changes can also be incorporated into the strategies:

  • Split the generate/prepare step required for some strategies (cusparse. hipsparse) and move them if possible to make_srow to keep data persistent over many apply calls optimizing the apply calls. See discussion here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    is:interface-breakingThis change may break interface compatibility. Can only be done through a major release.is:proposalMaybe we should do something this way.mod:coreThis is related to the core module.mod:cudaThis is related to the CUDA module.type:matrix-formatThis is related to the Matrix formats

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0