Skip to content

Add OpenMP support.#42

Open
markwoodhouse wants to merge 27 commits into
mainfrom
openmp
Open

Add OpenMP support.#42
markwoodhouse wants to merge 27 commits into
mainfrom
openmp

Conversation

@markwoodhouse

Copy link
Copy Markdown
Collaborator

OpenMP support can be optionally compiled so doesn't require a major refactor of the code. Therefore, it could be merged into the main branch without creating problems.

There are several efficiencies and optimizations (principally in avoiding repeated calculation of the gamma factor) that lead to substantial speedup even without parallelizing loops.

Documentation has been added, but is currently based on a separate branch. The implementation is noted as experimental and in development.

More pure subroutines requiring new error handling.
1 - the bug fixes and new closures in version 1.1.2 of the main branch are rolled in;

2 - the "curvature" parts that came into the openmp branch are removed.  This includes the blurring of the topography.

This should align the openmp branch as a "parallelized" version of main.  Note, there are several amendments in openmp vs main that have been retained to enable the openmp parallel loops and to further optimize code blocks (e.g. allowing subroutines/functions to be pure).
…ons with equivalent single threaded runs.

The parallel tests rely on the results directory being empty prior to the test running, and this is done in runall.jl.  The cause should be investigated.

The test input files also remove the unncessary %ListType tag.
…version. It requires that two executables are compiled (one serial, the other after configure --enable-parallel) and named kestrel_serial and kestrel_paral. The test checks that the results of each are identical (to a tolerance) and also reports the openmp speedup. Note, with the short test inputs, speedup is not necessarily expected as the openmp overhead on short runs is likely substantial.

Additionally, some code block/subroutines introduced into the openmp branch have been removed as they result in the test vs serial failing (specifically, the test is against serial compiled from the main branch).  These are mostly around neighbour tile identification, and adding tiles to the grid.

Other changes:
- removed left-over unused variable declarations related to curvature
- removed commented-out openmp parallel do in TimeStepper.f90 for morphodynamic update.
- minor changes to avoid computing 0.5*deltaX multiple times in UpdateTiles (probably the compiler optimization did this anyway, but this ensures it is done).
…rovide more user control and easier maintenance by reducing the number of files that have OpenMP specific elements.

1) Update OpenMP parallel directives to use runtime scheduling.

2) Remove setting of number of threads (nthreads) in the input file, delegating this to OpenMP environment variables.  This removes nthreads from RunSettings and SolverSettings.
Introduces temporary input files, that simply change the output directory, for parallel runs.  The output directories for serial and parallel runs are delete after the test.

Note, the parallel tests require exectuable binaries in bin with diffferent binaries for serial and parallel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant