FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::Memory::Block Class Reference

Memory Arbiter memory block class. More...

Public Member Functions

 Block (Block &&other)=delete
 
 Block (const Block &)=delete
 no copy constructor
 
void alloc (Location mem_loc, Init mem_ini)
 
void copy_from (const Block &source, Location mem_loc, std::size_t this_offset, std::size_t src_offset, std::size_t size)
 
void copy_from (const void *src_ptr, Location src_loc, Location mem_loc, std::size_t this_offset, std::size_t size)
 
void copy_to (void *dst_ptr, Location dst_loc, std::size_t this_offset, std::size_t size) const
 
void create (std::size_t bytes_, Location loc_, Init all_)
 
void format (Location mem_loc, std::size_t this_offset, std::size_t size)
 
void format_random (Location mem_loc, std::size_t this_offset, std::size_t size)
 
void free (Location mem_loc)
 
void free_unmapped (Location mem_loc)
 
Lock lock_mutex () const
 locks the arbiter mutex assigned to this memory block More...
 
View map_view (Location mem_loc, Access access, std::size_t offset, std::size_t size)
 
Block & operator= (Block &&other)=delete
 
Block & operator= (const Block &)=delete
 no copy-assign operator
 
void release_view (const View &view)
 
bool uses_same_lock (const Block &other) const
 checks wether another block is assigned to the same mutex as this block More...
 

Static Public Member Functions

static Block * attach (Block *block)
 
static bool detach (Block *block)
 

Public Attributes

std::size_t bytes
 total size of memory block in bytes More...
 
void * mem_cuda
 memory block pointer to cuda device memory More...
 
void * mem_main
 memory block pointer to main (host) memory More...
 
std::size_t read_views_cuda
 number of currently active cuda memory views with read access More...
 
std::size_t read_views_main
 number of currently active main memory views with read access More...
 
std::size_t ref_count
 total number of references to this memory block More...
 
Location valid_locations
 combination of all currently up-to-date memory locations More...
 
Location write_location
 location of current write view More...
 
bool write_overlap
 specifies whether the write view(s) can be overlapped More...
 
std::size_t write_views
 number of currently active write views More...
 

Static Public Attributes

static constexpr std::size_t full_size = ~std::size_t(0)
 full size More...
 

Private Member Functions

void _alloc (Location mem_loc, Init mem_ini)
 
void _alloc_cuda (Init mem_ini)
 
void _alloc_main (Init mem_ini)
 
void _copy_cuda_from_cuda (const void *mem_cuda_src, std::size_t this_offset, std::size_t size)
 
void _copy_cuda_from_main (const void *mem_main_src, std::size_t this_offset, std::size_t size)
 
void _copy_cuda_to_cuda (void *mem_cuda_dst, std::size_t this_offset, std::size_t size) const
 
void _copy_cuda_to_main (void *mem_main_dst, std::size_t this_offset, std::size_t size) const
 
void _copy_from (const Block &source, Location mem_loc, std::size_t this_offset, std::size_t src_offset, std::size_t size)
 
void _copy_from (const void *src_ptr, Location src_loc, Location mem_loc, std::size_t this_offset, std::size_t size)
 
void _copy_main_from_cuda (const void *mem_cuda_src, std::size_t this_offset, std::size_t size)
 
void _copy_main_from_main (const void *mem_main_src, std::size_t this_offset, std::size_t size)
 
void _copy_main_from_uptodate ()
 
void _copy_main_to (Location mem_loc)
 
void _copy_main_to_cuda (void *mem_cuda_dst, std::size_t this_offset, std::size_t size) const
 
void _copy_main_to_main (void *mem_main_dst, std::size_t this_offset, std::size_t size) const
 
void _copy_to (void *dst_ptr, Location dst_loc, std::size_t this_offset, std::size_t size) const
 
void _free_cuda ()
 
void _free_main ()
 
bool _is_mapped_any () const
 
bool _is_mapped_any_read () const
 
bool _is_mapped_any_write () const
 
bool _is_mapped_cuda () const
 
bool _is_mapped_cuda_read () const
 
