---
name: "environment"
section: "2rheolef"
platform: "linux"
package: "librheolef-dev"
version: "7.2-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/environment"
---

# environment(2rheolef)

initialization of distributed computations (rheolef-7.2)

## NAME

environment - initialization of distributed computations (rheolef-7.2)

## DESCRIPTION

This class is mainly used to initialize the MPI library: it should be called juste after the `main(argc,argv)` declaration:

```
    #include 'rheolef.h'
    using namespace rheolef;
    int main (int argc, char**argv) {
      environment rheolef (argc, argv);
      ...
    }
```

 An optional third argument of the `environment` constructor allows one to set the MPI thread feature. By default, its value is `MPI_THREAD_MULTIPLE`, as defined in `mpi.h`. Other possible values are related to MPI multi-threaded: see the MPI documentation for more details.

When compiling in a non-distributed **configuration** of the Rheolef library, this is a do-nothing class.

## NOTE

The interface of this class is inspirated from the `boost::mpi::environment` class. Instead of the `boost` implementation that calls `MPI_Init()`, here this class calls `MPI_Init_thread()` instead. This extension allows one to support the `scotch` library when it has been compiled with the threads feature.

## IMPLEMENTATION

This documentation has been generated from file linalg/lib/environment.h

```
class environment {
public:
  environment (int& argc, char**& argv, const environment_option_type& opt = environment_option_type());
  ~environment();
```

```
};
```

```
struct environment_option_type {
  static const int no_thread = 100;
```

```
  static const int default_thread = MPI_THREAD_MULTIPLE;
```

```
  environment_option_type() : thread_level (default_thread) {}
  int thread_level ;
};
```

## AUTHOR

Pierre  Saramito  \<Pierre.Saramito@imag.fr\>

## COPYRIGHT

Copyright   (C)  2000-2018  Pierre  Saramito  \<Pierre.Saramito@imag.fr\> GPLv3+: GNU GPL version 3 or later  \<http://gnu.org/licenses/gpl.html\>. This  is  free  software:  you  are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
