MPQC  3.0.0-alpha
sc::ProcFileGrp Class Reference

The ProcFileGrp concrete class provides an implementation of FileGrp for a single processor. More...

#include <util/group/fileproc.h>

Inheritance diagram for sc::ProcFileGrp:
sc::FileGrp sc::DescribedClass sc::RefCount

Public Member Functions

 ProcFileGrp (const Ref< KeyVal > &)
 
ProcFileGrpclone ()
 Clones the given FileGrp. The new FileGrp may need to be initialized additionally.
 
void set_localsize (size_t)
 Set the size of locally held data. More...
 
void * localdata ()
 
void * obtain_readwrite (distsize_t offset, int size)
 Only one thread can have an unreleased obtain_readwrite at a time. More...
 
void * obtain_readonly (distsize_t offset, int size)
 This gives read access to the file location. No locking is done.
 
void * obtain_writeonly (distsize_t offset, int size)
 This gives write access to the data location. No locking is done.
 
void release_readonly (void *data, distsize_t offset, int size)
 This is called when read access is no longer needed.
 
void release_writeonly (void *data, distsize_t offset, int size)
 This is called when write access is no longer needed.
 
void release_readwrite (void *data, distsize_t offset, int size)
 This is called when read/write access is no longer needed. More...
 
void sync ()
 Synchronizes all the nodes. More...
 
- Public Member Functions inherited from sc::FileGrp
 FileGrp (const Ref< KeyVal > &)
 
void open ()
 Opens the files.
 
void close ()
 Closes the files.
 
void set_filename (char *name)
 Sets the filename for the FileGrp.
 
const char * get_filename () const
 Returns the filename for the FileGrp.
 
int me () const
 Returns who I am.
 
int n () const
 Returns how many nodes there are.
 
size_t localsize ()
 Returns the amount of data residing locally on me().
 
distsize_t localoffset ()
 Returns the global offset to this node's data.
 
int size (int node)
 Returns the amount of data residing on node.
 
distsize_t offset (int node)
 Returns the global offset to node's data.
 
distsize_t totalsize ()
 Returns the sum of all data allocated on all nodes.
 
virtual void activate ()
 Activate is called before the data is to be used.
 
virtual void deactivate ()
 Deactivate is called after the data has been used.
 
virtual void sum_reduction (double *data, distsize_t doffset, int dsize)
 
virtual void sum_reduction_on_node (double *data, size_t doffset, int dsize, int node=-1)
 
virtual void catchup ()
 Processes outstanding requests. More...
 
virtual void print (std::ostream &o=ExEnv::out0()) const
 Prints out information about the object.
 
- Public Member Functions inherited from sc::DescribedClass
 DescribedClass (const DescribedClass &)
 
DescribedClassoperator= (const DescribedClass &)
 
ClassDescclass_desc () const MPQC__NOEXCEPT
 This returns the unique pointer to the ClassDesc corresponding to the given type_info object. More...
 
const char * class_name () const
 Return the name of the object's exact type.
 
int class_version () const
 Return the version of the class.
 
Ref< DescribedClassref ()
 Return this object wrapped up in a Ref smart pointer. More...
 
- Public Member Functions inherited from sc::RefCount
size_t identifier () const
 Return the unique identifier for this object that can be compared for different objects of different types. More...
 
int lock_ptr () const
 Lock this object.
 
int unlock_ptr () const
 Unlock this object.
 
void use_locks (bool inVal)
 start and stop using locks on this object
 
refcount_t nreference () const
 Return the reference count.
 
refcount_t reference ()
 Increment the reference count and return the new count.
 
refcount_t dereference ()
 Decrement the reference count and return the new count.
 
int managed () const
 
void unmanage ()
 Turn off the reference counting mechanism for this object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from sc::FileGrp
static FileGrpinitial_filegrp (int &argc, char **argv)
 Create a file group. More...
 
static FileGrpinitial_filegrp ()
 
static void set_default_filegrp (const Ref< FileGrp > &)
 The default file group contains the primary file group to be used by an application.
 
static FileGrpget_default_filegrp ()
 Returns the default file group.
 
- Protected Member Functions inherited from sc::FileGrp
void obtain_local_lock (size_t start, size_t fence)
 
void release_local_lock (size_t start, size_t fence)
 
- Protected Member Functions inherited from sc::RefCount
 RefCount (const RefCount &)
 
RefCountoperator= (const RefCount &)
 
- Protected Attributes inherited from sc::FileGrp
int me_
 
int n_
 
distsize_t * offsets_
 
int debug_
 

Detailed Description

The ProcFileGrp concrete class provides an implementation of FileGrp for a single processor.

Member Function Documentation

◆ obtain_readwrite()

void* sc::ProcFileGrp::obtain_readwrite ( distsize_t  offset,
int  size 
)
virtual

Only one thread can have an unreleased obtain_readwrite at a time.

The actual file region locked can be larger than that requested. If the file region is already locked this will block. For this reason, data should be held as read/write for as short a time as possible.

Implements sc::FileGrp.

◆ release_readwrite()

void sc::ProcFileGrp::release_readwrite ( void *  data,
distsize_t  offset,
int  size 
)
virtual

This is called when read/write access is no longer needed.

The data will be unlocked.

Implements sc::FileGrp.

◆ set_localsize()

void sc::ProcFileGrp::set_localsize ( size_t  )
virtual

Set the size of locally held data.

When data is accessed using a global offset counting starts at node 0 and proceeds up to node n() - 1.

Implements sc::FileGrp.

◆ sync()

void sc::ProcFileGrp::sync ( )
virtual

Synchronizes all the nodes.

Consider using this when the way you you access data changes.

Implements sc::FileGrp.


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

Generated at Sun Jan 26 2020 23:24:09 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.