Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder kernel parameters for consistency #474

Merged
merged 1 commit into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/factorization/par_ilu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ ParIlu<ValueType, IndexType>::generate_l_u(
// Since the transposed version has the exact same non-zero positions
// as `u_factor`, we can both skip the allocation and the `make_srow()`
// call from CSR, leaving just the `transpose()` kernel call
exec->run(par_ilu_factorization::make_csr_transpose(u_factor.get(),
u_factor_transpose));
exec->run(par_ilu_factorization::make_csr_transpose(u_factor_transpose,
u_factor.get()));

return Composition<ValueType>::create(std::move(l_factor),
std::move(u_factor));
Expand Down
6 changes: 3 additions & 3 deletions core/matrix/coo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void Coo<ValueType, IndexType>::convert_to(
result->get_strategy());
tmp->values_ = this->values_;
tmp->col_idxs_ = this->col_idxs_;
exec->run(coo::make_convert_to_csr(tmp.get(), this));
exec->run(coo::make_convert_to_csr(this, tmp.get()));
tmp->make_srow();
tmp->move_to(result);
}
Expand All @@ -128,7 +128,7 @@ void Coo<ValueType, IndexType>::move_to(Csr<ValueType, IndexType> *result)
result->get_strategy());
tmp->values_ = std::move(this->values_);
tmp->col_idxs_ = std::move(this->col_idxs_);
exec->run(coo::make_convert_to_csr(tmp.get(), this));
exec->run(coo::make_convert_to_csr(this, tmp.get()));
tmp->make_srow();
tmp->move_to(result);
}
Expand All @@ -139,7 +139,7 @@ void Coo<ValueType, IndexType>::convert_to(Dense<ValueType> *result) const
{
auto exec = this->get_executor();
auto tmp = Dense<ValueType>::create(exec, this->get_size());
exec->run(coo::make_convert_to_dense(tmp.get(), this));
exec->run(coo::make_convert_to_dense(this, tmp.get()));
tmp->move_to(result);
}

Expand Down
18 changes: 9 additions & 9 deletions core/matrix/coo_kernels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ namespace kernels {
const matrix::Dense<ValueType> *b, \
matrix::Dense<ValueType> *c)

#define GKO_DECLARE_COO_CONVERT_TO_DENSE_KERNEL(ValueType, IndexType) \
void convert_to_dense(std::shared_ptr<const DefaultExecutor> exec, \
matrix::Dense<ValueType> *result, \
const matrix::Coo<ValueType, IndexType> *source)

#define GKO_DECLARE_COO_CONVERT_TO_CSR_KERNEL(ValueType, IndexType) \
void convert_to_csr(std::shared_ptr<const DefaultExecutor> exec, \
matrix::Csr<ValueType, IndexType> *result, \
const matrix::Coo<ValueType, IndexType> *source)
#define GKO_DECLARE_COO_CONVERT_TO_DENSE_KERNEL(ValueType, IndexType) \
void convert_to_dense(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Coo<ValueType, IndexType> *source, \
matrix::Dense<ValueType> *result)

#define GKO_DECLARE_COO_CONVERT_TO_CSR_KERNEL(ValueType, IndexType) \
void convert_to_csr(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Coo<ValueType, IndexType> *source, \
matrix::Csr<ValueType, IndexType> *result)

#define GKO_DECLARE_ALL_AS_TEMPLATES \
template <typename ValueType, typename IndexType> \
Expand Down
24 changes: 12 additions & 12 deletions core/matrix/csr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void Csr<ValueType, IndexType>::convert_to(
exec, this->get_size(), this->get_num_stored_elements());
tmp->values_ = this->values_;
tmp->col_idxs_ = this->col_idxs_;
exec->run(csr::make_convert_to_coo(tmp.get(), this));
exec->run(csr::make_convert_to_coo(this, tmp.get()));
tmp->move_to(result);
}

