28#ifndef _util_group_memamsg_h
29#define _util_group_memamsg_h
33#include <util/group/memmsg.h>
40 enum Request { Deactivate, Sync, Retrieve, Replace, DoubleSum };
53 int lock = 0,
int serial = 0);
54 void assign(Request r,
int node,
long offset,
long size,
55 int lock,
int serial);
56 void *data()
const {
return (
void *) &data_; }
57 int nbytes()
const {
return sizeof(data_); }
59 const char *request_string()
const;
61 MemoryDataRequest::Request request()
const {
return data_.request; }
62 int node()
const {
return data_.node; }
63 long offset()
const {
return data_.offset; }
64 long size()
const {
return data_.size; }
65 int serial_number()
const {
return data_.serial_number; }
66 int lock()
const {
return data_.lock; }
68 int touches_data()
const {
return request()!=Deactivate&&request()!=Sync;}
71 int reactivate()
const {
return data_.offset; }
75 void print(
const char* msg = 0, std::ostream & o =
ExEnv::out0())
const;
81 enum { MaxDepth = 1024 };
87 int n()
const {
return n_; }
92 void clear() { n_ = 0; }
101 virtual void retrieve_data(
void *,
int node,
long offset,
long size,
103 virtual void replace_data(
void *,
int node,
long offset,
long size,
105 virtual void sum_data(
double *data,
int node,
long doffset,
long dsize) = 0;
The ActiveMsgMemoryGrp abstract class specializes the MsgMemoryGrp class.
Definition memamsg.h:97
void release_readonly(void *data, distsize_t offset, size_t size)
This is called when read access is no longer needed.
void set_localsize(size_t)
Set the size of locally held memory.
void print(std::ostream &o=ExEnv::out0()) const
Prints out information about the object.
void * obtain_writeonly(distsize_t offset, size_t size)
This gives write access to the memory location. No locking is done.
void release_readwrite(void *data, distsize_t offset, size_t size)
This is called when read/write access is no longer needed.
void * obtain_readwrite(distsize_t offset, size_t size)
Only one thread can have an unreleased obtain_readwrite at a time.
void release_writeonly(void *data, distsize_t offset, size_t size)
This is called when write access is no longer needed.
void sum_reduction(double *data, distsize_t doffset, size_t dsize)
Perform a sum reduction on double 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 * localdata()
Returns a pointer to the local data.
void write(const void *data, distsize_t offset, size_t size)
This is used to write data directly.
void * obtain_readonly(distsize_t offset, size_t size)
This gives read access to the memory location. No locking is done.
static std::ostream & out0()
Return an ostream that writes from node 0.
This is a help class used by ActiveMsgMemoryGrp.
Definition memamsg.h:79
This is a help class used by ActiveMsgMemoryGrp.
Definition memamsg.h:38
int size(int node)
Returns the amount of memory residing on node.
Definition memory.h:161
distsize_t offset(int node)
Returns the global offset to node's memory.
Definition memory.h:164
A MsgMemoryGrp that initializes its data using a messagegrp.
Definition memmsg.h:37
A template class that maintains references counts.
Definition ref.h:361
Contains all MPQC code up to version 3.
Definition mpqcin.h:14