From 3a85daf21949eeec9a5af034cc47b883494bc501 Mon Sep 17 00:00:00 2001 From: Christian Trott Date: Sun, 5 Feb 2023 09:07:21 -0700 Subject: [PATCH 1/2] Adding some basic extents construction benchmark --- benchmarks/CMakeLists.txt | 1 + benchmarks/extents/CMakeLists.txt | 2 ++ benchmarks/extents/extents_perf.cpp | 47 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 benchmarks/extents/CMakeLists.txt create mode 100644 benchmarks/extents/extents_perf.cpp diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 708cc9f3..42ac23df 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -65,6 +65,7 @@ function(mdspan_add_openmp_benchmark EXENAME) endif() endfunction() +add_subdirectory(extents) add_subdirectory(sum) add_subdirectory(matvec) add_subdirectory(copy) diff --git a/benchmarks/extents/CMakeLists.txt b/benchmarks/extents/CMakeLists.txt new file mode 100644 index 00000000..60776db4 --- /dev/null +++ b/benchmarks/extents/CMakeLists.txt @@ -0,0 +1,2 @@ + +mdspan_add_benchmark(extents_perf) diff --git a/benchmarks/extents/extents_perf.cpp b/benchmarks/extents/extents_perf.cpp new file mode 100644 index 00000000..daa977f4 --- /dev/null +++ b/benchmarks/extents/extents_perf.cpp @@ -0,0 +1,47 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER +#include + +#include + +#include "fill.hpp" + +using index_type = int; + +namespace stdex = std::experimental; +_MDSPAN_INLINE_VARIABLE constexpr auto dyn = stdex::dynamic_extent; + +template +void extents_construction(benchmark::State& state, Extents, int R, Args ... args) { + for (auto _ : state) { + double val =0; + for(int r=0; r(), 100000000, 100, 100, 100 +); + +BENCHMARK_CAPTURE( + extents_construction, array_int_3, stdex::dextents(), 100000000, std::array{100, 100, 100} +); + +BENCHMARK_MAIN(); From 8867df487067498518c269699c26dbe90244d194 Mon Sep 17 00:00:00 2001 From: Christian Trott Date: Mon, 16 Oct 2023 11:04:05 -0600 Subject: [PATCH 2/2] Update benchmarks/extents/extents_perf.cpp Co-authored-by: Mark Hoemmen --- benchmarks/extents/extents_perf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/extents/extents_perf.cpp b/benchmarks/extents/extents_perf.cpp index daa977f4..3ca050d7 100644 --- a/benchmarks/extents/extents_perf.cpp +++ b/benchmarks/extents/extents_perf.cpp @@ -26,7 +26,7 @@ _MDSPAN_INLINE_VARIABLE constexpr auto dyn = stdex::dynamic_extent; template void extents_construction(benchmark::State& state, Extents, int R, Args ... args) { - for (auto _ : state) { + for ([[maybe_unused]] auto _ : state) { double val =0; for(int r=0; r