Skip to content

OMP Runs

In EFDC+ the code has been upgraded to support multi-threading capabilities and provide vastly improved model run times compared to conventional EFDC models. Open Multi-Processing (OMP) is an API designed to facilitate the use of multi-threaded programming. It does this by creating and synchronizing threads automatically at the user's command. Depending on the machine topology, application, and operating system, thread affinity can have a dramatic effect on the application speed. Both the Two Time Level (2TL) and Three-Time Level (3TL) solutions subroutines in EFDC+ allow for OMP, thereby providing significant speedup in model run time for users running with either of these solutions.

In the General frame of EFDC+ Run Options, set #OMP Cores Used and KMP Offset as shown in Figure 1. It is recommended not to set # OMP Cores Used greater than or equal to the Available CPU Cores. Setting the number of cores to the maximum number of cores will result in diminished performance.

The user may also set the KMP Offset, which is the core offset for the current run. More information about KMP Offset is described in KMP Offset Theory

Figure 1. EFDC+ Run Option Form.
Figure 1. EFDC+ Run Option Form.

Other options the user should configure include:

  • Run Time Status

This contains the settings for feedback to EFDC's runtime window during the model run. The user selects a parameter to display for a grid cell which is defined by the L, I, J indices. The number in the Print Interval: specifies the number of time steps after which the output written in the Model runtime Window is refreshed.

  • EFDC+ Explorer Post Processing and Linkage

Output interval: Set time for EE to the write output frequency

Write EE_Arrays.out Linkage file (optional): These arrays can be output if the user is interested in analyzing outputs that are beyond the standard outputs for model verification or research purposes. These outputs include Horizontal Eddy Viscosity (AH), Vertical Viscosity (AV), Turbulence (QQ), and Layer Thickness (HPK). If horizontal diffusivity is turned on for Turbulence, then additional outputs are generated. These include horizontal diffusion in XX (FMDUX), XY (FMDUY), YY (FMDVX), and YX (FMDVY). For more details about linkage files, please refer to the EFDC+ documentation. The users that can compile EFDC+ source code can specify the outputs that can be written in these linkage files.

Auto-generate Calibration Plots & Statistics: EE has an option of automatically generating calibration plots and statistics. In order to accomplish this, a file named "0run" is created as a flag that tells EE that the model is still running or has crashed. When this is not the case, EE automatically generates the plots and statistics. If the user opens a new EFDC+ model with the same instance of EE while the EFDC+ model is running, the automatic plot/statistics generation function is aborted. A new EE window should be opened if the user needs to open another EFDC model.

When EFDC+ finishes execution, the model waits for the user to press a key to continue/exit. If the user does not want the pause function, they may check the box Do not pause when the run completes on the EFDC+ Run Options form.

In case the user opens the model that already has output from an older run, Overwrite the existing model outputs? box appears. The model can run only if the user checks on this box to overwrite results. If the user wants to preserve the output from a previous run, then they must save the existing model as a new model.

Executable: The user should browse to the correct EFDC executable to run the model. The default executable is generally located in the installation folder (e.g. C:\Program Files\DSI\EEMS10.X).

When using OMP, it is possible to use the KMP Offset option*,* which is the core offset for the current run. This option is not applicable for MPI runs. The KMP Offset relates to the number of cores already being used by the system and is, therefore, usually set to zero. The KMP Offset should only be adjusted if the user wishes to run more than one model on the same machine. In order to run the second model, the KMP Offset should be set to the number of cores being used in the already running model. For example, if you are using a machine with 16 cores, 32 threads, then

  • Run 1: # Threads = 8, KMP Offset = 0
  • Run 2: # Threads = 8, KMP Offset = 8

This will lock each thread to a unique core. Run 1 will be using 8 cores and Run 2 the other 8 cores. The total CPU usage will only show 50% because those calculations are based on the total number of threads, i.e. 32.

A typical Intel I7 computer has from 4 to 6 cores. The way these cores are handled in the EFDC code is with the KMP_AFFINITY variable, defined as:

KMP_AFFINITY=[<modifier>,...]<type>[,<permute>][,<offset>]

For example, to list a machine topology map, specify "KMP_AFFINITY=verbose, none" to use a modifier of verbose and a type of none.

"KMP_AFFINITY = granular = fine, compact, 1,0", will assign individual threads to different cores. When it assigns the threads it also spreads them out. If the modifier is set to verbose, then a map of threads will also be produced.

Note that the file "0_RunEFDC" is created in the model folder each time the EFDC+ model is run. This file is also used by EE to determine whether the model ran to completion or not, as it is deleted on successful model completion. If the user opens that file then they can see the KMP offset-related parameters

Figure 1 illustrates the binding of the OpenMP thread to hardware thread contexts when specifying "KMP_AFFINITY=granularity=fine, compact".

Figure 1. Open MP thread IDs (graphic courtesy of Intel).
Figure 1. Open MP thread IDs (graphic courtesy of Intel).

To learn more about the KMP_AFFINITY environment and the specific syntax that must be used, please visit the following website:
http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/cpp/mac/optaps/common/optaps_openmp_thread_affinity.htm