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 fd4b415 commit 574c91a
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 31 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
2 changes: 1 addition & 1 deletion include/ginkgo/core/factorization/cholesky.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Cholesky

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/factorization/ic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Ic : public Composition<ValueType> {

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/factorization/ilu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Ilu : public Composition<ValueType> {

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/factorization/lu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Lu

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/factorization/par_ic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class ParIc : public Composition<ValueType> {

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/factorization/par_ict.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class ParIct : public Composition<ValueType> {

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/factorization/par_ilu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class ParIlu : public Composition<ValueType> {

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/factorization/par_ilut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class ParIlut : public Composition<ValueType> {

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/preconditioner/ic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Ic : public EnableLinOp<Ic<LSolverType, IndexType>>, public Transposable {

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/preconditioner/ilu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class Ilu : public EnableLinOp<

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/preconditioner/isai.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class Isai : public EnableLinOp<Isai<IsaiType, ValueType, IndexType>>,

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/preconditioner/jacobi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ class Jacobi : public EnableLinOp<Jacobi<ValueType, IndexType>>,

/**
* Create the parameters from the property_tree.
* Because this is directly tied to the specific type. The value/index type
* Because this is directly tied to the specific type, the value/index type
* settings within config are ignored and type_descriptor is only used
* for children objects.
*
Expand Down

0 comments on commit 574c91a

Please sign in to comment.