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

Add executor get_description function #1615

Merged
merged 5 commits into from
Jun 29, 2024
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
2 changes: 1 addition & 1 deletion benchmark/blas/blas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ Parameters for a benchmark case are:
initialize_argument_parsing(&argc, &argv, header, format);

std::string extra_information = "The operations are " + FLAGS_operations;
print_general_information(extra_information);
auto exec = executor_factory.at(FLAGS_executor)(FLAGS_gpu_timer);
print_general_information(extra_information, exec);

auto test_cases = json::parse(get_input_stream());

Expand Down
6 changes: 3 additions & 3 deletions benchmark/blas/distributed/multi_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ Parameters for a benchmark case are:
std::string format = Generator::get_example_config();
initialize_argument_parsing(&argc, &argv, header, format, do_print);

auto exec = executor_factory_mpi.at(FLAGS_executor)(comm.get());

if (do_print) {
std::string extra_information =
"The operations are " + FLAGS_operations;
print_general_information(extra_information);
print_general_information(extra_information, exec);
}

auto exec = executor_factory_mpi.at(FLAGS_executor)(comm.get());

std::string json_input = broadcast_json_input(get_input_stream(), comm);
auto test_cases = json::parse(json_input);

Expand Down
2 changes: 1 addition & 1 deletion benchmark/conversion/conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ int main(int argc, char* argv[])

std::string extra_information =
std::string() + "The formats are " + FLAGS_formats;
print_general_information(extra_information);

auto exec = executor_factory.at(FLAGS_executor)(FLAGS_gpu_timer);
print_general_information(extra_information, exec);
auto formats = split(FLAGS_formats, ',');

auto test_cases = json::parse(get_input_stream());
Expand Down
2 changes: 1 addition & 1 deletion benchmark/preconditioner/preconditioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ int main(int argc, char* argv[])

std::string extra_information =
"Running with preconditioners: " + FLAGS_preconditioners;
print_general_information(extra_information);

auto exec = get_executor(FLAGS_gpu_timer);
print_general_information(extra_information, exec);
auto& engine = get_engine();

auto preconditioners = split(FLAGS_preconditioners, ',');
Expand Down
2 changes: 1 addition & 1 deletion benchmark/solver/distributed/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int main(int argc, char* argv[])
ss_rel_res_goal.str() + "\nThe number of right hand sides is " +
std::to_string(FLAGS_nrhs);
if (do_print) {
print_general_information(extra_information);
print_general_information(extra_information, exec);
}

