From a52ba02ad66a04869c8757f1676ac031d467ea88 Mon Sep 17 00:00:00 2001 From: Carl Pearson Date: Tue, 5 Dec 2023 10:11:23 -0700 Subject: [PATCH] gemm3 perf test: user CUDA, SYCL, or HIP device for kokkos:initialize --- ...osBlas3_gemm_standalone_perf_test_benchmark.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/perf_test/blas/blas3/KokkosBlas3_gemm_standalone_perf_test_benchmark.cpp b/perf_test/blas/blas3/KokkosBlas3_gemm_standalone_perf_test_benchmark.cpp index d617ffcdf3..cd7f194071 100644 --- a/perf_test/blas/blas3/KokkosBlas3_gemm_standalone_perf_test_benchmark.cpp +++ b/perf_test/blas/blas3/KokkosBlas3_gemm_standalone_perf_test_benchmark.cpp @@ -142,7 +142,19 @@ void run(const blas3_gemm_params& params) { int main(int argc, char** argv) { const auto params = blas3_gemm_params::get_params(argc, argv); const int num_threads = params.use_openmp; - const int device_id = params.use_cuda - 1; + + // the common parameter parser takes the requested device ID and + // adds 1 to it (e.g. --cuda 0 -> params.use_cuda = 1) + // this is presumably so that 0 can be a sentinel value, + // even though device ID 0 is valid + // here, we use CUDA, SYCL, or HIP, whichever is set first, to + // choose which device Kokkos should initialize on + // or -1, for no such selection + const int device_id = + params.use_cuda + ? params.use_cuda - 1 + : (params.use_sycl ? params.use_sycl - 1 + : (params.use_hip ? params.use_hip - 1 : -1)); Kokkos::initialize(Kokkos::InitializationSettings() .set_num_threads(num_threads)