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.
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):
You can also enable the C/C++ formatter as default and allow Format on Save, that way your code will be automatically formatted.
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:
Click on Quick Fix, and select the option: