MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
memrdma.h
1//
2// memrdma.h
3// Based on memamsg.h
4//
5// Copyright (C) 1996 Limit Point Systems, Inc.
6//
7// Author: Curtis Janssen <cljanss@limitpt.com>
8// Maintainer: LPS
9//
10// This file is part of the SC Toolkit.
11//
12// The SC Toolkit is free software; you can redistribute it and/or modify
13// it under the terms of the GNU Library General Public License as published by
14// the Free Software Foundation; either version 2, or (at your option)
15// any later version.
16//
17// The SC Toolkit is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU Library General Public License for more details.
21//
22// You should have received a copy of the GNU Library General Public License
23// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
24// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25//
26// The U.S. Government is granted a limited license as per AL 91-7.
27//
28
29#ifndef _util_group_memrdma_h
30#define _util_group_memrdma_h
31
32#include <iostream>
33#include <vector>
34
35#include <util/group/pool.h>
36#include <util/group/memmsg.h>
37
38namespace sc {
39
43 protected:
44 char *data_;
45
46 virtual void retrieve_data(void *, int node, long offset, long size,
47 int lock) = 0;
48 virtual void replace_data(void *, int node, long offset, long size,
49 int unlock) = 0;
50 virtual void sum_data(double *data, int node, long doffset, long dsize) = 0;
51
52 std::vector<Pool*> pools_;
53 size_t default_pool_size_;
54 void* malloc_region(size_t nbyte);
55 void free_region(void*);
56 public:
60
61 void *localdata();
62
64
65 void *obtain_writeonly(distsize_t offset, size_t size);
66 void *obtain_readwrite(distsize_t offset, size_t size);
67 void *obtain_readonly(distsize_t offset, size_t size);
68 void release_readonly(void *data, distsize_t offset, size_t size);
69 void release_writeonly(void *data, distsize_t offset, size_t size);
70 void release_readwrite(void *data, distsize_t offset, size_t size);
71
72 void sum_reduction(double *data, distsize_t doffset, size_t dsize);
73 void sum_reduction_on_node(double *data, size_t doffset, size_t dsize,
74 int node = -1);
75
76 void print(std::ostream &o = ExEnv::out0()) const;
77};
78
79}
80
81#endif
82
83// Local Variables:
84// mode: c++
85// c-file-style: "CLJ"
86// End:
static std::ostream & out0()
Return an ostream that writes from node 0.
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
size_t localsize()
Returns the amount of memory residing locally on me().
Definition memory.h:155
A MsgMemoryGrp that initializes its data using a messagegrp.
Definition memmsg.h:37
The RDMAMemoryGrp abstract class specializes the MsgMemoryGrp class.
Definition memrdma.h:42
void * obtain_writeonly(distsize_t offset, size_t size)
This gives write access to the memory location. No locking is done.
void release_writeonly(void *data, distsize_t offset, size_t size)
This is called when write access is no longer needed.
void set_localsize(size_t localsize)
Set the size of locally held memory.
void * obtain_readonly(distsize_t offset, size_t size)
This gives read access to the memory location. No locking is done.
void release_readonly(void *data, distsize_t offset, size_t size)
This is called when read 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 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 print(std::ostream &o=ExEnv::out0()) const
Prints out information about the object.
void release_readwrite(void *data, distsize_t offset, size_t size)
This is called when read/write access is no longer needed.
void * localdata()
Returns a pointer to the local data.
A template class that maintains references counts.
Definition ref.h:361
Contains all MPQC code up to version 3.
Definition mpqcin.h:14

Generated at Wed Sep 25 2024 02:45:30 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.