Expand All @@ -146,7 +146,7 @@ void Csr<ValueType, IndexType>::convert_to(Dense<ValueType> *result) const
{
auto exec = this->get_executor();
auto tmp = Dense<ValueType>::create(exec, this->get_size());
exec->run(csr::make_convert_to_dense(tmp.get(), this));
exec->run(csr::make_convert_to_dense(this, tmp.get()));
tmp->move_to(result);
}

Expand Down Expand Up @@ -176,7 +176,7 @@ void Csr<ValueType, IndexType>::convert_to(
auto tmp = Hybrid<ValueType, IndexType>::create(
exec, this->get_size(), max_nnz_per_row, stride, coo_nnz,
result->get_strategy());
exec->run(csr::make_convert_to_hybrid(tmp.get(), this));
exec->run(csr::make_convert_to_hybrid(this, tmp.get()));
tmp->move_to(result);
}

Expand Down Expand Up @@ -204,7 +204,7 @@ void Csr<ValueType, IndexType>::convert_to(
slice_size));
auto tmp = Sellp<ValueType, IndexType>::create(
exec, this->get_size(), slice_size, stride_factor, total_cols);
exec->run(csr::make_convert_to_sellp(tmp.get(), this));
exec->run(csr::make_convert_to_sellp(this, tmp.get()));
tmp->move_to(result);
}

Expand Down Expand Up @@ -251,7 +251,7 @@ void Csr<ValueType, IndexType>::convert_to(
exec->run(csr::make_calculate_max_nnz_per_row(this, &max_nnz_per_row));
auto tmp = Ell<ValueType, IndexType>::create(exec, this->get_size(),
max_nnz_per_row);
exec->run(csr::make_convert_to_ell(tmp.get(), this));
exec->run(csr::make_convert_to_ell(this, tmp.get()));
tmp->move_to(result);
}

Expand Down Expand Up @@ -328,7 +328,7 @@ std::unique_ptr<LinOp> Csr<ValueType, IndexType>::transpose() const
Csr::create(exec, gko::transpose(this->get_size()),
this->get_num_stored_elements(), this->get_strategy());

exec->run(csr::make_transpose(trans_cpy.get(), this));
exec->run(csr::make_transpose(this, trans_cpy.get()));
trans_cpy->make_srow();
return std::move(trans_cpy);
}
Expand All @@ -342,7 +342,7 @@ std::unique_ptr<LinOp> Csr<ValueType, IndexType>::conj_transpose() const
Csr::create(exec, gko::transpose(this->get_size()),
this->get_num_stored_elements(), this->get_strategy());

exec->run(csr::make_conj_transpose(trans_cpy.get(), this));
exec->run(csr::make_conj_transpose(this, trans_cpy.get()));
trans_cpy->make_srow();
return std::move(trans_cpy);
}
Expand All @@ -359,7 +359,7 @@ std::unique_ptr<LinOp> Csr<ValueType, IndexType>::row_permute(
this->get_strategy());

exec->run(
csr::make_row_permute(permutation_indices, permute_cpy.get(), this));
csr::make_row_permute(permutation_indices, this, permute_cpy.get()));
permute_cpy->make_srow();
return std::move(permute_cpy);
}
Expand All @@ -376,7 +376,7 @@ std::unique_ptr<LinOp> Csr<ValueType, IndexType>::column_permute(
this->get_strategy());

exec->run(
csr::make_column_permute(permutation_indices, permute_cpy.get(), this));
csr::make_column_permute(permutation_indices, this, permute_cpy.get()));
permute_cpy->make_srow();
return std::move(permute_cpy);
}
Expand All @@ -393,8 +393,8 @@ std::unique_ptr<LinOp> Csr<ValueType, IndexType>::inverse_row_permute(
Csr::create(exec, this->get_size(), this->get_num_stored_elements(),
this->get_strategy());

exec->run(csr::make_inverse_row_permute(inverse_permutation_indices,
inverse_permute_cpy.get(), this));
exec->run(csr::make_inverse_row_permute(inverse_permutation_indices, this,
inverse_permute_cpy.get()));
inverse_permute_cpy->make_srow();
return std::move(inverse_permute_cpy);
}
Expand All @@ -412,7 +412,7 @@ std::unique_ptr<LinOp> Csr<ValueType, IndexType>::inverse_column_permute(
this->get_strategy());

