---
name: "PGASetCommunicator"
section: "3"
platform: "linux"
package: "pgapack"
version: "1.0.0.1-3"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/PGASetCommunicator"
---

# PGASetCommunicator(3)

Set the default communicator to use when PGARun is called. Does not necessarily need to be the same as the number of processes in MPI\_COMM\_WORLD (which is the default).

## NAME

PGASetCommunicator - Set the default communicator to use when PGARun is called.  Does not necessarily need to be the same as the number of processes in MPI\_COMM\_WORLD (which is the default).

## INPUT PARAMETERS

- ctx

  \- context variable

- comm

  \- communicator to use

## OUTPUT PARAMETERS

- none

  ## SYNOPSIS

```
#include "pgapack.h"
void  PGASetCommunicator(ctx, comm)
PGAContext *ctx
MPI_Comm comm
```

## LOCATION

parallel.c

## EXAMPLE

```
Example:
MPI_Comm mycomm;
PGAContext *ctx,
double f(PGAContext *ctx, int p, int pop);
:
ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
PGASetCommunicator(ctx, mycomm);
PGASetUp(ctx);
PGARun(ctx, f);
PGADestroy(ctx);
```