bool _is_mapped_cuda_write () const
 
bool _is_mapped_main () const
 
bool _is_mapped_main_read () const
 
bool _is_mapped_main_write () const
 
bool _is_write_overlapped () const
 
void _reset ()
 

Detailed Description

Memory Arbiter memory block class.

This class is used internally by the Memory::Arbiter class to store all relevant data that is managed by the arbiter. This class is only defined internally and cannot be used directly by anyone else than the arbiter.

Author
Peter Zajac

Definition at line 60 of file memory_arbiter.cpp.

Constructor & Destructor Documentation

◆ Block()

FEAT::Memory::Block::Block ( )
inline

Definition at line 121 of file memory_arbiter.cpp.

◆ ~Block()

FEAT::Memory::Block::~Block ( )
inline

Definition at line 135 of file memory_arbiter.cpp.

Member Function Documentation

◆ _alloc()

void FEAT::Memory::Block::_alloc ( Location  mem_loc,
Init  mem_ini 
)
inlineprivate

Definition at line 726 of file memory_arbiter.cpp.

◆ _alloc_cuda()

void FEAT::Memory::Block::_alloc_cuda ( Init  mem_ini)
inlineprivate

Definition at line 695 of file memory_arbiter.cpp.

◆ _alloc_main()

void FEAT::Memory::Block::_alloc_main ( Init  mem_ini)
inlineprivate

Definition at line 663 of file memory_arbiter.cpp.

◆ _copy_cuda_from_cuda()

void FEAT::Memory::Block::_copy_cuda_from_cuda ( const void *  mem_cuda_src,
std::size_t  this_offset,
std::size_t  size 
)
inlineprivate

Definition at line 811 of file memory_arbiter.cpp.

◆ _copy_cuda_from_main()

void FEAT::Memory::Block::_copy_cuda_from_main ( const void *  mem_main_src,
std::size_t  this_offset,
std::size_t  size 
)
inlineprivate

Definition at line 782 of file memory_arbiter.cpp.

◆ _copy_cuda_to_cuda()

void FEAT::Memory::Block::_copy_cuda_to_cuda ( void *  mem_cuda_dst,
std::size_t  this_offset,
std::size_t  size 
) const
inlineprivate

Definition at line 959 of file memory_arbiter.cpp.

◆ _copy_cuda_to_main()

void FEAT::Memory::Block::_copy_cuda_to_main ( void *  mem_main_dst,
std::size_t  this_offset,
std::size_t  size 
) const
inlineprivate

Definition at line 939 of file memory_arbiter.cpp.

◆ _copy_from() [1/2]

void FEAT::Memory::Block::_copy_from ( const Block &  source,
Location  mem_loc,
std::size_t  this_offset,
std::size_t  src_offset,
std::size_t  size 
)
inlineprivate

Definition at line 857 of file memory_arbiter.cpp.

◆ _copy_from() [2/2]

void FEAT::Memory::Block::_copy_from ( const void *  src_ptr,
Location  src_loc,
Location  mem_loc,
std::size_t  this_offset,
std::size_t  size 
)
inlineprivate

Definition at line 889 of file memory_arbiter.cpp.

◆ _copy_main_from_cuda()

void FEAT::Memory::Block::_copy_main_from_cuda ( const void *  mem_cuda_src,
std::size_t  this_offset,
std::size_t  size 
)
inlineprivate

Definition at line 796 of file memory_arbiter.cpp.

◆ _copy_main_from_main()

void FEAT::Memory::Block::_copy_main_from_main ( const void *  mem_main_src,
std::size_t  this_offset,
std::size_t  size 
)
inlineprivate

Definition at line 768 of file memory_arbiter.cpp.

◆ _copy_main_from_uptodate()

void FEAT::Memory::Block::_copy_main_from_uptodate ( )
inlineprivate

Definition at line 825 of file memory_arbiter.cpp.

◆ _copy_main_to()

void FEAT::Memory::Block::_copy_main_to ( Location  mem_loc)
inlineprivate

Definition at line 847 of file memory_arbiter.cpp.