std::set<std::string> supported_solvers = {"cg", "fcg", "cgs", "bicgstab",
Expand Down
2 changes: 1 addition & 1 deletion benchmark/solver/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ int main(int argc, char* argv[])
std::to_string(FLAGS_max_iters) + " iterations and residual goal of " +
ss_rel_res_goal.str() + "\nThe number of right hand sides is " +
std::to_string(FLAGS_nrhs);
print_general_information(extra_information);

auto exec = get_executor(FLAGS_gpu_timer);
print_general_information(extra_information, exec);

json test_cases;
if (!FLAGS_overhead) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/sparse_blas/sparse_blas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ int main(int argc, char* argv[])
auto test_cases = json::parse(get_input_stream());

std::string extra_information = "The operations are " + FLAGS_operations;
print_general_information(extra_information);
print_general_information(extra_information, exec);

run_test_cases(SparseBlasBenchmark{}, exec,
get_timer(exec, FLAGS_gpu_timer), test_cases);
Expand Down
6 changes: 3 additions & 3 deletions benchmark/spmv/distributed/spmv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ int main(int argc, char* argv[])
initialize_argument_parsing_matrix(&argc, &argv, header, format, "",
do_print);

auto exec = executor_factory_mpi.at(FLAGS_executor)(comm.get());

if (do_print) {
std::string extra_information =
"The formats are [" + FLAGS_local_formats + "]x[" +
FLAGS_non_local_formats + "]\n" +
"The number of right hand sides is " + std::to_string(FLAGS_nrhs);
print_general_information(extra_information);
print_general_information(extra_information, exec);
}

auto exec = executor_factory_mpi.at(FLAGS_executor)(comm.get());

auto local_formats = split(FLAGS_local_formats, ',');
auto non_local_formats = split(FLAGS_non_local_formats, ',');
std::vector<std::string> formats;
Expand Down
3 changes: 2 additions & 1 deletion benchmark/spmv/spmv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ int main(int argc, char* argv[])
std::string extra_information = "The formats are " + FLAGS_formats +
"\nThe number of right hand sides is " +
std::to_string(FLAGS_nrhs);
print_general_information(extra_information);

auto exec = executor_factory.at(FLAGS_executor)(FLAGS_gpu_timer);

print_general_information(extra_information, exec);

auto test_cases = json::parse(get_input_stream());

run_test_cases(SpmvBenchmark<Generator>{Generator{}, split(FLAGS_formats)},
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/blas.profile.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
The operations are copy,axpy,scal
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/blas.simple.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The operations are copy,axpy,scal
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/conversion.all.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The formats are coo,csr,ell,sellp,hybrid
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/conversion.matrix.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The formats are coo,csr
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/conversion.profile.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
The formats are coo,csr
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/conversion.simple.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The formats are coo,csr
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/distributed_solver.matrix.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running cg with 1000 iterations and residual goal of 1.000000e-06
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/distributed_solver.profile.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running cg with 1000 iterations and residual goal of 1.000000e-06
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/distributed_solver.simple.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running cg with 1000 iterations and residual goal of 1.000000e-06
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
The operations are copy,axpy,scal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The operations are copy,axpy,scal
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/preconditioner.matrix.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
Running with preconditioners: none
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/preconditioner.precond.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
Running with preconditioners: jacobi
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/preconditioner.profile.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running with preconditioners: none
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/preconditioner.reordered.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
Running with preconditioners: none
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/preconditioner.simple.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
Running with preconditioners: none
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/solver.matrix.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running cg with 1000 iterations and residual goal of 1.000000e-06
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/solver.profile.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running cg with 1000 iterations and residual goal of 1.000000e-06
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/solver.reordered.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running cg with 1000 iterations and residual goal of 1.000000e-06
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/solver.simple.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running cg with 1000 iterations and residual goal of 1.000000e-06
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/sparse_blas.matrix.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The operations are transpose
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/sparse_blas.profile.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
The operations are transpose
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/sparse_blas.reordered.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The operations are symbolic_cholesky
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/sparse_blas.simple.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The operations are transpose
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/spmv.matrix.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The formats are coo
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/spmv.profile.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
The formats are coo
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/spmv.reordered.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The formats are coo
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/spmv.simple.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The formats are coo
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/spmv_distributed.profile.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
The formats are [csr]x[csr]
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/spmv_distributed.simple.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Running on reference(0)
Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The formats are [csr]x[csr]
Expand Down
6 changes: 3 additions & 3 deletions benchmark/utils/general.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ void initialize_argument_parsing(int* argc, char** argv[], std::string& header,
*
* @param extra describes benchmark specific extra parameters to output
*/
void print_general_information(const std::string& extra)
void print_general_information(const std::string& extra,
std::shared_ptr<const gko::Executor> exec)
{
std::clog << gko::version_info::get() << std::endl
<< "Running on " << FLAGS_executor << "(" << FLAGS_device_id
<< ")\n"
<< "Running on " << exec->get_description() << std::endl
<< "Running with " << FLAGS_warmup << " warm iterations and ";
if (FLAGS_repetitions == "auto") {
std::clog << "adaptively determined repetititions with "
Expand Down
3 changes: 3 additions & 0 deletions core/device_hooks/cuda_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ scoped_device_id_guard CudaExecutor::get_scoped_device_id_guard() const
GKO_NOT_COMPILED(cuda);


std::string CudaExecutor::get_description() const GKO_NOT_COMPILED(cuda);


std::string CudaError::get_error(int64)
{
return "ginkgo CUDA module is not compiled";
Expand Down
3 changes: 3 additions & 0 deletions core/device_hooks/dpcpp_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ scoped_device_id_guard DpcppExecutor::get_scoped_device_id_guard() const
GKO_NOT_COMPILED(dpcpp);


std::string DpcppExecutor::get_description() const GKO_NOT_COMPILED(dpcpp);


int DpcppExecutor::get_num_devices(std::string) { return 0; }


Expand Down
3 changes: 3 additions & 0 deletions core/device_hooks/hip_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ scoped_device_id_guard HipExecutor::get_scoped_device_id_guard() const
GKO_NOT_COMPILED(hip);


std::string HipExecutor::get_description() const GKO_NOT_COMPILED(hip);


std::string HipError::get_error(int64)
{
return "ginkgo HIP module is not compiled";
Expand Down
3 changes: 3 additions & 0 deletions core/device_hooks/omp_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ scoped_device_id_guard::scoped_device_id_guard(const OmpExecutor* exec,
GKO_NOT_COMPILED(omp);


std::string OmpExecutor::get_description() const GKO_NOT_COMPILED(omp);


int OmpExecutor::get_num_omp_threads() { return 1; }


Expand Down
Loading