exec->run(csr::make_inverse_column_permute(
inverse_permutation_indices, inverse_permute_cpy.get(), this));
inverse_permutation_indices, this, inverse_permute_cpy.get()));
inverse_permute_cpy->make_srow();
return std::move(inverse_permute_cpy);
}
Expand Down
106 changes: 53 additions & 53 deletions core/matrix/csr_kernels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,71 +77,71 @@ namespace kernels {
const matrix::Csr<ValueType, IndexType> *d, \
matrix::Csr<ValueType, IndexType> *c)

#define GKO_DECLARE_CSR_CONVERT_TO_DENSE_KERNEL(ValueType, IndexType) \
void convert_to_dense(std::shared_ptr<const DefaultExecutor> exec, \
matrix::Dense<ValueType> *result, \
const matrix::Csr<ValueType, IndexType> *source)

#define GKO_DECLARE_CSR_CONVERT_TO_COO_KERNEL(ValueType, IndexType) \
void convert_to_coo(std::shared_ptr<const DefaultExecutor> exec, \
matrix::Coo<ValueType, IndexType> *result, \
const matrix::Csr<ValueType, IndexType> *source)

#define GKO_DECLARE_CSR_CONVERT_TO_ELL_KERNEL(ValueType, IndexType) \
void convert_to_ell(std::shared_ptr<const DefaultExecutor> exec, \
matrix::Ell<ValueType, IndexType> *result, \
const matrix::Csr<ValueType, IndexType> *source)

#define GKO_DECLARE_CSR_CONVERT_TO_HYBRID_KERNEL(ValueType, IndexType) \
void convert_to_hybrid(std::shared_ptr<const DefaultExecutor> exec, \
matrix::Hybrid<ValueType, IndexType> *result, \
const matrix::Csr<ValueType, IndexType> *source)

#define GKO_DECLARE_CSR_CONVERT_TO_SELLP_KERNEL(ValueType, IndexType) \
void convert_to_sellp(std::shared_ptr<const DefaultExecutor> exec, \
matrix::Sellp<ValueType, IndexType> *result, \
const matrix::Csr<ValueType, IndexType> *source)
#define GKO_DECLARE_CSR_CONVERT_TO_DENSE_KERNEL(ValueType, IndexType) \
void convert_to_dense(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<ValueType, IndexType> *source, \
matrix::Dense<ValueType> *result)

#define GKO_DECLARE_CSR_CONVERT_TO_COO_KERNEL(ValueType, IndexType) \
void convert_to_coo(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<ValueType, IndexType> *source, \
matrix::Coo<ValueType, IndexType> *result)

#define GKO_DECLARE_CSR_CONVERT_TO_ELL_KERNEL(ValueType, IndexType) \
void convert_to_ell(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<ValueType, IndexType> *source, \
matrix::Ell<ValueType, IndexType> *result)

#define GKO_DECLARE_CSR_CONVERT_TO_HYBRID_KERNEL(ValueType, IndexType) \
void convert_to_hybrid(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<ValueType, IndexType> *source, \
matrix::Hybrid<ValueType, IndexType> *result)

#define GKO_DECLARE_CSR_CONVERT_TO_SELLP_KERNEL(ValueType, IndexType) \
void convert_to_sellp(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<ValueType, IndexType> *source, \
matrix::Sellp<ValueType, IndexType> *result)

#define GKO_DECLARE_CSR_CALCULATE_TOTAL_COLS_KERNEL(ValueType, IndexType) \
void calculate_total_cols(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<ValueType, IndexType> *source, \
size_type *result, size_type stride_factor, \
size_type slice_size)