◆ _copy_main_to_cuda()

void FEAT::Memory::Block::_copy_main_to_cuda ( void *  mem_cuda_dst,
std::size_t  this_offset,
std::size_t  size 
) const
inlineprivate

Definition at line 949 of file memory_arbiter.cpp.

◆ _copy_main_to_main()

void FEAT::Memory::Block::_copy_main_to_main ( void *  mem_main_dst,
std::size_t  this_offset,
std::size_t  size 
) const
inlineprivate

Definition at line 929 of file memory_arbiter.cpp.

◆ _copy_to()

void FEAT::Memory::Block::_copy_to ( void *  dst_ptr,
Location  dst_loc,
std::size_t  this_offset,
std::size_t  size 
) const
inlineprivate

Definition at line 968 of file memory_arbiter.cpp.

◆ _free_cuda()

void FEAT::Memory::Block::_free_cuda ( )
inlineprivate

Definition at line 755 of file memory_arbiter.cpp.

◆ _free_main()

void FEAT::Memory::Block::_free_main ( )
inlineprivate

Definition at line 742 of file memory_arbiter.cpp.

◆ _is_mapped_any()

bool FEAT::Memory::Block::_is_mapped_any ( ) const
inlineprivate

Definition at line 612 of file memory_arbiter.cpp.

◆ _is_mapped_any_read()

bool FEAT::Memory::Block::_is_mapped_any_read ( ) const
inlineprivate

Definition at line 617 of file memory_arbiter.cpp.

◆ _is_mapped_any_write()

bool FEAT::Memory::Block::_is_mapped_any_write ( ) const
inlineprivate

Definition at line 622 of file memory_arbiter.cpp.

◆ _is_mapped_cuda()

bool FEAT::Memory::Block::_is_mapped_cuda ( ) const
inlineprivate

Definition at line 627 of file memory_arbiter.cpp.

◆ _is_mapped_cuda_read()

bool FEAT::Memory::Block::_is_mapped_cuda_read ( ) const
inlineprivate

Definition at line 632 of file memory_arbiter.cpp.

◆ _is_mapped_cuda_write()

bool FEAT::Memory::Block::_is_mapped_cuda_write ( ) const
inlineprivate

Definition at line 637 of file memory_arbiter.cpp.

◆ _is_mapped_main()

bool FEAT::Memory::Block::_is_mapped_main ( ) const
inlineprivate

Definition at line 642 of file memory_arbiter.cpp.

◆ _is_mapped_main_read()

bool FEAT::Memory::Block::_is_mapped_main_read ( ) const
inlineprivate

Definition at line 647 of file memory_arbiter.cpp.

◆ _is_mapped_main_write()

bool FEAT::Memory::Block::_is_mapped_main_write ( ) const
inlineprivate

Definition at line 652 of file memory_arbiter.cpp.

◆ _is_write_overlapped()

bool FEAT::Memory::Block::_is_write_overlapped ( ) const
inlineprivate

Definition at line 657 of file memory_arbiter.cpp.

◆ _reset()

void FEAT::Memory::Block::_reset ( )
inlineprivate

Definition at line 598 of file memory_arbiter.cpp.

◆ alloc()

void FEAT::Memory::Block::alloc ( Location  mem_loc,
Init  mem_ini 
)
inline

Definition at line 227 of file memory_arbiter.cpp.

◆ attach()

static Block * FEAT::Memory::Block::attach ( Block *  block)
inlinestatic

Definition at line 186 of file memory_arbiter.cpp.

◆ copy_from() [1/2]

void FEAT::Memory::Block::copy_from ( const Block &  source,
Location  mem_loc,
std::size_t  this_offset,
std::size_t  src_offset,
std::size_t  size 
)
inline

Definition at line 258 of file memory_arbiter.cpp.

◆ copy_from() [2/2]

void FEAT::Memory::Block::copy_from ( const void *  src_ptr,
Location  src_loc,
Location  mem_loc,
std::size_t  this_offset,
std::size_t  size 
)
inline

Definition at line 298 of file memory_arbiter.cpp.

