ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

Add sized ctor and public add_operator to Combination

Open greole opened this issue 11 months ago • 4 comments

This PR makes the Combination::add_operators member public so that operators can be added after constructing a combination matrix. Additionally, a new constructor is added so that an empty combination can be created first and additional operators are added later.

greole avatar Jan 22 '25 08:01 greole

Can you describe a use case for this? Combination creation is pretty lightweight, so I am hesitant to add more complexity there.

upsj avatar Jan 22 '25 08:01 upsj

Sure and maybe there is a better way to do it. On the OGL side I have std::vector<gko::LinOp> of local and non_local linops representing local and non_local interfaces for Distributed::Matrix. Probably, I could also use this ctr

    explicit Combination(CoefficientIterator coefficient_begin,
                         CoefficientIterator coefficient_end,
                         OperatorIterator operator_begin,
                         OperatorIterator operator_end)

but there are cases (after repartitioning) where operator_begin==operator_end thus it would throw.

greole avatar Jan 22 '25 09:01 greole

Making the empty case work seems sensible, except for the fact that we don't have anything to base the size on then. BTW ctr is kind of a misleading abbreviation, it could be counter or constructor.

upsj avatar Jan 22 '25 09:01 upsj

Error: The following files need to be formatted:

common/cuda_hip/components/merging.hpp
common/cuda_hip/components/searching.hpp
common/cuda_hip/factorization/lu_kernels.cpp
common/cuda_hip/factorization/par_ilut_filter_kernels.hpp
common/cuda_hip/factorization/par_ilut_spgeam_kernels.cpp
common/cuda_hip/matrix/dense_kernels.cpp
core/config/stop_config.cpp
core/config/trisolver_config.hpp
core/factorization/par_ic.cpp
core/factorization/par_ict.cpp
core/factorization/par_ilu.cpp
core/factorization/par_ilut.cpp
core/preconditioner/gauss_seidel.cpp
core/preconditioner/isai.cpp
core/preconditioner/sor.cpp
core/solver/bicg.cpp
core/solver/bicgstab.cpp
core/solver/cb_gmres.cpp
core/solver/cg.cpp
core/solver/cgs.cpp
core/solver/direct.cpp
core/solver/fcg.cpp
core/solver/gcr.cpp
core/solver/idr.cpp
core/solver/lower_trs.cpp
core/solver/upper_trs.cpp
core/test/config/factorization.cpp
core/test/config/multigrid.cpp
cuda/components/cooperative_groups.cuh
cuda/test/components/cooperative_groups.cu
dpcpp/components/cooperative_groups.dp.hpp
dpcpp/components/merging.dp.hpp
dpcpp/components/searching.dp.hpp
dpcpp/factorization/par_ict_kernels.dp.cpp
dpcpp/factorization/par_ilut_filter_kernels.hpp.inc
dpcpp/factorization/par_ilut_spgeam_kernel.dp.cpp
dpcpp/factorization/par_ilut_sweep_kernel.dp.cpp
dpcpp/test/components/cooperative_groups.dp.cpp
hip/test/components/cooperative_groups.hip.cpp
include/ginkgo/core/base/combination.hpp
include/ginkgo/core/factorization/ic.hpp
include/ginkgo/core/factorization/ilu.hpp
include/ginkgo/core/solver/multigrid.hpp
reference/test/factorization/ic_kernels.cpp
reference/test/factorization/ilu_kernels.cpp

You can find a formatting patch under Artifacts here or run format! if you have write access to Ginkgo

ginkgo-bot avatar Jun 26 '25 12:06 ginkgo-bot