.TH "sc::MemoryGrp" 3 "Sun Oct 4 2020" "Version 2.3.1" "MPQC" \" -*- nroff -*- .ad l .nh .SH NAME sc::MemoryGrp \- The \fBMemoryGrp\fP abstract class provides a way of accessing distributed memory in a parallel machine\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBsc::DescribedClass\fP\&. .PP Inherited by \fBsc::MsgMemoryGrp\fP, and \fBsc::ProcMemoryGrp\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBMemoryGrp\fP (const \fBRef\fP< \fBKeyVal\fP > &)" .br .ti -1c .RI "int \fBme\fP () const" .br .RI "Returns who I am\&. " .ti -1c .RI "int \fBn\fP () const" .br .RI "Returns how many nodes there are\&. " .ti -1c .RI "virtual void \fBset_localsize\fP (size_t)=0" .br .RI "Set the size of locally held memory\&. " .ti -1c .RI "size_t \fBlocalsize\fP ()" .br .RI "Returns the amount of memory residing locally on \fBme()\fP\&. " .ti -1c .RI "virtual void * \fBlocaldata\fP ()=0" .br .RI "Returns a pointer to the local data\&. " .ti -1c .RI "\fBdistsize_t\fP \fBlocaloffset\fP ()" .br .RI "Returns the global offset to this node's memory\&. " .ti -1c .RI "int \fBsize\fP (int node)" .br .RI "Returns the amount of memory residing on node\&. " .ti -1c .RI "\fBdistsize_t\fP \fBoffset\fP (int node)" .br .RI "Returns the global offset to node's memory\&. " .ti -1c .RI "\fBdistsize_t\fP \fBtotalsize\fP ()" .br .RI "Returns the sum of all memory allocated on all nodes\&. " .ti -1c .RI "virtual void \fBactivate\fP ()" .br .RI "Activate is called before the memory is to be used\&. " .ti -1c .RI "virtual void \fBdeactivate\fP ()" .br .RI "Deactivate is called after the memory has been used\&. " .ti -1c .RI "virtual void * \fBobtain_writeonly\fP (\fBdistsize_t\fP \fBoffset\fP, int \fBsize\fP)=0" .br .RI "This gives write access to the memory location\&. No locking is done\&. " .ti -1c .RI "virtual void * \fBobtain_readwrite\fP (\fBdistsize_t\fP \fBoffset\fP, int \fBsize\fP)=0" .br .RI "Only one thread can have an unreleased obtain_readwrite at a time\&. " .ti -1c .RI "virtual void * \fBobtain_readonly\fP (\fBdistsize_t\fP \fBoffset\fP, int \fBsize\fP)=0" .br .RI "This gives read access to the memory location\&. No locking is done\&. " .ti -1c .RI "virtual void \fBrelease_readonly\fP (void *data, \fBdistsize_t\fP \fBoffset\fP, int \fBsize\fP)=0" .br .RI "This is called when read access is no longer needed\&. " .ti -1c .RI "virtual void \fBrelease_writeonly\fP (void *data, \fBdistsize_t\fP \fBoffset\fP, int \fBsize\fP)=0" .br .RI "This is called when write access is no longer needed\&. " .ti -1c .RI "virtual void \fBrelease_readwrite\fP (void *data, \fBdistsize_t\fP \fBoffset\fP, int \fBsize\fP)=0" .br .RI "This is called when read/write access is no longer needed\&. " .ti -1c .RI "virtual void \fBsum_reduction\fP (double *data, \fBdistsize_t\fP doffset, int dsize)" .br .ti -1c .RI "virtual void \fBsum_reduction_on_node\fP (double *data, size_t doffset, int dsize, int node=\-1)" .br .ti -1c .RI "virtual void \fBsync\fP ()=0" .br .RI "Synchronizes all the nodes\&. " .ti -1c .RI "virtual void * \fBmalloc_local\fP (size_t nbyte)" .br .RI "Allocate data that will be accessed locally only\&. " .ti -1c .RI "virtual double * \fBmalloc_local_double\fP (size_t ndouble)" .br .ti -1c .RI "virtual void \fBfree_local\fP (void *data)" .br .RI "Free data that was allocated with malloc_local_double\&. " .ti -1c .RI "virtual void \fBfree_local_double\fP (double *data)" .br .ti -1c .RI "virtual void \fBcatchup\fP ()" .br .RI "Processes outstanding requests\&. " .ti -1c .RI "virtual void \fBprint\fP (std::ostream &o=\fBExEnv::out0\fP()) const" .br .RI "Prints out information about the object\&. " .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static \fBMemoryGrp\fP * \fBinitial_memorygrp\fP (int &argc, char **argv)" .br .RI "Create a memory group\&. " .ti -1c .RI "static \fBMemoryGrp\fP * \fBinitial_memorygrp\fP ()" .br .ti -1c .RI "static void \fBset_default_memorygrp\fP (const \fBRef\fP< \fBMemoryGrp\fP > &)" .br .RI "The default memory group contains the primary memory group to be used by an application\&. " .ti -1c .RI "static \fBMemoryGrp\fP * \fBget_default_memorygrp\fP ()" .br .RI "Returns the default memory group\&. " .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "void \fBobtain_local_lock\fP (size_t start, size_t fence)" .br .ti -1c .RI "void \fBrelease_local_lock\fP (size_t start, size_t fence)" .br .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "int \fBme_\fP" .br .ti -1c .RI "int \fBn_\fP" .br .ti -1c .RI "\fBdistsize_t\fP * \fBoffsets_\fP" .br .ti -1c .RI "int \fBdebug_\fP" .br .in -1c .SH "Detailed Description" .PP The \fBMemoryGrp\fP abstract class provides a way of accessing distributed memory in a parallel machine\&. Several specializations are available\&. For one processor, \fBProcMemoryGrp\fP provides a simple stub implementation\&. Parallel specializations include \fBShmMemoryGrp\fP, \fBMTMPIMemoryGrp\fP, and \fBARMCIMemoryGrp\fP\&. The particular specializations that work depend highly on the target hardware and software environment\&. .SH "Member Function Documentation" .PP .SS "virtual void sc::MemoryGrp::catchup ()\fC [virtual]\fP" .PP Processes outstanding requests\&. Some memory group implementations don't have access to real shared memory or even active messages\&. Instead, requests are processed whenever certain memory group routines are called\&. This can cause large latencies and buffer overflows\&. If this is a problem, then the catchup member can be called to process all outstanding requests\&. .SS "static \fBMemoryGrp\fP* sc::MemoryGrp::get_default_memorygrp ()\fC [static]\fP" .PP Returns the default memory group\&. If the default memory group has not yet been set, then one is created\&. The particular specialization used is determined by configuration options and which specializations are being used for \fBMessageGrp\fP and \fBThreadGrp\fP\&. .SS "static \fBMemoryGrp\fP* sc::MemoryGrp::initial_memorygrp (int & argc, char ** argv)\fC [static]\fP" .PP Create a memory group\&. This routine looks for a -memorygrp argument, and then the environmental variable MEMORYGRP to decide which specialization of \fBMemoryGrp\fP would be appropriate\&. The argument to -memorygrp or the value of the environmental variable should be either string for a \fBParsedKeyVal\fP constructor or a classname\&. The default \fBThreadGrp\fP and \fBMessageGrp\fP objects should be initialized before this is called\&. .PP References initial_memorygrp()\&. .PP Referenced by initial_memorygrp()\&. .SS "virtual void* sc::MemoryGrp::malloc_local (size_t nbyte)\fC [virtual]\fP" .PP Allocate data that will be accessed locally only\&. Using this for data that will be used for global operation can improve efficiency\&. Data allocated in this way must be freed with free_local_double\&. .br .PP Reimplemented in \fBsc::ARMCIMemoryGrp\fP\&. .SS "virtual void* sc::MemoryGrp::obtain_readwrite (\fBdistsize_t\fP offset, int size)\fC [pure virtual]\fP" .PP Only one thread can have an unreleased obtain_readwrite at a time\&. The actual memory region locked can be larger than that requested\&. If the memory region is already locked this will block\&. For this reason, data should be held as read/write for as short a time as possible\&. .PP Implemented in \fBsc::ShmMemoryGrp\fP, \fBsc::RDMAMemoryGrp\fP, \fBsc::ProcMemoryGrp\fP, and \fBsc::ActiveMsgMemoryGrp\fP\&. .SS "virtual void sc::MemoryGrp::release_readwrite (void * data, \fBdistsize_t\fP offset, int size)\fC [pure virtual]\fP" .PP This is called when read/write access is no longer needed\&. The memory will be unlocked\&. .PP Implemented in \fBsc::ShmMemoryGrp\fP, \fBsc::RDMAMemoryGrp\fP, \fBsc::ProcMemoryGrp\fP, and \fBsc::ActiveMsgMemoryGrp\fP\&. .SS "virtual void sc::MemoryGrp::set_localsize (size_t)\fC [pure virtual]\fP" .PP Set the size of locally held memory\&. When memory is accessed using a global offset counting starts at node 0 and proceeds up to node \fBn()\fP - 1\&. .PP Implemented in \fBsc::ShmMemoryGrp\fP, \fBsc::ProcMemoryGrp\fP, \fBsc::ARMCIMemoryGrp\fP, \fBsc::ActiveMsgMemoryGrp\fP, \fBsc::RDMAMemoryGrp\fP, and \fBsc::MsgMemoryGrp\fP\&. .SS "virtual void sc::MemoryGrp::sync ()\fC [pure virtual]\fP" .PP 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\&. .PP Implemented in \fBsc::ProcMemoryGrp\fP, \fBsc::MTMPIMemoryGrp\fP, \fBsc::MsgMemoryGrp\fP, and \fBsc::ARMCIMemoryGrp\fP\&. .SH "Author" .PP Generated automatically by Doxygen for MPQC from the source code\&.