Skip to content

Commit

Permalink
Made maximum contingent on precision
Browse files Browse the repository at this point in the history
- 1GiB for 32 bit
- 16 GiB for 64 bit
- removed comparison of NULL with Ox0
- reapplied clang-format
  • Loading branch information
bjoo committed May 24, 2024
1 parent cc00fb4 commit cd0a2eb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions benchmarks/async_alloc/async_alloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ std::vector<std::pair<size_t, double>> inner_loop_times;
std::pair<double, double> test(bool up) {
int iters = 50;
size_t minimum = 8 / sizeof(float); // 64K
size_t maximum = (16l * 1024l * 1024l * 1024l) / sizeof(float);

size_t gb = 1024 * 1024 * 1024 / sizeof(float); // number of floats per GiB
size_t maximum = gb; // on 32 bit, we make 1GiB the max

// On 64-bit we make 16 GiB the max
if constexpr (sizeof(size_t) == 8) maximum *= 16;

std::vector<size_t> sizes;
if (up) {
Expand Down Expand Up @@ -64,7 +69,7 @@ int main(int argc, char *argv[]) {
char *env_string = getenv("KOKKOS_CUDA_MEMPOOL_SIZE");
std::cout << "Async Malloc Benchmark: KOKKOS_CUDA_MEMPOOL_SIZE is ";

if (env_string == nullptr || env_string == 0x0)
if (env_string == nullptr)
std::cout << "not set,";
else
std::cout << " " << env_string << ",";
Expand Down

0 comments on commit cd0a2eb

Please sign in to comment.