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

# sc\_MPIMessageGrp(3)

The MPIMessageGrp class is an concrete implementation of MessageGrp that uses the MPI 1 library.

## NAME

sc::MPIMessageGrp - The **MPIMessageGrp** class is an concrete implementation of **MessageGrp** that uses the MPI 1 library.

## SYNOPSIS

`#include <messmpi.h>`

Inherits **sc::MessageGrp**.

### Public Member Functions

**MPIMessageGrp** (MPI\_Comm comm)\
 Use an MPI communicator to create a **MessageGrp**.  **MPIMessageGrp** (int \*argc, char \*\*\*argv)\
 Use argc and argv to create a **MPIMessageGrp**.  **MPIMessageGrp** (const **Ref**\< **KeyVal** \> &)\
 Construction **MPIMessageGrp** given a **KeyVal** input object.  **Ref**\< **MessageGrp** \> **clone** (void)\
 Clones (dups) an **MPIMessageGrp** from MPI\_COMM\_WORLD.  void **raw\_send** (int target, const void \*data, int nbyte)\
 void **raw\_recv** (int sender, void \*data, int nbyte)\
 void **raw\_sendt** (int target, int type, const void \*data, int nbyte)\
 void **raw\_recvt** (int type, void \*data, int nbyte)\
 int **probet** (int type)\
 Ask if a given typed message has been received.  void **sync** ()\
 Synchronize all of the processors.  void **sum** (double \*, int **n**, double \*scratch=0, int target=-1)\
 Global sum reduction.  void **sum** (int \*, int **n**, int \*scratch=0, int target=-1)\
 void **reduce** (double \*, int **n**, **GrpReduce**\< double \> &, double \*scratch=0, int target=-1)\
 Global generic reduction.  void **reduce** (unsigned int \*, int **n**, **GrpReduce**\< unsigned int \> &, unsigned int \*scratch=0, int target=-1)\
 void **reduce** (int \*, int **n**, **GrpReduce**\< int \> &, int \*scratch=0, int target=-1)\
 void **reduce** (char \*, int **n**, **GrpReduce**\< char \> &, char \*scratch=0, int target=-1)\
 void **reduce** (unsigned char \*, int **n**, **GrpReduce**\< unsigned char \> &, unsigned char \*scratch=0, int target=-1)\
 void **reduce** (signed char \*, int **n**, **GrpReduce**\< signed char \> &, signed char \*scratch=0, int target=-1)\
 void **reduce** (short \*, int **n**, **GrpReduce**\< short \> &, short \*scratch=0, int target=-1)\
 void **reduce** (float \*, int **n**, **GrpReduce**\< float \> &, float \*scratch=0, int target=-1)\
 void **reduce** (long \*, int **n**, **GrpReduce**\< long \> &, long \*scratch=0, int target=-1)\
 void **raw\_bcast** (void \*data, int nbyte, int from)\

### Protected Member Functions

void **init** (MPI\_Comm comm, int \*argc=0, char \*\*\*argv=0)\
 Not thread-safe due to race condition on nmpi\_grps variable.

### Protected Attributes

void \* **buf**\
 int **bufsize**\
 int **rnode**\
 int **rtag**\
 int **rlen**\
 bool **use\_messagegrp\_collectives\_**\
 If true use the generic collective routines in the base class.  **Ref**\< **ThreadGrp** \> **threadgrp**\
 MPI\_Comm **commgrp**\
 Currently each commgrp is a dup of MPI\_COMM\_WORLD.

### Static Protected Attributes

static int **nmpi\_grps**\
 Number of **MPIMessageGrp**'s currently in use.  static **Ref**\< **ThreadLock** \> **grplock**\
 lock to access nmpi\_grps variable

### Additional Inherited Members

## Detailed Description

The **MPIMessageGrp** class is an concrete implementation of **MessageGrp** that uses the MPI 1 library.

## Constructor & Destructor Documentation

### sc::MPIMessageGrp::MPIMessageGrp (MPI\_Comm comm)

Use an MPI communicator to create a **MessageGrp**. The comm argument could be a subset of MPI\_COMM\_WORLD, for example.

### sc::MPIMessageGrp::MPIMessageGrp (int \* argc, char \*\*\* argv)

Use argc and argv to create a **MPIMessageGrp**. This would have to be used for implementations of MPI that have MPI\_Init fill in argc and argv.

## Member Function Documentation

### Ref\< MessageGrp \> sc::MPIMessageGrp::clone (void)` [virtual]`

Clones (dups) an **MPIMessageGrp** from MPI\_COMM\_WORLD.

Implements **sc::MessageGrp**.

### int sc::MPIMessageGrp::probet (int type)` [virtual]`

Ask if a given typed message has been received.

Implements **sc::MessageGrp**.

### void sc::MPIMessageGrp::raw\_bcast (void \* data, int nbyte, int from)` [virtual]`

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::raw\_recv (int sender, void \* data, int nbyte)` [virtual]`

Implements **sc::MessageGrp**.

### void sc::MPIMessageGrp::raw\_recvt (int type, void \* data, int nbyte)` [virtual]`

Implements **sc::MessageGrp**.

### void sc::MPIMessageGrp::raw\_send (int target, const void \* data, int nbyte)` [virtual]`

Implements **sc::MessageGrp**.

### void sc::MPIMessageGrp::raw\_sendt (int target, int type, const void \* data, int nbyte)` [virtual]`

Implements **sc::MessageGrp**.

### void sc::MPIMessageGrp::reduce (char \*, int n, GrpReduce\< char \> &, char \* scratch = `0`, int target = `-1`)` [virtual]`

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::reduce (double \*, int n, GrpReduce\< double \> &, double \* scratch = `0`, int target = `-1`)` [virtual]`

Global generic reduction. Similar members exist for each of the basic types.

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::reduce (float \*, int n, GrpReduce\< float \> &, float \* scratch = `0`, int target = `-1`)` [virtual]`

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::reduce (int \*, int n, GrpReduce\< int \> &, int \* scratch = `0`, int target = `-1`)` [virtual]`

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::reduce (long \*, int n, GrpReduce\< long \> &, long \* scratch = `0`, int target = `-1`)` [virtual]`

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::reduce (short \*, int n, GrpReduce\< short \> &, short \* scratch = `0`, int target = `-1`)` [virtual]`

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::reduce (signed char \*, int n, GrpReduce\< signed char \> &, signed char \* scratch = `0`, int target = `-1`)` [virtual]`

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::reduce (unsigned char \*, int n, GrpReduce\< unsigned char \> &, unsigned char \* scratch = `0`, int target = `-1`)` [virtual]`

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::reduce (unsigned int \*, int n, GrpReduce\< unsigned int \> &, unsigned int \* scratch = `0`, int target = `-1`)` [virtual]`

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::sum (double \* data, int n, double \* = `0`, int target = `-1`)` [virtual]`

Global sum reduction. Similar members exist for each of the basic types.

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::sum (int \*, int n, int \* scratch = `0`, int target = `-1`)` [virtual]`

Reimplemented from **sc::MessageGrp**.

### void sc::MPIMessageGrp::sync ()` [virtual]`

Synchronize all of the processors.

Reimplemented from **sc::MessageGrp**.

## Author

Generated automatically by Doxygen for MPQC from the source code.
