MCPcopy Create free account
hub / github.com/ashvardanian/less_slow.cpp / spread_memory

Function spread_memory

less_slow.cpp:2973–2985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2971
2972template <typename kernel_type_>
2973static void spread_memory(bm::State &state, kernel_type_ kernel, std::size_t align = sizeof(spread_data_t)) {
2974 std::size_t const size = static_cast<std::size_t>(state.range(0));
2975 aligned_array<spread_index_t> indices(size, align);
2976 aligned_array<spread_data_t> first(size, align);
2977 aligned_array<spread_data_t> second(size, align);
2978
2979 std::iota(indices.begin(), indices.begin() + size, 0);
2980 std::random_device random_device;
2981 std::mt19937 generator(random_device());
2982 std::shuffle(indices.begin(), indices.begin() + size, generator);
2983
2984 for (auto _ : state) kernel(first.begin(), indices.begin(), second.begin(), size);
2985}
2986
2987BENCHMARK_CAPTURE(spread_memory, gather_scalar, spread_gather_scalar)
2988 ->Range(1 << 10, 1 << 20)

Callers

nothing calls this directly

Calls 1

beginMethod · 0.45

Tested by

no test coverage detected