Skip to content

Conversation

greole
Copy link
Collaborator

@greole greole commented Jan 22, 2025

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.

@ginkgo-bot ginkgo-bot added the mod:core This is related to the core module. label Jan 22, 2025
@upsj
Copy link
Member

upsj commented Jan 22, 2025

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

@greole
Copy link
Collaborator Author

greole commented Jan 22, 2025

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.

@upsj
Copy link
Member

upsj commented Jan 22, 2025

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.

@greole greole changed the title Add sized ctr and public add_operator to Combination Add sized ctor and public add_operator to Combination Jan 22, 2025
@MarcelKoch MarcelKoch self-requested a review February 13, 2025 11:52
add_operators(std::forward<Rest>(rest)...);
}

protected:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @upsj that we should not expose this member. I think it would be enough to add a constructor, which takes the iterators, and just an dimension as an extra parameter. Then you could build the linop from that parameter, and just check that the operator dimensions match up.

@greole greole force-pushed the ogl_0600_gko190 branch 2 times, most recently from 6b90223 to 3727e02 Compare February 19, 2025 15:14
@greole greole marked this pull request as draft February 19, 2025 15:23
@greole greole force-pushed the ogl_0600_gko190 branch 2 times, most recently from 6a98e6b to 942fe83 Compare May 31, 2025 11:52
@yhmtsai yhmtsai force-pushed the ogl_0600_gko190 branch from 942fe83 to f6fed17 Compare June 4, 2025 16:26
@ginkgo-bot
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:core This is related to the core module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants