Skip to content

Commit ed645de

Browse files
committed
Make it run on cuda
1 parent c4491f6 commit ed645de

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

test/source/kitgenbench.cpp

+4-17
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <sys/types.h>
66

77
#include <alpaka/core/Common.hpp>
8+
#include <cstdint>
89
#include <string>
910

1011
#include "nlohmann/json.hpp"
@@ -121,10 +122,8 @@ TEST_CASE("Single size malloc") {
121122

122123
namespace setups::mallocFreeManySize {
123124

124-
std::vector<std::uint32_t> ALLOCATION_SIZES
125-
= {16U, 256U, 1024U, 16U, 16U, 256U, 16U, 1024U, 1024U};
126125
struct MallocFreeRecipe {
127-
std::vector<std::uint32_t> sizes{ALLOCATION_SIZES};
126+
const std::array<std::uint32_t, 9> sizes{16U, 256U, 1024U, 16U, 16U, 256U, 16U, 1024U, 1024U};
128127
std::uint32_t currentIndex{0U};
129128
void* currentPointer{nullptr};
130129

@@ -155,29 +154,17 @@ namespace setups::mallocFreeManySize {
155154

156155
auto makeInstructionDetails() { return InstructionDetails<MallocFreeRecipe>{}; }
157156

158-
namespace detail {
159-
template <typename T> T unique(T const& values) {
160-
// It's a pity but the following are algorithms and not "adaptors", so the pipe operator
161-
// doesn't work.
162-
T tmp = values;
163-
std::ranges::sort(tmp);
164-
const auto [new_end, old_end] = std::ranges::unique(tmp);
165-
return {std::begin(tmp), new_end};
166-
}
167-
} // namespace detail
168-
169157
auto composeSetup() {
170158
return composeSetup("mallocFreeManySize", makeExecutionDetails(), makeInstructionDetails(),
171159
{{"what it does",
172160
"This setup runs through a given vector of allocation sizes, allocating "
173161
"and deallocating each size one after another."},
174-
{"number of allocations", ALLOCATION_SIZES.size()},
175-
{"available allocation sizes [bytes]", detail::unique(ALLOCATION_SIZES)}});
162+
{"number of allocations", MallocFreeRecipe{}.sizes.size()}});
176163
}
177164

178165
} // namespace setups::mallocFreeManySize
179166

180167
TEST_CASE("Malloc free many size") {
181168
auto setup = setups::mallocFreeManySize::composeSetup();
182-
auto benchmarkReports = runBenchmarks(setup);
169+
auto benchmarkReports = kitgenbench::runBenchmarks(setup);
183170
}

0 commit comments

Comments
 (0)