JDFTx  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ManagedMemoryBase Class Reference

Base class for managed-memory objects (that could potentially live on GPUs as well) with unspecified data type. More...

#include <ManagedMemory.h>

Inheritance diagram for ManagedMemoryBase:
ManagedMemory< T > ManagedMemory< complex > ManagedMemory< double > ManagedMemory< int > ManagedMemory< size_t > ManagedMemory< uint64_t > ManagedMemory< vector3< int > > ManagedMemory< vector3<> >

Static Public Member Functions

static void reportUsage ()
 print memory usage report
 

Protected Member Functions

 ManagedMemoryBase ()
 Initialize a valid state, but don't allocate anything.
 
void memFree ()
 Free memory.
 
void memInit (string category, size_t nBytes, bool onGpu=false)
 Allocate memory.
 
void memMove (ManagedMemoryBase &&)
 Steal the other object's data (used for move constructors/assignment)
 
void toCpu () const
 move data to the CPU (does nothing without GPU_ENABLED); logically const, but data location may change
 
void toGpu () const
 move data to the GPU (does nothing without GPU_ENABLED); logically const, but data location may change
 

Protected Attributes

string category
 category of managed memory objects to report memory usage under
 
size_t nBytes
 Size of stored data.
 
void * c
 Actual data storage.
 
bool onGpu
 For reduced #ifdef's, this flag is retained even in the absence of gpu support.
 

Detailed Description

Base class for managed-memory objects (that could potentially live on GPUs as well) with unspecified data type.


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