28 #ifndef _util_group_memregion_h
29 #define _util_group_memregion_h
34 #include <sys/types.h>
36 #include <util/group/memory.h>
83 static const int only_allow_double_aligned_regions_ = 1;
90 static const int classdebug_ = 0;
91 static int classdebug() {
return classdebug_; }
99 LocalRegion(
size_t start,
size_t size) : start_(start), size_(
size) {}
100 size_t start()
const {
return start_; }
101 size_t size()
const {
return size_; }
105 bool operator>(
const LocalRegion&
other)
const {
106 return start() >
other.start();
112 typedef std::list<LocalRegion> LocalRegions;
115 LocalRegion reserve_;
116 std::vector<distsize_t> host_offsets_;
118 distsize_t offset_to_host_offset(
const distsize_t&
offset)
const;
121 class HostToRegionsMap {
125 void insert(
const MemoryGrp* host,
const LocalRegion& region);
126 void erase(
const MemoryGrp* host,
const LocalRegion& region);
128 size_t find_free(
const MemoryGrp* host,
size_t sz)
const;
130 const LocalRegions* regions(
const MemoryGrp* host)
const;
131 typedef std::map<const MemoryGrp*,LocalRegions*> ImplType;
135 static HostToRegionsMap map_;
void * obtain_readonly(distsize_t offset, size_t size)
This gives read access to the memory location. No locking is done.
void deactivate()
Deactivate is called after the memory has been used.
void activate()
Activate is called before the memory is to be used.
void sync()
Synchronizes all the nodes.
void catchup()
Processes outstanding requests.
distsize_t offset(int node)
Returns the global offset to node's memory.
Definition: memory.h:164
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 th...
void release_writeonly(void *data, distsize_t offset, size_t size)
This is called when write access is no longer needed.
A template class that maintains references counts.
Definition: ref.h:361
void print(std::ostream &o=ExEnv::out0()) const
Prints out information about the object.
The MemoryGrp abstract class provides a way of accessing distributed memory in a parallel machine.
Definition: memory.h:120
void free_local(void *&data)
Free data that was allocated with malloc_local, and set the pointer to 0.
void * malloc_local(size_t nbytes)
Allocate data that will be accessed locally only.
int size(int node)
Returns the amount of memory residing on node.
Definition: memory.h:161
void * localdata()
Returns a pointer to the local data.
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.
void set_localsize(size_t)
Set the size of locally held memory.
void * obtain_writeonly(distsize_t offset, size_t size)
This gives write access to the memory location. No locking is done.
SpinCase1 other(SpinCase1 S)
given 1-spin return the other 1-spin
void release_readonly(void *data, distsize_t offset, size_t size)
This is called when read access is no longer needed.
Ref< MemoryGrp > clone()
Returns a copy of this MemoryGrp specialization that provides an independent communication context.
static std::ostream & out0()
Return an ostream that writes from node 0.
void release_readwrite(void *data, distsize_t offset, size_t size)
This is called when read/write access is no longer needed.
bool operator==(const Atom &a, const Atom &b)
void * obtain_readwrite(distsize_t offset, size_t size)
Only one thread can have an unreleased obtain_readwrite at a time.
The MemoryGrpRegion is a MemoryGrp proxy to a region of a MemoryGrp.
Definition: memregion.h:46
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
Generated at Sun Jan 26 2020 23:24:01 for MPQC
3.0.0-alpha using the documentation package Doxygen
1.8.16.