Skip to content

Commit

Permalink
Call clang_format with version 8 on full project.
Browse files Browse the repository at this point in the history
  • Loading branch information
tcojean committed Jul 6, 2020
1 parent 947eda6 commit 2c1c1b5
Show file tree
Hide file tree
Showing 16 changed files with 194 additions and 186 deletions.
3 changes: 2 additions & 1 deletion benchmark/solver/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ DEFINE_bool(overhead, false,


// input validation
[[noreturn]] void print_config_error_and_exit() {
[[noreturn]] void print_config_error_and_exit()
{
std::cerr << "Input has to be a JSON array of matrix configurations:\n"
<< " [\n"
<< " { \"filename\": \"my_file.mtx\", \"optimal\": { "
Expand Down
16 changes: 8 additions & 8 deletions cuda/factorization/par_ilut_spgeam_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ void add_candidates(std::shared_ptr<const DefaultExecutor> exec,
auto total_nnz =
lu->get_num_stored_elements() + a->get_num_stored_elements();
auto total_nnz_per_row = total_nnz / num_rows;
select_add_candidates(compiled_kernels(),
[&](int compiled_subwarp_size) {
return total_nnz_per_row <=
compiled_subwarp_size ||
compiled_subwarp_size == config::warp_size;
},
syn::value_list<int>(), syn::type_list<>(), exec, lu,
a, l, u, l_new, u_new);
select_add_candidates(
compiled_kernels(),
[&](int compiled_subwarp_size) {
return total_nnz_per_row <= compiled_subwarp_size ||
compiled_subwarp_size == config::warp_size;
},
syn::value_list<int>(), syn::type_list<>(), exec, lu, a, l, u, l_new,
u_new);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
Expand Down
21 changes: 11 additions & 10 deletions cuda/matrix/csr_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -635,16 +635,17 @@ void spgeam(std::shared_ptr<const DefaultExecutor> exec,
auto total_nnz =
a->get_num_stored_elements() + b->get_num_stored_elements();
auto nnz_per_row = total_nnz / a->get_size()[0];
select_spgeam(spgeam_kernels(),
[&](int compiled_subwarp_size) {
return compiled_subwarp_size >= nnz_per_row ||
compiled_subwarp_size == config::warp_size;
},
syn::value_list<int>(), syn::type_list<>(), exec,
alpha->get_const_values(), a->get_const_row_ptrs(),
a->get_const_col_idxs(), a->get_const_values(),
beta->get_const_values(), b->get_const_row_ptrs(),
b->get_const_col_idxs(), b->get_const_values(), c);
select_spgeam(
spgeam_kernels(),
[&](int compiled_subwarp_size) {
return compiled_subwarp_size >= nnz_per_row ||
compiled_subwarp_size == config::warp_size;
},
syn::value_list<int>(), syn::type_list<>(), exec,
alpha->get_const_values(), a->get_const_row_ptrs(),
a->get_const_col_idxs(), a->get_const_values(),
beta->get_const_values(), b->get_const_row_ptrs(),
b->get_const_col_idxs(), b->get_const_values(), c);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(GKO_DECLARE_CSR_SPGEAM_KERNEL);
Expand Down
18 changes: 9 additions & 9 deletions cuda/preconditioner/jacobi_generate_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ void generate(std::shared_ptr<const CudaExecutor> exec,
{
components::fill_array(exec, blocks.get_data(), blocks.get_num_elems(),
zero<ValueType>());
select_generate(compiled_kernels(),
[&](int compiled_block_size) {
return max_block_size <= compiled_block_size;
},
syn::value_list<int, config::min_warps_per_block>(),
syn::type_list<>(), system_matrix, accuracy,
blocks.get_data(), storage_scheme, conditioning.get_data(),
block_precisions.get_data(),
block_pointers.get_const_data(), num_blocks);
select_generate(
compiled_kernels(),
[&](int compiled_block_size) {
return max_block_size <= compiled_block_size;
},
syn::value_list<int, config::min_warps_per_block>(), syn::type_list<>(),
system_matrix, accuracy, blocks.get_data(), storage_scheme,
conditioning.get_data(), block_precisions.get_data(),
block_pointers.get_const_data(), num_blocks);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
Expand Down
20 changes: 10 additions & 10 deletions cuda/preconditioner/jacobi_simple_apply_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@ void simple_apply(
{
// TODO: write a special kernel for multiple RHS
for (size_type col = 0; col < b->get_size()[1]; ++col) {
select_apply(compiled_kernels(),
[&](int compiled_block_size) {
return max_block_size <= compiled_block_size;
},
syn::value_list<int, config::min_warps_per_block>(),
syn::type_list<>(), num_blocks,
block_precisions.get_const_data(),
block_pointers.get_const_data(), blocks.get_const_data(),
storage_scheme, b->get_const_values() + col,
b->get_stride(), x->get_values() + col, x->get_stride());
select_apply(
compiled_kernels(),
[&](int compiled_block_size) {
return max_block_size <= compiled_block_size;
},
syn::value_list<int, config::min_warps_per_block>(),
syn::type_list<>(), num_blocks, block_precisions.get_const_data(),
block_pointers.get_const_data(), blocks.get_const_data(),
storage_scheme, b->get_const_values() + col, b->get_stride(),
x->get_values() + col, x->get_stride());
}
}

Expand Down
3 changes: 2 additions & 1 deletion examples/ginkgo-overhead/ginkgo-overhead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <iostream>


[[noreturn]] void print_usage_and_exit(const char *name) {
[[noreturn]] void print_usage_and_exit(const char *name)
{
std::cerr << "Usage: " << name << " [NUM_ITERS]" << std::endl;
std::exit(-1);
}
Expand Down
16 changes: 8 additions & 8 deletions hip/factorization/par_ilut_spgeam_kernel.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ void add_candidates(std::shared_ptr<const DefaultExecutor> exec,
auto total_nnz =
lu->get_num_stored_elements() + a->get_num_stored_elements();
auto total_nnz_per_row = total_nnz / num_rows;
select_add_candidates(compiled_kernels(),
[&](int compiled_subwarp_size) {
return total_nnz_per_row <=
compiled_subwarp_size ||
compiled_subwarp_size == config::warp_size;
},
syn::value_list<int>(), syn::type_list<>(), exec, lu,
a, l, u, l_new, u_new);
select_add_candidates(
compiled_kernels(),
[&](int compiled_subwarp_size) {
return total_nnz_per_row <= compiled_subwarp_size ||
compiled_subwarp_size == config::warp_size;
},
syn::value_list<int>(), syn::type_list<>(), exec, lu, a, l, u, l_new,
u_new);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
Expand Down
40 changes: 21 additions & 19 deletions hip/matrix/csr_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,15 +651,16 @@ void advanced_spgemm(std::shared_ptr<const HipExecutor> exec,

auto total_nnz = c_nnz + d->get_num_stored_elements();
auto nnz_per_row = total_nnz / m;
select_spgeam(spgeam_kernels(),
[&](int compiled_subwarp_size) {
return compiled_subwarp_size >= nnz_per_row ||
compiled_subwarp_size == config::warp_size;
},
syn::value_list<int>(), syn::type_list<>(), exec,
alpha->get_const_values(), c_tmp_row_ptrs, c_tmp_col_idxs,
c_tmp_vals, beta->get_const_values(), d_row_ptrs,
d_col_idxs, d_vals, c);
select_spgeam(
spgeam_kernels(),
[&](int compiled_subwarp_size) {
return compiled_subwarp_size >= nnz_per_row ||
compiled_subwarp_size == config::warp_size;
},
syn::value_list<int>(), syn::type_list<>(), exec,
alpha->get_const_values(), c_tmp_row_ptrs, c_tmp_col_idxs,
c_tmp_vals, beta->get_const_values(), d_row_ptrs, d_col_idxs,
d_vals, c);
} else {
GKO_NOT_IMPLEMENTED;
}
Expand All @@ -680,16 +681,17 @@ void spgeam(std::shared_ptr<const DefaultExecutor> exec,
auto total_nnz =
a->get_num_stored_elements() + b->get_num_stored_elements();
auto nnz_per_row = total_nnz / a->get_size()[0];
select_spgeam(spgeam_kernels(),
[&](int compiled_subwarp_size) {
return compiled_subwarp_size >= nnz_per_row ||
compiled_subwarp_size == config::warp_size;
},
syn::value_list<int>(), syn::type_list<>(), exec,
alpha->get_const_values(), a->get_const_row_ptrs(),
a->get_const_col_idxs(), a->get_const_values(),
beta->get_const_values(), b->get_const_row_ptrs(),
b->get_const_col_idxs(), b->get_const_values(), c);
select_spgeam(
spgeam_kernels(),
[&](int compiled_subwarp_size) {
return compiled_subwarp_size >= nnz_per_row ||
compiled_subwarp_size == config::warp_size;
},
syn::value_list<int>(), syn::type_list<>(), exec,
alpha->get_const_values(), a->get_const_row_ptrs(),
a->get_const_col_idxs(), a->get_const_values(),
beta->get_const_values(), b->get_const_row_ptrs(),
b->get_const_col_idxs(), b->get_const_values(), c);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(GKO_DECLARE_CSR_SPGEAM_KERNEL);
Expand Down
18 changes: 9 additions & 9 deletions hip/preconditioner/jacobi_generate_kernel.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ void generate(std::shared_ptr<const HipExecutor> exec,
{
components::fill_array(exec, blocks.get_data(), blocks.get_num_elems(),
zero<ValueType>());
select_generate(compiled_kernels(),
[&](int compiled_block_size) {
return max_block_size <= compiled_block_size;
},
syn::value_list<int, config::min_warps_per_block>(),
syn::type_list<>(), system_matrix, accuracy,
blocks.get_data(), storage_scheme, conditioning.get_data(),
block_precisions.get_data(),
block_pointers.get_const_data(), num_blocks);
select_generate(
compiled_kernels(),
[&](int compiled_block_size) {
return max_block_size <= compiled_block_size;
},
syn::value_list<int, config::min_warps_per_block>(), syn::type_list<>(),
system_matrix, accuracy, blocks.get_data(), storage_scheme,
conditioning.get_data(), block_precisions.get_data(),
block_pointers.get_const_data(), num_blocks);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
Expand Down
20 changes: 10 additions & 10 deletions hip/preconditioner/jacobi_simple_apply_kernel.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,16 @@ void simple_apply(
{
// TODO: write a special kernel for multiple RHS
for (size_type col = 0; col < b->get_size()[1]; ++col) {
select_apply(compiled_kernels(),
[&](int compiled_block_size) {
return max_block_size <= compiled_block_size;
},
syn::value_list<int, config::min_warps_per_block>(),
syn::type_list<>(), num_blocks,
block_precisions.get_const_data(),
block_pointers.get_const_data(), blocks.get_const_data(),
storage_scheme, b->get_const_values() + col,
b->get_stride(), x->get_values() + col, x->get_stride());
select_apply(
compiled_kernels(),
[&](int compiled_block_size) {
return max_block_size <= compiled_block_size;
},
syn::value_list<int, config::min_warps_per_block>(),
syn::type_list<>(), num_blocks, block_precisions.get_const_data(),
block_pointers.get_const_data(), blocks.get_const_data(),
storage_scheme, b->get_const_values() + col, b->get_stride(),
x->get_values() + col, x->get_stride());
}
}

Expand Down
64 changes: 32 additions & 32 deletions omp/factorization/par_ict_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,38 +163,38 @@ void add_candidates(std::shared_ptr<const DefaultExecutor> exec,
IndexType l_old_begin;
IndexType l_old_end;
};
abstract_spgeam(a, llt,
[&](IndexType row) {
row_state state{};
state.l_new_nz = l_new_row_ptrs[row];
state.l_old_begin = l_row_ptrs[row];
state.l_old_end = l_row_ptrs[row + 1];
return state;
},
[&](IndexType row, IndexType col, ValueType a_val,
ValueType llt_val, row_state &state) {
auto r_val = a_val - llt_val;
// load matching entry of L
auto l_col = checked_load(l_col_idxs, state.l_old_begin,
state.l_old_end, sentinel);
auto l_val =
checked_load(l_vals, state.l_old_begin,
state.l_old_end, zero<ValueType>());
// load diagonal entry of L
auto diag = l_vals[l_row_ptrs[col + 1] - 1];
// if there is already an entry present, use that
// instead.
auto out_val = l_col == col ? l_val : r_val / diag;
// store output entries
if (row >= col) {
l_new_col_idxs[state.l_new_nz] = col;
l_new_vals[state.l_new_nz] = out_val;
state.l_new_nz++;
}
// advance entry of L if we used it
state.l_old_begin += (l_col == col);
},
[](IndexType, row_state) {});
abstract_spgeam(
a, llt,
[&](IndexType row) {
row_state state{};
state.l_new_nz = l_new_row_ptrs[row];
state.l_old_begin = l_row_ptrs[row];
state.l_old_end = l_row_ptrs[row + 1];
return state;
},
[&](IndexType row, IndexType col, ValueType a_val, ValueType llt_val,
row_state &state) {
auto r_val = a_val - llt_val;
// load matching entry of L
auto l_col = checked_load(l_col_idxs, state.l_old_begin,
state.l_old_end, sentinel);
auto l_val = checked_load(l_vals, state.l_old_begin,
state.l_old_end, zero<ValueType>());
// load diagonal entry of L
auto diag = l_vals[l_row_ptrs[col + 1] - 1];
// if there is already an entry present, use that
// instead.
auto out_val = l_col == col ? l_val : r_val / diag;
// store output entries
if (row >= col) {
l_new_col_idxs[state.l_new_nz] = col;
l_new_vals[state.l_new_nz] = out_val;
state.l_new_nz++;
}
// advance entry of L if we used it
state.l_old_begin += (l_col == col);
},
[](IndexType, row_state) {});
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
Expand Down
22 changes: 11 additions & 11 deletions omp/factorization/par_ilut_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,17 +368,17 @@ void add_candidates(std::shared_ptr<const DefaultExecutor> exec,
auto u_new_row_ptrs = u_new->get_row_ptrs();
constexpr auto sentinel = std::numeric_limits<IndexType>::max();
// count nnz
abstract_spgeam(a, lu,
[](IndexType) { return std::pair<IndexType, IndexType>{}; },
[](IndexType row, IndexType col, ValueType, ValueType,
std::pair<IndexType, IndexType> &nnzs) {
nnzs.first += col <= row;
nnzs.second += col >= row;
},
[&](IndexType row, std::pair<IndexType, IndexType> nnzs) {
l_new_row_ptrs[row] = nnzs.first;
u_new_row_ptrs[row] = nnzs.second;
});
abstract_spgeam(
a, lu, [](IndexType) { return std::pair<IndexType, IndexType>{}; },
[](IndexType row, IndexType col, ValueType, ValueType,
std::pair<IndexType, IndexType> &nnzs) {
nnzs.first += col <= row;
nnzs.second += col >= row;
},
[&](IndexType row, std::pair<IndexType, IndexType> nnzs) {
l_new_row_ptrs[row] = nnzs.first;
u_new_row_ptrs[row] = nnzs.second;
});

components::prefix_sum(exec, l_new_row_ptrs, num_rows + 1);
components::prefix_sum(exec, u_new_row_ptrs, num_rows + 1);
Expand Down
17 changes: 9 additions & 8 deletions omp/matrix/csr_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,15 @@ void spgeam(std::shared_ptr<const OmpExecutor> exec,
auto c_col_idxs = c_col_idxs_array.get_data();
auto c_vals = c_vals_array.get_data();

abstract_spgeam(a, b, [&](IndexType row) { return c_row_ptrs[row]; },
[&](IndexType, IndexType col, ValueType a_val,
ValueType b_val, IndexType &nz) {
c_vals[nz] = valpha * a_val + vbeta * b_val;
c_col_idxs[nz] = col;
++nz;
},
[](IndexType, IndexType) {});
abstract_spgeam(
a, b, [&](IndexType row) { return c_row_ptrs[row]; },
[&](IndexType, IndexType col, ValueType a_val, ValueType b_val,
IndexType &nz) {
c_vals[nz] = valpha * a_val + vbeta * b_val;
c_col_idxs[nz] = col;
++nz;
},
[](IndexType, IndexType) {});
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(GKO_DECLARE_CSR_SPGEAM_KERNEL);
Expand Down
Loading

0 comments on commit 2c1c1b5

Please sign in to comment.