# MVAPICH2 Performance Optimization Options

When using MVAPICH2 as the MPI library, you can configure inter-process communication algorithms by setting environment variables within your job script. The key options are listed below, and users can optimize execution performance by setting environment variables for collective communications that are heavily used within their code.

The <mark style="color:red;">**MV2\_INTRA**</mark> environment variable is used for MPI process communication within a node, while the <mark style="color:blue;">**MV2\_INTER**</mark> environment variable is used for MPI process communication between nodes. For MPI\_Alltoall, the same algorithm is applied for both INTRA and INTER cases. Routines for transmitting data of varying sizes (e.g., MPI\_Alltoallv) or non-blocking routines (e.g., MPI\_Ibcast), the same settings can be applied, and the configuration method is as follows:

* Key Environment Variables for MVAPICH2 Library Collective Communication

| MPI communication |                                                                             Environment variable                                                                            | Setting range |
| :---------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------: |
|    MPI\_Gather    |    <p><mark style="color:red;"><strong>MV2\_INTRA</strong></mark>\_GATHER\_TUNING</p><p><mark style="color:blue;"><strong>MV2\_INTER</strong></mark>\_GATHER\_TUNING</p>    |     0 \~ 3    |
|     MPI\_Bcast    |     <p><mark style="color:red;"><strong>MV2\_INTRA</strong></mark>\_BCAST\_TUNING</p><p><mark style="color:blue;"><strong>MV2\_INTER</strong></mark>\_BCAST\_TUNING</p>     |    0 \~ 10    |
|    MPI\_Scatter   |   <p><mark style="color:red;"><strong>MV2\_INTRA</strong></mark>\_SCATTER\_TUNING</p><p><mark style="color:blue;"><strong>MV2\_INTER</strong></mark>\_SCATTER\_TUNING</p>   |     1 \~ 5    |
|   MPI\_Allreduce  | <p><mark style="color:red;"><strong>MV2\_INTRA</strong></mark>\_ALLREDUCE\_TUNING</p><p><mark style="color:blue;"><strong>MV2\_INTER</strong></mark>\_ALLREDUCE\_TUNING</p> |     1 \~ 6    |
|    MPI\_Reduce    |    <p><mark style="color:red;"><strong>MV2\_INTRA</strong></mark>\_REDUCE\_TUNING</p><p><mark style="color:blue;"><strong>MV2\_INTER</strong></mark>\_REDUCE\_TUNING</p>    |     1 \~ 6    |
|   MPI\_Allgather  | <p><mark style="color:red;"><strong>MV2\_INTRA</strong></mark>\_ALLGATHER\_TUNING</p><p><mark style="color:blue;"><strong>MV2\_INTER</strong></mark>\_ALLGATHER\_TUNING</p> |    1 \~ 11    |
|   MPI\_Alltoall   |                                                                            MV2\_ALLTOALL\_TUNING                                                                            |     0 \~ 4    |

※ Usage example (when creating a bash script): export MV2\_INTER\_ALLREDUCE\_TUNING=2

※ For detailed explanations of each environment variable, refer to <http://mvapich.cse.ohio-state.edu/userguide/>

{% hint style="info" %}
Last updated on November 08, 2024.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-ksc.gitbook.io/nurion-user-guide-eng/appendix/appendix-4-method-for-using-the-mvapich2-performance-optimization-option.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
