OpenMP Critical

Program's name: OpenMP Critical
Available version(s): Programming language(s): C++ ·
Programming model(s): OpenMP ·
Uses following algorithm(s): Finite Difference Methods ·
Used in following discipline(s): Seismic Data Processing ·

An oil & gas code had the openmp-critical-section pattern and the computational aspects of the original code are recreated here. This application solves the 3D wave equation: \(\frac{\partial^{2}u}{\partial t^{2}} = c^{2}\nabla^{2}u\) using the pseudospectral method. However, for the WP7 kernel the finite difference method was selected for the purpose of simplicity, which re-creates the computational profile of the original code. The code contains a critical section within a parallel OpenMP loop, which greatly slows its performance.

The parameters Ni, Nj, and Nk are set within the source code and control the number of cells in the x-, y- and z-direction, respectively. Similarly, the number of time steps is controlled by the Nt variable. These variables are currently set to Ni=500, Nj=500, Nk=500 and Nt=20.

Building the code

Build using the Makefile provided by typing the make command. The makefile assumes that the Intel C++ compiler is being used. Note that the code must be compiled with the -std=c++14 flag, as well as -qopenmp to enable the compilation of the OpenMP directives.

Executing the code

The executable is called omp-critical.exe. Set the environment variable OMP_NUM_THREADS to set the desired number of OpenMP threads for the job.