13 #if __has_include(<span>) 
   29         typename Mapping::ArrayExtents::value_type Granularity = 1,
 
   30         typename TCountType = std::size_t>
 
   33         static_assert(!hasAnyComputedField<Mapping>, 
"Heatmaps for computed mappings are not implemented.");
 
   36         using size_type = 
typename Mapping::ArrayExtents::value_type;
 
   37         using ArrayIndex = 
typename Mapping::ArrayExtents::Index;
 
   41         inline static constexpr std::size_t 
granularity = Granularity;
 
   47         inline static constexpr std::size_t 
blobCount = Mapping::blobCount * 2;
 
   52         explicit Heatmap(Mapping mapping) : Mapping(std::move(mapping))
 
   56         template<
typename... Args>
 
   61 #if defined(__cpp_lib_concepts) && defined(__NVCOMPILER) 
   65             return static_cast<const Mapping&
>(*this).extents();
 
   68         using Mapping::extents;
 
   72         constexpr 
auto blobSize(size_type blobIndex) 
const -> size_type
 
   74             if(blobIndex < size_type{Mapping::blobCount})
 
   75                 return Mapping::blobSize(blobIndex);
 
   79         template<std::size_t... RecordCoords>
 
   85         template<std::size_t... RecordCoords, 
typename Blobs>
 
   90                 !std::is_const_v<Blobs>,
 
   91                 "Cannot access (even just reading) data through Heatmap from const blobs/view, since we need to write " 
   94             const auto [nr, offset] = Mapping::blobNrAndOffset(ai, rc);
 
   98             for(size_type i = 0; i < 
divCeil(size_type{
sizeof(Type)}, Granularity); i++)
 
  102             return reinterpret_cast<CopyConst<std::remove_reference_t<decltype(blobs[nr][offset])
>, Type>&>(
 
  110             assert(forBlobI < Mapping::blobCount);
 
  111             return divCeil(Mapping::blobSize(forBlobI), Granularity);
 
  115         template<
typename Blobs>
 
  122 #ifdef __cpp_lib_span 
  123         template<
typename Blobs>
 
  124         auto blockHits(size_type forBlobI, 
Blobs& blobs) 
const -> std::span<CopyConst<Blobs, CountType>>
 
  131         static auto trimBlobRight(
const CountType* bh, std::size_t size)
 
  133             while(size > 0 && bh[size - 1] == 0)
 
  143         template<
typename Blobs, 
typename OStream>
 
  148             std::size_t wrapAfterBlocks = 64)
 const 
  150             for(std::size_t i = 0; i < Mapping::blobCount; i++)
 
  155                     size = trimBlobRight(bh, size);
 
  156                 for(size_type j = 0; j < size; j++)
 
  159                         os << (j % wrapAfterBlocks == 0 ? 
'\n' : 
' ');
 
  168         template<
typename Blobs, 
typename OStream>
 
  173             std::size_t afterBlobRoundUpTo = 64)
 const 
  175             for(std::size_t i = 0; i < Mapping::blobCount; i++)
 
  180                     size = trimBlobRight(bh, size);
 
  181                 os.write(
reinterpret_cast<const char*
>(bh), size * 
sizeof(
CountType));
 
  186                     os.write(
reinterpret_cast<const char*
>(&zero), 
sizeof(
CountType));
 
  194 file = '${1:-plot.bin}' 
  197 set x2tics autofreq 32 
  198 set yrange [] reverse 
  199 set link x2; set link y2 
  201 plot file matrix with image pixels axes x2y1 
  209 file = '${1:-plot.bin}' 
  210 rowlength = '${2:-64}' 
  211 maxrows = '${3:-all}' 
  212 format = '${4:-%uint64}' 
  214 counts = system('stat -c "%s" ${1:-plot.bin}')/8 
  215 rows = counts/rowlength 
  216 rows = maxrows eq 'all' ? rows : (rows < maxrows ? rows : maxrows) 
  219 set x2tics autofreq 32 
  220 set yrange [] reverse 
  221 set link x2; set link y2 
  223 plot file binary array=(rowlength,rows) format=format with image pixels axes x2y1 
  229     template<
typename Mapping>
 
  233     template<
typename Mapping, 
typename Mapping::ArrayExtents::value_type Granularity, 
typename CountType>
 
  234     inline constexpr 
bool isHeatmap<Heatmap<Mapping, Granularity, CountType>> = 
true;
 
#define LLAMA_BEGIN_SUPPRESS_HOST_DEVICE_WARNING
 
#define LLAMA_SUPPRESS_HOST_DEVICE_WARNING
 
#define LLAMA_FN_HOST_ACC_INLINE
 
#define LLAMA_END_SUPPRESS_HOST_DEVICE_WARNING
 
void atomicInc(CountType &i)
 
ArrayExtents(Args...) -> ArrayExtents< typename internal::IndexTypeFromArgs< std::size_t, Args... >::type,(Args{}, dyn)... >
 
constexpr auto divCeil(Integral a, Integral b) -> Integral
Returns the ceiling of a / b.
 
std::conditional_t< std::is_const_v< FromT >, const ToT, ToT > CopyConst
Alias for ToT, adding const if FromT is const qualified.
 
constexpr auto roundUpToMultiple(Integral n, Integral mult) -> Integral
Returns the integral n rounded up to be a multiple of mult.
 
typename internal::GetTypeImpl< RecordDim, RecordCoordOrTags... >::type GetType
 
static constexpr std::size_t granularity
 
typename Mapping::RecordDim RecordDim
 
typename Mapping::ArrayExtents ArrayExtents
 
constexpr Heatmap()=default
 
auto compute(ArrayIndex ai, RecordCoord< RecordCoords... > rc, Blobs &blobs) const -> decltype(auto)
 
void writeGnuplotDataFileAscii(const Blobs &blobs, OStream &&os, bool trimEnd=true, std::size_t wrapAfterBlocks=64) const
 
static constexpr std::string_view gnuplotScriptAscii
 
constexpr auto blobSize(size_type blobIndex) const -> size_type
 
void writeGnuplotDataFileBinary(const Blobs &blobs, OStream &&os, bool trimEnd=true, std::size_t afterBlobRoundUpTo=64) const
 
auto blockHitsPtr(size_type forBlobI, Blobs &blobs) const -> CopyConst< Blobs, CountType > *
 
static constexpr std::size_t blobCount
 
static constexpr auto isComputed(RecordCoord< RecordCoords... >)
 
Heatmap(Args &&... innerArgs)
 
auto blockHitsSize(size_type forBlobI) const -> size_type
 
static constexpr std::string_view gnuplotScriptBinary