The section below will explain how to install openMPI on Linux, using APT, and how to setup the environment with VSCode and C/C++.

Note: The Open MPI Project is an open source Message Passing Interface implementation.

Installation:

To install openMPI, just run:

sudo apt install openmpi-bin openmpi-common libopenmpi-dev

After this, on VSCode, install these extensions to facilitate coding (IntelliSense mainly):

Untitled

Untitled

You can also enable the C/C++ formatter as default and allow Format on Save, that way your code will be automatically formatted.

Untitled

Untitled

Setup:

First, lets create a test c/cpp file, and write the following program:

#include <mpi.h>

int main(int argc, char *argv[]) {
  MPI_Init(&argc, &argv);
  MPI_Finalize();
  return 0;
}

We expect to see the following error:

Untitled

Click on Quick Fix, and select the option: