---
name: "sc_MemoryGrpBuf"
section: "3"
platform: "linux"
package: "libsc-doc"
version: "2.3.1-22"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/sc_MemoryGrpBuf"
---

# sc\_MemoryGrpBuf(3)

The MemoryGrpBuf class provides access to pieces of the global shared memory that have been obtained with MemoryGrp.

## NAME

sc::MemoryGrpBuf\< data\_t \> - The **MemoryGrpBuf** class provides access to pieces of the global shared memory that have been obtained with **MemoryGrp**.

## SYNOPSIS

`#include <memory.h>`

### Public Member Functions

**MemoryGrpBuf** (const **Ref**\< **MemoryGrp** \> &)\
 Creates a new **MemoryGrpBuf** given a **MemoryGrp** reference.  data\_t \* **writeonly** (**distsize\_t** offset, int **length**)\
 Request write only access to global memory at the global address offset and with size length.  data\_t \* **readwrite** (**distsize\_t** offset, int **length**)\
 Request read write access to global memory at the global address offset and with size length.  const data\_t \* **readonly** (**distsize\_t** offset, int **length**)\
 Request read only access to global memory at the global address offset and with size length.  data\_t \* **writeonly\_on\_node** (size\_t offset, int **length**, int node=-1)\
 These behave like writeonly, readwrite, and readonly, except the offset is local to the node specified by node.  data\_t \* **readwrite\_on\_node** (size\_t offset, int **length**, int node=-1)\
 const data\_t \* **readonly\_on\_node** (size\_t offset, int **length**, int node=-1)\
 void **release** ()\
 Release the access to the chunk of global memory that was obtained with writeonly, readwrite, readonly, writeonly\_on\_node, readwrite\_on\_node, and readonly\_on\_node.  int **length** () const\
 The length of the current bit of memory.

## Detailed Description

### template\<class data\_t\>

class sc::MemoryGrpBuf\< data\_t \>"The **MemoryGrpBuf** class provides access to pieces of the global shared memory that have been obtained with **MemoryGrp**.

**MemoryGrpBuf** is a template class that is parameterized on data\_t. All lengths and offsets of given in terms of sizeof(data\_t).

## Constructor & Destructor Documentation

### template\<class data\_t \> sc::MemoryGrpBuf\< data\_t \>::MemoryGrpBuf (const Ref\< MemoryGrp \> & grp)

Creates a new **MemoryGrpBuf** given a **MemoryGrp** reference. This is a template class parameterized on data\_t.

## Member Function Documentation

### template\<class data\_t \> const data\_t \* sc::MemoryGrpBuf\< data\_t \>::readonly (distsize\_t offset, int length)

Request read only access to global memory at the global address offset and with size length. Writing to the specified region without an intervening sync of the **MemoryGrp** will have undefined results.

### template\<class data\_t \> data\_t \* sc::MemoryGrpBuf\< data\_t \>::readwrite (distsize\_t offset, int length)

Request read write access to global memory at the global address offset and with size length. This will lock the memory it uses until release is called unless locking has been turned off in the **MemoryGrp** object.

### template\<class data\_t \> data\_t \* sc::MemoryGrpBuf\< data\_t \>::writeonly (distsize\_t offset, int length)

Request write only access to global memory at the global address offset and with size length. Writing the same bit of memory twice without an intervening sync of the **MemoryGrp** will have undefined results.

### template\<class data\_t \> data\_t \* sc::MemoryGrpBuf\< data\_t \>::writeonly\_on\_node (size\_t offset, int length, int node = `-1`)

These behave like writeonly, readwrite, and readonly, except the offset is local to the node specified by node. If node = -1, then the local node is used.

## Author

Generated automatically by Doxygen for MPQC from the source code.
