#include <util/group/memregion.h>

Public Member Functions | |
| MemoryGrpRegion (const Ref< MemoryGrp > &mem, size_t mem_start, size_t max_size) | |
| MemoryGrpRegion is defined by the host MemoryGrp and position and size of the local segment within the local memory of the host. | |
| MemoryGrpRegion (const Ref< MemoryGrp > &mem, size_t max_size) | |
| same as above, except mem_start is determined automatically | |
| void | set_localsize (size_t) |
| Set the size of locally held memory. | |
| void * | localdata () |
| Returns a pointer to the local data. | |
| void * | obtain_readwrite (distsize_t offset, int size) |
| Only one thread can have an unreleased obtain_readwrite at a time. | |
| void * | obtain_readonly (distsize_t offset, int size) |
| This gives read access to the memory location. No locking is done. | |
| void * | obtain_writeonly (distsize_t offset, int size) |
| This gives write access to the memory 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. | |
| void | sum_reduction_on_node (double *data, size_t doffset, int dsize, int node=-1) |
| Perform a sum reduction on double data localized to a single node. | |
| 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. | |
| void | catchup () |
| Processes outstanding requests. | |
| void * | malloc_local (size_t nbytes) |
| Allocate data that will be accessed locally only. | |
| void | free_local (void *data) |
| Free data that was allocated with malloc_local. | |
| Ref< MemoryGrp > | clone () |
| reimplementation of MemoryGrp::clone(). always throws ProgrammingError -- this type of MemoryGrp is not clonable | |
| void | print (std::ostream &o=ExEnv::out0()) const |
| Prints out information about the object. | |
Classes | |
| class | HostToRegionsMap |
| this maps MemoryGrp to the ordered list of its allocated regions, in order of increasing starts | |
| class | LocalRegion |
| LocalRegion is an interval [start, start+size). | |
It is assumed that the host MemoryGrp is not resized during lifetime of all MemoryGrpRegion objects bound to it.
Each region has a static local offset and size. set_localsize() then cannot ask for more than the maximum size, but can be called multiple times.
| void sc::MemoryGrpRegion::set_localsize | ( | size_t | ) | [virtual] |
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 n() - 1.
Implements sc::MemoryGrp.
| void* sc::MemoryGrpRegion::obtain_readwrite | ( | distsize_t | offset, | |
| int | size | |||
| ) | [virtual] |
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.
Implements sc::MemoryGrp.
| void sc::MemoryGrpRegion::release_readwrite | ( | void * | data, | |
| distsize_t | offset, | |||
| int | size | |||
| ) | [virtual] |
This is called when read/write access is no longer needed.
The memory will be unlocked.
Implements sc::MemoryGrp.
| void sc::MemoryGrpRegion::sum_reduction_on_node | ( | double * | data, | |
| size_t | doffset, | |||
| int | dsize, | |||
| int | node = -1 | |||
| ) | [virtual] |
Perform a sum reduction on double data localized to a single node.
| data | the contribution to sum into the global array. | |
| doffset | the local offset on the node in terms of doubles. | |
| dsize | the size in terms of doubles. | |
| node | the node holding the data. The default is the local node. |
Reimplemented from sc::MemoryGrp.
| void sc::MemoryGrpRegion::sync | ( | ) | [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.
Implements sc::MemoryGrp.
| void sc::MemoryGrpRegion::catchup | ( | ) | [virtual] |
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.
Reimplemented from sc::MemoryGrp.
| void* sc::MemoryGrpRegion::malloc_local | ( | size_t | nbyte | ) | [virtual] |
Allocate data that will be accessed locally only.
Using this for data that will be used for global operations can improve efficiency. Data allocated in this way must be freed with free_local_double.
Reimplemented from sc::MemoryGrp.
| void sc::MemoryGrpRegion::free_local | ( | void * | data | ) | [virtual] |