32 #ifndef _util_group_memamsg_h
33 #define _util_group_memamsg_h
37 #include <util/group/memmsg.h>
44 enum Request { Deactivate, Sync, Retrieve, Replace, DoubleSum };
50 int lock = 0,
int serial = 0);
51 void assign(Request r,
int node,
int offset,
int size,
52 int lock,
int serial);
53 void *data()
const {
return (
void *) data_; }
54 int nbytes()
const {
return sizeof(int)*NData; }
56 const char *request_string()
const;
58 MemoryDataRequest::Request request()
const {
return (Request) data_[0]; }
59 int node()
const {
return data_[1]; }
60 int offset()
const {
return data_[2]; }
61 int size()
const {
return data_[3]; }
62 int serial_number()
const {
return data_[4]; }
63 int lock()
const {
return data_[5]; }
65 int touches_data()
const {
return request()!=Deactivate&&request()!=Sync;}
68 int reactivate()
const {
return data_[2]; }
72 void print(
const char* msg = 0, std::ostream & o =
ExEnv::out0())
const;
77 enum { MaxDepth = 1024 };
83 int n()
const {
return n_; }
88 void clear() { n_ = 0; }
97 virtual void retrieve_data(
void *,
int node,
int offset,
int size,
99 virtual void replace_data(
void *,
int node,
int offset,
int size,
101 virtual void sum_data(
double *data,
int node,
int doffset,
int dsize) = 0;
117 void sum_reduction(
double *data,
distsize_t doffset,
int dsize);
118 void sum_reduction_on_node(
double *data,
size_t doffset,
int dsize,
void release_writeonly(void *data, distsize_t offset, int size)
This is called when write access is no longer needed.
void set_localsize(size_t)
Set the size of locally held memory.
void * obtain_writeonly(distsize_t offset, int size)
This gives write access to the memory location. No locking is done.
distsize_t offset(int node)
Returns the global offset to node's memory.
Definition: memory.h:168
A template class that maintains references counts.
Definition: ref.h:332
int size(int node)
Returns the amount of memory residing on node.
Definition: memory.h:165
void * localdata()
Returns a pointer to the local data.
void print(std::ostream &o=ExEnv::out0()) const
Prints out information about the object.
void release_readonly(void *data, distsize_t offset, int size)
This is called when read access is no longer needed.
void * obtain_readwrite(distsize_t offset, int size)
Only one thread can have an unreleased obtain_readwrite at a time.
void release_readwrite(void *data, distsize_t offset, int size)
This is called when read/write access is no longer needed.
The ActiveMsgMemoryGrp abstract class specializes the MsgMemoryGrp class.
Definition: memamsg.h:93
static std::ostream & out0()
Return an ostream that writes from node 0.
A MsgMemoryGrp that initializes its data using a messagegrp.
Definition: memmsg.h:41
void * obtain_readonly(distsize_t offset, int size)
This gives read access to the memory location. No locking is done.
Generated at Sun Jan 26 2020 23:33:04 for MPQC
2.3.1 using the documentation package Doxygen
1.8.16.