Skip to content

Commit

Permalink
Add initial version of large array sort helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
alliepiper committed Feb 15, 2024
1 parent 317053b commit 35b5b16
Show file tree
Hide file tree
Showing 4 changed files with 562 additions and 109 deletions.
4 changes: 4 additions & 0 deletions cub/test/c2h/checked_allocator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

#include <new>

//#define DEBUG_CHECKED_ALLOC_FAILURE

namespace c2h
{
namespace detail
Expand All @@ -56,6 +58,7 @@ inline cudaError_t check_free_device_memory(std::size_t bytes)
constexpr std::size_t padding = 16 * 1024 * 1024; // 16 MiB
if (free_bytes < (bytes + padding))
{
#ifdef DEBUG_CHECKED_ALLOC_FAILURE
const double total_GiB = static_cast<double>(total_bytes) / (1024 * 1024 * 1024);
const double free_GiB = static_cast<double>(free_bytes) / (1024 * 1024 * 1024);
const double requested_GiB = static_cast<double>(bytes) / (1024 * 1024 * 1024);
Expand All @@ -66,6 +69,7 @@ inline cudaError_t check_free_device_memory(std::size_t bytes)
<< "Free device mem: " << free_GiB << " GiB\n" //
<< "Requested device mem: " << requested_GiB << " GiB\n" //
<< "Padded device mem: " << padded_GiB << " GiB\n";
#endif
return cudaErrorMemoryAllocation;
}

Expand Down
Loading

0 comments on commit 35b5b16

Please sign in to comment.