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..3ca050d7 --- /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 ([[maybe_unused]] 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();