Install OpenMP from source

Reading time: 10 minutes

In this guide, we will walk you through the installation steps of OpenMP in three simple steps.

OpenMP (Open Multi-Processing) is a library that is used to make programs execute in a parallel fashion. It supports multi-platform shared memory multiprocessing programming in C, C++, and Fortran on most platforms, instruction set architectures (like AVX) and operating systems (like Solaris, AIX, HP-UX, Linux, macOS, and Windows). It consists of a set of compiler directives, library routines, and environment variables that influence run-time behavior.

OpenMP_logo

Get your source code

You need to clone the source code of OpenMP to your local workspace using the following command:


git clone https://github.com/llvm-mirror/openmp.git
cd openmp

Build and prepare OpenMP

As the next step, you need to build the source of OpenMP using the following command:


mkdir build
cd build
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ..

Install OpenMP

You need to install OpenMP and get the shared library:


make
make install

If you want the shared library to a particular location (say <path_to_your_destination>), then replace "make install" by:


make PREFIX=<path_to_your_destination> install

Enjoy the power of parallel execution, you have install OpenMP