◆ copy_to()

void FEAT::Memory::Block::copy_to ( void *  dst_ptr,
Location  dst_loc,
std::size_t  this_offset,
std::size_t  size 
) const
inline

Definition at line 329 of file memory_arbiter.cpp.

◆ create()

void FEAT::Memory::Block::create ( std::size_t  bytes_,
Location  loc_,
Init  all_ 
)
inline

Definition at line 165 of file memory_arbiter.cpp.

◆ detach()

static bool FEAT::Memory::Block::detach ( Block *  block)
inlinestatic

Definition at line 197 of file memory_arbiter.cpp.

◆ format()

void FEAT::Memory::Block::format ( Location  mem_loc,
std::size_t  this_offset,
std::size_t  size 
)
inline

Definition at line 353 of file memory_arbiter.cpp.

◆ format_random()

void FEAT::Memory::Block::format_random ( Location  mem_loc,
std::size_t  this_offset,
std::size_t  size 
)
inline

Definition at line 400 of file memory_arbiter.cpp.

◆ free()

void FEAT::Memory::Block::free ( Location  mem_loc)
inline

Definition at line 233 of file memory_arbiter.cpp.

◆ free_unmapped()

void FEAT::Memory::Block::free_unmapped ( Location  mem_loc)
inline

Definition at line 242 of file memory_arbiter.cpp.

◆ lock_mutex()

Lock FEAT::Memory::Block::lock_mutex ( ) const
inline

locks the arbiter mutex assigned to this memory block

Definition at line 152 of file memory_arbiter.cpp.

◆ map_view()

View FEAT::Memory::Block::map_view ( Location  mem_loc,
Access  access,
std::size_t  offset,
std::size_t  size 
)
inline

Definition at line 431 of file memory_arbiter.cpp.

◆ release_view()

void FEAT::Memory::Block::release_view ( const View &  view)
inline

Definition at line 563 of file memory_arbiter.cpp.

◆ uses_same_lock()

bool FEAT::Memory::Block::uses_same_lock ( const Block &  other) const
inline

checks wether another block is assigned to the same mutex as this block

Definition at line 158 of file memory_arbiter.cpp.

Member Data Documentation

◆ bytes

◆ full_size

constexpr std::size_t FEAT::Memory::Block::full_size = ~std::size_t(0)
staticconstexpr

full size

Definition at line 64 of file memory_arbiter.cpp.

◆ mem_cuda

void* FEAT::Memory::Block::mem_cuda

memory block pointer to cuda device memory

Definition at line 84 of file memory_arbiter.cpp.

◆ mem_main

void* FEAT::Memory::Block::mem_main

memory block pointer to main (host) memory

Definition at line 79 of file memory_arbiter.cpp.

◆ read_views_cuda

std::size_t FEAT::Memory::Block::read_views_cuda

number of currently active cuda memory views with read access

Definition at line 113 of file memory_arbiter.cpp.

◆ read_views_main

std::size_t FEAT::Memory::Block::read_views_main

number of currently active main memory views with read access

Definition at line 108 of file memory_arbiter.cpp.

◆ ref_count

std::size_t FEAT::Memory::Block::ref_count

total number of references to this memory block

Definition at line 69 of file memory_arbiter.cpp.

◆ valid_locations

Location FEAT::Memory::Block::valid_locations

combination of all currently up-to-date memory locations

This enum holds the combination of all memory locations which are currently up-to-date.

Definition at line 91 of file memory_arbiter.cpp.

Referenced by FEAT::Memory::Arbiter::location().

◆ write_location

Location FEAT::Memory::Block::write_location

location of current write view

This holds the location of the currently open write view(s).

Definition at line 98 of file memory_arbiter.cpp.

◆ write_overlap

bool FEAT::Memory::Block::write_overlap

specifies whether the write view(s) can be overlapped

Definition at line 118 of file memory_arbiter.cpp.

◆ write_views

std::size_t FEAT::Memory::Block::write_views

number of currently active write views

Definition at line 103 of file memory_arbiter.cpp.


The documentation for this class was generated from the following file: