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

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

#include <ManagedMemory.h>

Inheritance diagram for ManagedMemory:
ColumnBundle FieldData matrix complexScalarFieldData complexScalarFieldTildeData ScalarFieldData ScalarFieldTildeData

Public Member Functions

complexdata ()
 Return a pointer to the actual data Return a CPU pointer to the actual data, will move data from GPU to CPU if necessary In GPU mode, care must be taken when calling this from multiple cpu threads Only the "GPU Owner" thread may call this when the data is actually on the GPU. Ideally call once from main thread to get data onto the cpu before launching other cpu threads.
 
const complexdata () const
 Return a const pointer to the actual data Return a CPU pointer to the actual data, will move data from GPU to CPU if necessary In GPU mode, care must be taken when calling this from multiple cpu threads Only the "GPU Owner" thread may call this when the data is actually on the GPU. Ideally call once from main thread to get data onto the cpu before launching other cpu threads.
 
size_t nData () const
 number of data points
 
bool isOnGpu () const
 Check where the data is (for #ifdef simplicity exposed even when no GPU_ENABLED)
 
complexdataGpu ()
 Get a gpu data pointer (must be called from GPU owner thread)
 
const complexdataGpu () const
 Get a const gpu data pointer (must be called from GPU owner thread)
 
complexdataPref ()
 
const complexdataPref () const
 
void send (int dest, int tag=0) const
 send to another process
 
void recv (int src, int tag=0)
 receive from another process
 
void bcast (int root=0)
 synchronize across processes (using value on specified root process)
 
void allReduce (MPIUtil::ReduceOp op, bool safeMode=false, bool ignoreComplexCheck=false)
 apply all-to-all reduction (see MPIUtil::allReduce). Optionally ignore unsupported operations for complex check.
 
void write (const char *fname) const
 binary-write to a file
 
void writea (const char *fname) const
 binary-append to a file
 
void write (FILE *filep) const
 binary-write toa stream
 
void read (const char *fname)
 binary read from a file
 
void read (FILE *filep)
 binary read from a stream
 
void read_real (const char *fname)
 binary read real-part from file, setting imaginary parts to 0
 
void read_real (FILE *filep)
 binary read real-part from stream, setting imaginary parts to 0
 
void write_real (const char *fname) const
 binary write real-parts to file
 
void write_real (FILE *filep) const
 binary write real-parts to stream
 
void dump (const char *fname, bool realPartOnly) const
 write as complex or real-part alone and report discarded imaginary part, if any
 
void zero ()
 set all elements to zero
 

Static Public Member Functions

static void reportUsage ()
 print memory usage report
 

Protected Member Functions

void memFree ()
 Free memory.
 
void memInit (string category, size_t nElem, bool onGpu=false)
 Allocate memory.
 
void memMove (ManagedMemory &&)
 Steal the other object's data (used for move constructors/assignment)
 
 ManagedMemory ()
 Initialize a valid state, but don't allocate anything.
 

Detailed Description

Base class for managed-memory objects (that could potentially live on GPUs as well)


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