-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathchai_arraymanager_benchmarks.cpp
53 lines (50 loc) · 1.73 KB
/
chai_arraymanager_benchmarks.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016-24, Lawrence Livermore National Security, LLC and CHAI
// project contributors. See the CHAI LICENSE file for details.
//
// SPDX-License-Identifier: BSD-3-Clause
//////////////////////////////////////////////////////////////////////////////
#include <climits>
#include "benchmark/benchmark.h"
#include "chai/ArrayManager.hpp"
// void benchmark_arraymanager_alloc_default(benchmark::State& state) {
// chai::ArrayManager* manager = chai::ArrayManager::getInstance();
//
// while (state.KeepRunning()) {
// void* ptr = manager->allocate<char>(state.range(0));
// manager->free(ptr);
// }
//
// state.SetItemsProcessed(state.iterations() * state.range(0));
// }
//
// void benchmark_arraymanager_alloc_cpu(benchmark::State& state) {
// chai::ArrayManager* manager = chai::ArrayManager::getInstance();
//
// while (state.KeepRunning()) {
// void* ptr = manager->allocate<char>(state.range(0), chai::CPU);
// manager->free(ptr);
// }
//
// state.SetItemsProcessed(state.iterations() * state.range(0));
//
// }
//
// BENCHMARK(benchmark_arraymanager_alloc_default)->Range(1, INT_MAX);
// BENCHMARK(benchmark_arraymanager_alloc_cpu)->Range(1, INT_MAX);
//
// #if defined(CHAI_ENABLE_CUDA)
// void benchmark_arraymanager_alloc_gpu(benchmark::State& state) {
// chai::ArrayManager* manager = chai::ArrayManager::getInstance();
//
// while (state.KeepRunning()) {
// void* ptr = manager->allocate<char>(state.range(0), chai::GPU);
// manager->free(ptr);
// }
//
// state.SetItemsProcessed(state.iterations() * state.range(0));
// }
// BENCHMARK(benchmark_arraymanager_alloc_gpu)->Range(1, INT_MAX);
// #endif
//
BENCHMARK_MAIN();