MPQC
3.0.0-alpha
|
This MemoryGrp class requires a MT-safe MPI implementation. More...
#include <util/group/memmtmpi.h>
Public Member Functions | |
MTMPIMemoryGrp (const Ref< MessageGrp > &msg, const Ref< ThreadGrp > &th, MPI_Comm comm=MPI_COMM_WORLD) | |
Construct a MTMPIMemoryGrp given a MessageGrp, ThreadGrp, and an MPI communicator. More... | |
MTMPIMemoryGrp (const Ref< KeyVal > &) | |
Construct a MTMPIMemoryGrp given a KeyVal input object. More... | |
void | activate () |
Activate is called before the memory is to be used. | |
void | deactivate () |
Deactivate is called after the memory has been used. | |
void | sync () |
Synchronizes all the nodes. More... | |
Ref< MemoryGrp > | clone () |
Returns a copy of this MemoryGrp specialization that provides an independent communication context. More... | |
Public Member Functions inherited from sc::ActiveMsgMemoryGrp | |
ActiveMsgMemoryGrp (const Ref< MessageGrp > &msg) | |
ActiveMsgMemoryGrp (const Ref< KeyVal > &) | |
void | set_localsize (size_t) |
Set the size of locally held memory. More... | |
void * | localdata () |
Returns a pointer to the local data. | |
void * | obtain_writeonly (distsize_t offset, size_t size) |
This gives write access to the memory location. No locking is done. | |
void * | obtain_readwrite (distsize_t offset, size_t size) |
Only one thread can have an unreleased obtain_readwrite at a time. More... | |
void * | obtain_readonly (distsize_t offset, size_t size) |
This gives read access to the memory location. No locking is done. | |
void | release_readonly (void *data, distsize_t offset, size_t size) |
This is called when read access is no longer needed. | |
void | release_writeonly (void *data, distsize_t offset, size_t size) |
This is called when write access is no longer needed. | |
void | release_readwrite (void *data, distsize_t offset, size_t size) |
This is called when read/write access is no longer needed. More... | |
void | write (const void *data, distsize_t offset, size_t size) |
This is used to write data directly. More... | |
void | sum_reduction (double *data, distsize_t doffset, size_t dsize) |
Perform a sum reduction on double data. More... | |
void | sum_reduction_on_node (double *data, size_t doffset, size_t dsize, int node=-1) |
Perform a sum reduction on double data localized to a single node. More... | |
void | print (std::ostream &o=ExEnv::out0()) const |
Prints out information about the object. | |
Public Member Functions inherited from sc::MsgMemoryGrp | |
MsgMemoryGrp (const Ref< MessageGrp > &msg) | |
MsgMemoryGrp (const Ref< KeyVal > &keyval) | |
void | set_localsize (size_t localsize) |
Set the size of locally held memory. More... | |
Public Member Functions inherited from sc::MemoryGrp | |
MemoryGrp (const Ref< KeyVal > &) | |
int | me () const |
Returns who I am. | |
int | n () const |
Returns how many nodes there are. | |
size_t | localsize () |
Returns the amount of memory residing locally on me(). | |
distsize_t | localoffset () |
Returns the global offset to this node's memory. | |
int | size (int node) |
Returns the amount of memory residing on node. | |
distsize_t | offset (int node) |
Returns the global offset to node's memory. | |
distsize_t | totalsize () |
Returns the sum of all memory allocated on all nodes. | |
virtual void * | malloc_local (size_t nbyte) |
Allocate data that will be accessed locally only. More... | |
double * | malloc_local_double (size_t ndouble) |
Allocate double data that will be accessed locally only. More... | |
virtual void | free_local (void *&data) |
Free data that was allocated with malloc_local, and set the pointer to 0. | |
void | free_local_double (double *&data) |
Free data that was allocated with malloc_local_double, and set the pointer to 0 | |
virtual void | catchup () |
Processes outstanding requests. More... | |
Public Member Functions inherited from sc::DescribedClass | |
DescribedClass (const DescribedClass &) | |
DescribedClass & | operator= (const DescribedClass &) |
ClassDesc * | class_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< DescribedClass > | ref () |
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... | |
Friends | |
class | MTMPIThread |
Additional Inherited Members | |
Static Public Member Functions inherited from sc::MemoryGrp | |
static MemoryGrp * | initial_memorygrp (int &argc, char **argv) |
Create a memory group. More... | |
static MemoryGrp * | initial_memorygrp () |
Create a memory group. More... | |
static void | set_default_memorygrp (const Ref< MemoryGrp > &) |
The default memory group contains the primary memory group to be used by an application. | |
static MemoryGrp * | get_default_memorygrp () |
Returns the default memory group. More... | |
Protected Member Functions inherited from sc::MemoryGrp | |
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 &) | |
RefCount & | operator= (const RefCount &) |
Protected Attributes inherited from sc::ActiveMsgMemoryGrp | |
char * | data_ |
Protected Attributes inherited from sc::MsgMemoryGrp | |
Ref< MessageGrp > | msg_ |
Protected Attributes inherited from sc::MemoryGrp | |
int | me_ |
int | n_ |
distsize_t * | offsets_ |
int | debug_ |
This MemoryGrp class requires a MT-safe MPI implementation.
The default MessageGrp must be a MPIMessageGrp. MPI must be safe with respect to the default ThreadGrp. Alternately, a MessageGrp and a ThreadGrp can be passed to the constructor.
sc::MTMPIMemoryGrp::MTMPIMemoryGrp | ( | const Ref< MessageGrp > & | msg, |
const Ref< ThreadGrp > & | th, | ||
MPI_Comm | comm = MPI_COMM_WORLD |
||
) |
Construct a MTMPIMemoryGrp given a MessageGrp, ThreadGrp, and an MPI communicator.
The communicator can be a subset of MPI_COMM_WORLD, in which case, the MessageGrp must refer to the same subset.
Construct a MTMPIMemoryGrp given a KeyVal input object.
A fully thread safe MPI is needed (MPI_THREAD_MULTIPLE). The recognized keywords are:
Keyword | Type | Default | Description |
num_threads | integer | 1 | The number of threads to use for communication. |
num_buffer | integer | 0 | The number of buffers to prepost for communication. |
use_timer | boolean | false | Collect timing information. |
Returns a copy of this MemoryGrp specialization that provides an independent communication context.
This will throw for specializations that do not reimplement it.
Reimplemented from sc::MemoryGrp.
|
virtual |
Synchronizes all the nodes.
This is useful after remote memory writes to be certain that all of the writes have completed and the data can be accessed locally, for example.
Reimplemented from sc::MsgMemoryGrp.