Skip to content

Commit

Permalink
Applying clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
lucbv committed Mar 6, 2024
1 parent 9b63db8 commit a8c128f
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions perf_test/sparse/KokkosSparse_spmv_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ struct spmv_parameters {
std::string tpl;

spmv_parameters(const int N_)
: N(N_), offset(0), numvecs(1), mode(""), filename(""), alg(""), tpl("") {}
: N(N_),
offset(0),
numvecs(1),
mode(""),
filename(""),
alg(""),
tpl("") {}
};

void print_options() {
Expand All @@ -51,10 +57,10 @@ void print_options() {
std::cerr << perf_test::list_common_options();

std::cerr << "\t[Optional] --mode :: whether to run a suite of "
<< "automated test or manually define one (auto, manual)"
<< std::endl;
<< "automated test or manually define one (auto, manual)"
<< std::endl;
std::cerr << "\t[Optional] --repeat :: how many times to repeat overall "
<< "test" << std::endl;
<< "test" << std::endl;
std::cerr << " -n [N] :: generate a semi-random banded (band size "
"0.01xN)\n"
"NxN matrix with average of 10 entries per row."
Expand All @@ -66,13 +72,13 @@ void print_options() {
"alg, a TPL can be used (cusparse, rocsparse, MKL)"
<< std::endl;
std::cerr << " -f [file] : Read in Matrix Market formatted text file"
<< " 'file'." << std::endl;
<< " 'file'." << std::endl;
std::cerr << " --offset [O] : Subtract O from every index.\n"
<< " Useful in case the matrix market file is "
"not 0 based."
<< std::endl;
std::cerr << " --num_vecs : The number of vectors stored in X and Y"
<< std::endl;
<< std::endl;
} // print_options

void parse_inputs(int argc, char** argv, spmv_parameters& params) {
Expand Down Expand Up @@ -118,7 +124,7 @@ void run_spmv(benchmark::State& state, const spmv_parameters& inputs) {
KokkosSparse::CrsMatrix<double, int, execution_space, void, int>;
using mv_type = Kokkos::View<double**, execution_space>;
using handle_t =
KokkosSparse::SPMVHandle<execution_space, matrix_type, mv_type, mv_type>;
KokkosSparse::SPMVHandle<execution_space, matrix_type, mv_type, mv_type>;

KokkosSparse::SPMVAlgorithm spmv_alg;
if ((inputs.alg == "default") || (inputs.alg == "")) {
Expand Down Expand Up @@ -178,14 +184,15 @@ int main(int argc, char** argv) {
spmv_parameters inputs(100000);
parse_inputs(argc, argv, inputs);

if( (inputs.mode == "") || (inputs.mode == "auto")) {
for(int n : {10000, 20000, 40000, 100000, 250000, 1000000}) {
for(int nv : {1, 2, 3, 4, 10}) {
inputs.N = n;
inputs.numvecs = nv;
KokkosKernelsBenchmark::register_benchmark_real_time(
bench_name.c_str(), run_spmv<Kokkos::DefaultExecutionSpace>, {"n", "nv"},
{inputs.N, inputs.numvecs}, common_params.repeat, inputs);
if ((inputs.mode == "") || (inputs.mode == "auto")) {
for (int n : {10000, 20000, 40000, 100000, 250000, 1000000}) {
for (int nv : {1, 2, 3, 4, 10}) {
inputs.N = n;
inputs.numvecs = nv;
KokkosKernelsBenchmark::register_benchmark_real_time(
bench_name.c_str(), run_spmv<Kokkos::DefaultExecutionSpace>,
{"n", "nv"}, {inputs.N, inputs.numvecs}, common_params.repeat,
inputs);
}
}
} else {
Expand Down

0 comments on commit a8c128f

Please sign in to comment.