Skip to content

Commit

Permalink
update doc, rename
Browse files Browse the repository at this point in the history
Co-authored-by: Marcel Koch <[email protected]>
  • Loading branch information
yhmtsai and MarcelKoch committed May 17, 2024
1 parent 7603816 commit 6b420f2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
17 changes: 9 additions & 8 deletions core/config/config_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ namespace gko {
namespace config {


#define GKO_INVALID_CONFIG_VALUE(_entry, _value) \
GKO_INVALID_STATE(_value + std::string(" is invalid for the entry ") + \
_entry)
#define GKO_INVALID_CONFIG_VALUE(_entry, _value) \
GKO_INVALID_STATE(std::string("The value >" + _value + \
"< is invalid for the entry >" + _entry + \
"<"))


#define GKO_MISS_CONFIG_ENTRY(_entry) \
GKO_INVALID_STATE(std::string("miss the entry ") + _entry)
GKO_INVALID_STATE(std::string("The entry >") + _entry + "< is missing")


/**
Expand Down Expand Up @@ -104,12 +105,11 @@ deferred_factory_parameter<T> parse_or_get_factory(const pnode& config,
const type_descriptor& td);

template <typename T>
inline deferred_factory_parameter<typename T::Factory> get_specific_factory(
const pnode& config, const registry& context, const type_descriptor& td)
inline deferred_factory_parameter<typename T::Factory>
parse_or_get_specific_factory(const pnode& config, const registry& context,
const type_descriptor& td)
{
using T_non_const = std::remove_const_t<T>;
// static_assert(std::is_convertible<T_non_const*, LinOpFactory*>::value,
// "only LinOpFactory");
deferred_factory_parameter<typename T::Factory> ptr;

if (config.get_tag() == pnode::tag_t::string) {
Expand Down Expand Up @@ -297,6 +297,7 @@ inline std::shared_ptr<typename Csr::strategy_type> get_strategy(
} else if (str == "classical") {
strategy_ptr = std::make_shared<typename Csr::classical>();
}
GKO_INVALID_CONFIG_VALUE("strategy", str);
return std::move(strategy_ptr);
}

Expand Down
6 changes: 3 additions & 3 deletions core/preconditioner/ic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ Ic<LSolverType, IndexType>::parse(const config::pnode& config,

if (auto& obj = config.get("l_solver")) {
params.with_l_solver(
gko::config::get_specific_factory<const LSolverType>(obj, context,
td_for_child));
gko::config::parse_or_get_specific_factory<const LSolverType>(
obj, context, td_for_child));
}
if (auto& obj = config.get("factorization")) {
params.with_factorization(
gko::config::build_or_get_factory<const LinOpFactory>(
gko::config::parse_or_get_factory<const LinOpFactory>(
obj, context, td_for_child));
}

Expand Down
10 changes: 5 additions & 5 deletions core/preconditioner/ilu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ Ilu<LSolverType, USolverType, ReverseApply, IndexType>::parse(

if (auto& obj = config.get("l_solver")) {
params.with_l_solver(
gko::config::get_specific_factory<const LSolverType>(obj, context,
td_for_child));
gko::config::parse_or_get_specific_factory<const LSolverType>(
obj, context, td_for_child));
}
if (auto& obj = config.get("u_solver")) {
params.with_u_solver(
gko::config::get_specific_factory<const USolverType>(obj, context,
td_for_child));
gko::config::parse_or_get_specific_factory<const USolverType>(
obj, context, td_for_child));
}
if (auto& obj = config.get("factorization")) {
params.with_factorization(
gko::config::build_or_get_factory<const LinOpFactory>(
gko::config::parse_or_get_factory<const LinOpFactory>(
obj, context, td_for_child));
}

Expand Down
2 changes: 1 addition & 1 deletion core/preconditioner/isai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Isai<IsaiType, ValueType, IndexType>::parse(
}
if (auto& obj = config.get("excess_solver_factory")) {
params.with_excess_solver_factory(
gko::config::build_or_get_factory<const LinOpFactory>(
gko::config::parse_or_get_factory<const LinOpFactory>(
obj, context, td_for_child));
}
if (auto& obj = config.get("excess_solver_reduction")) {
Expand Down
2 changes: 0 additions & 2 deletions core/test/config/preconditioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,6 @@ struct Jacobi
param.with_max_block_stride(32u);
config_map["skip_sorting"] = pnode{true};
param.with_skip_sorting(true);
// config_map["block_pointers"] = pnode{{{0}, {3}, {17}}};
// param.with_block_pointers(gko::array<gko::int64>(exec, {0, 3, 17}));
config_map["storage_optimization"] =
pnode{std::vector<pnode>{pnode{0}, pnode{1}}};
param.with_storage_optimization(gko::precision_reduction(0, 1));
Expand Down

0 comments on commit 6b420f2

Please sign in to comment.