MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
maia::collector_memory::unaligned_cell_wise Namespace Reference

Functions

template<class T >
void rowMajor1D (T *&p, void *&base, const MInt Nrows)
 Store 1D variables in row-majow order relative to the start of each cell's memory solver. More...
 
template<class T >
 ATTRIBUTES1 (ATTRIBUTE_NO_AUTOVEC) inline void rowMajor2D(T **&p
 
 for (MInt i=0;i< Nrows;++i)
 

Variables

void *& base = reinterpret_cast<T*>(base) + static_cast<MLong>(1) * Nrows * Ncols
 
void const MInt Nrows
 
void const MInt const MInt Ncols
 

Detailed Description

This namespaces includes helpers for managing collector memory "cell-wise" This is VERY wrong and should not be done. The memory is NOT aligned!

Function Documentation

◆ ATTRIBUTES1()

template<class T >
maia::collector_memory::unaligned_cell_wise::ATTRIBUTES1 ( ATTRIBUTE_NO_AUTOVEC  ) &

◆ for()

maia::collector_memory::unaligned_cell_wise::for ( )

Definition at line 320 of file collector.h.

320 {
321 p[i] = reinterpret_cast<T*>(base) + static_cast<MLong>(1) * i * Ncols;
322 }
int64_t MLong
Definition: maiatypes.h:64
void const MInt const MInt const MInt Ncols
Definition: collector.h:239

◆ rowMajor1D()

template<class T >
void maia::collector_memory::unaligned_cell_wise::rowMajor1D ( T *&  p,
void *&  base,
const MInt  Nrows 
)
inline

NOTE: DO NOT USE THIS, IS VERY BAD FOR PERFORMANCE, ALIGNMENT, REQUIRED MEMORY....

Some cells use the collector as follows:

| ....... collector memory ......... |

|.....| stuff of the cell i | ..... | ^^^^^^^^^^^^^^^^^^^^^ (expanded below) |.....| array_of_floats, array_of_ints, array_of_floats,... of the cell i | ..... |

This means that when you loop over some cell pointer, you don't go linearly through memory but you have random access (bad for performance)

Furthermore: each of the arrays inside each cell needs to be aligned, so the padding you need is not a function of the #of_member_variables but a function of both the #of_cells AND the #of_member_variables -> If a single array is not aligned you need maxNoCells*padding ! (bad for memory)

Definition at line 307 of file collector.h.

307 {
308 // rowMajor1D(p,base,0,Nrows,1); // DO NOT ALIGN -> requires too much memory
309 p = reinterpret_cast<T*>(base);
310 base = reinterpret_cast<void*>(reinterpret_cast<T*>(base) + Nrows);
311}

Variable Documentation

◆ base

maia::collector_memory::unaligned_cell_wise::base = reinterpret_cast<T*>(base) + static_cast<MLong>(1) * Nrows * Ncols

Definition at line 315 of file collector.h.

◆ Ncols

void const MInt const MInt maia::collector_memory::unaligned_cell_wise::Ncols
Initial value:
{
rowMajor1D(p, base, Nrows)
void rowMajor1D(T *&p, void *&base, const MInt cellId, const MInt Nrows, const MInt maxNoCells)
Stores 1D variables in row-major order.
Definition: collector.h:210

Definition at line 315 of file collector.h.

◆ Nrows

void const MInt maia::collector_memory::unaligned_cell_wise::Nrows

Definition at line 315 of file collector.h.