#define GKO_DECLARE_CSR_TRANSPOSE_KERNEL(ValueType, IndexType) \
void transpose(std::shared_ptr<const DefaultExecutor> exec, \
matrix::Csr<ValueType, IndexType> *trans, \
const matrix::Csr<ValueType, IndexType> *orig)

#define GKO_DECLARE_CSR_CONJ_TRANSPOSE_KERNEL(ValueType, IndexType) \
void conj_transpose(std::shared_ptr<const DefaultExecutor> exec, \
matrix::Csr<ValueType, IndexType> *trans, \
const matrix::Csr<ValueType, IndexType> *orig)

#define GKO_DECLARE_CSR_ROW_PERMUTE_KERNEL(ValueType, IndexType) \
void row_permute(std::shared_ptr<const DefaultExecutor> exec, \
const Array<IndexType> *permutation_indices, \
matrix::Csr<ValueType, IndexType> *row_permuted, \
const matrix::Csr<ValueType, IndexType> *orig)

#define GKO_DECLARE_CSR_COLUMN_PERMUTE_KERNEL(ValueType, IndexType) \
void column_permute(std::shared_ptr<const DefaultExecutor> exec, \
const Array<IndexType> *permutation_indices, \
matrix::Csr<ValueType, IndexType> *column_permuted, \
const matrix::Csr<ValueType, IndexType> *orig)

#define GKO_DECLARE_CSR_INVERSE_ROW_PERMUTE_KERNEL(ValueType, IndexType) \
void inverse_row_permute(std::shared_ptr<const DefaultExecutor> exec, \
const Array<IndexType> *permutation_indices, \
matrix::Csr<ValueType, IndexType> *row_permuted, \
const matrix::Csr<ValueType, IndexType> *orig)
#define GKO_DECLARE_CSR_TRANSPOSE_KERNEL(ValueType, IndexType) \
void transpose(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<ValueType, IndexType> *orig, \
matrix::Csr<ValueType, IndexType> *trans)

#define GKO_DECLARE_CSR_CONJ_TRANSPOSE_KERNEL(ValueType, IndexType) \
void conj_transpose(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<ValueType, IndexType> *orig, \
matrix::Csr<ValueType, IndexType> *trans)

#define GKO_DECLARE_CSR_ROW_PERMUTE_KERNEL(ValueType, IndexType) \
void row_permute(std::shared_ptr<const DefaultExecutor> exec, \
const Array<IndexType> *permutation_indices, \
const matrix::Csr<ValueType, IndexType> *orig, \
matrix::Csr<ValueType, IndexType> *row_permuted)

#define GKO_DECLARE_CSR_COLUMN_PERMUTE_KERNEL(ValueType, IndexType) \
void column_permute(std::shared_ptr<const DefaultExecutor> exec, \
const Array<IndexType> *permutation_indices, \
const matrix::Csr<ValueType, IndexType> *orig, \
matrix::Csr<ValueType, IndexType> *column_permuted)

#define GKO_DECLARE_CSR_INVERSE_ROW_PERMUTE_KERNEL(ValueType, IndexType) \
void inverse_row_permute(std::shared_ptr<const DefaultExecutor> exec, \
const Array<IndexType> *permutation_indices, \
const matrix::Csr<ValueType, IndexType> *orig, \
matrix::Csr<ValueType, IndexType> *row_permuted)

#define GKO_DECLARE_CSR_INVERSE_COLUMN_PERMUTE_KERNEL(ValueType, IndexType) \
void inverse_column_permute( \
std::shared_ptr<const DefaultExecutor> exec, \
const Array<IndexType> *permutation_indices, \
matrix::Csr<ValueType, IndexType> *column_permuted, \
const matrix::Csr<ValueType, IndexType> *orig)
const matrix::Csr<ValueType, IndexType> *orig, \
matrix::Csr<ValueType, IndexType> *column_permuted)

#define GKO_DECLARE_CSR_CALCULATE_MAX_NNZ_PER_ROW_KERNEL(ValueType, IndexType) \
void calculate_max_nnz_per_row( \
Expand Down
Loading