Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add modern poisson2d solver & rename optimized.f90 #23

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Commits on Jun 29, 2021

  1. Configuration menu
    Copy the full SHA
    39c006a View commit details
    Browse the repository at this point in the history
  2. feat: add modernized poisson2d solver

    Refactorings
    ------------
    1. Use BLOCK for tighter variable scoping (reduces some clutter).
    2. Use array statements with vector subscripts to write compact
       initializations.
    3. Use DO CONCURRENT to express fine-grained parallelism and
       expose opportunities for optimizations such as vectorization,
       multithreading, or  GPU offloading.
    4. Replace some magic values, e.g., initial delta.
    5. Eliminate some unnecessary computation by initializing and
       updating only values that actually need initializing and
       updating.
    6. Use more compact conditional logic.
    7. Use a real kind specificaiton based on precision requirements
       rather than the ambiguously defined double-precision
       representation of any one given compiler on any one given
       platform.
    8. Eliminate unnecessary precision specifiers ("_dp") when an
       expression is simply a constant that is exactly representable
       in any reasonable floating-point representation.
    9. Separate the procedure interface into a module and the
       procedure definition into a submodule.**
    10. Use a more descriptive variable names in a few places.
    11. Add comments! (includeing some in FORD style)
    
    ** In larger projects, item 9 makes code much more user-friendly
    by isolation the application programmer interface (API) and
    reduces compile times by eliminating unnecessary compilation
    cascades.
    rouson committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    a7ccf54 View commit details
    Browse the repository at this point in the history
  3. rename optimized.f90 to archaic.f90

    This code is old-fashioned, verbose, and most importantly, less
    clealry expressive, particularly in terms of exposing optimization
    opportunties, which makes the file name a misnomer.  By contrast,
    commit a7ccf54 introduces a modern.f90 refactored to expose
    concurrency more explicitly through the use of `do concurrent`
    and array statements, both of which express sets of operations
    that can be safely executed in any order, opening up opportunities
    for vectorization, multithreading, and GPU offloading.
    
    In timings on a 2.3 GHz 8-Core Intel Core i9, modern.f90 executes
    in roughly the same time -- possibly 5-10% longer based on informal
    ad hoc testing -- but is considerably more compact in many places,
    is arguably more clear and expressive.
    rouson committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    da910c0 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    648739c View commit details
    Browse the repository at this point in the history
  5. Update poisson2d/modern.f90

    Either is fine. I'm a minimalist so I use the first one because the `_dp` isn't required when the real literal is exactly representable in the chosen floating-post representation, which presumably is the case for `1.` in any floating-point scheme.
    
    Co-authored-by: Ondřej Čertík <[email protected]>
    rouson and certik authored Jun 29, 2021
    Configuration menu
    Copy the full SHA
    f8768cd View commit details
    Browse the repository at this point in the history
  6. Update poisson2d/modern.f90

    I concur that `_dp` is required in this one.
    
    Co-authored-by: Ondřej Čertík <[email protected]>
    rouson and certik authored Jun 29, 2021
    Configuration menu
    Copy the full SHA
    5563ae2 View commit details
    Browse the repository at this point in the history
  7. Update poisson2d/modern.f90

    Co-authored-by: Ondřej Čertík <[email protected]>
    rouson and certik authored Jun 29, 2021
    Configuration menu
    Copy the full SHA
    7b63bc9 View commit details
    Browse the repository at this point in the history
  8. Update poisson2d/modern.f90

    Co-authored-by: Milan Curcic <[email protected]>
    rouson and milancurcic authored Jun 29, 2021
    Configuration menu
    Copy the full SHA
    f5ec218 View commit details
    Browse the repository at this point in the history
  9. Update poisson2d/modern.f90

    Co-authored-by: Ondřej Čertík <[email protected]>
    rouson and certik authored Jun 29, 2021
    Configuration menu
    Copy the full SHA
    bd22c45 View commit details
    Browse the repository at this point in the history
  10. Update poisson2d/modern.f90

    Co-authored-by: Milan Curcic <[email protected]>
    rouson and milancurcic authored Jun 29, 2021
    Configuration menu
    Copy the full SHA
    fcb0cd0 View commit details
    Browse the repository at this point in the history