Skip to content

GPU Assembly of LOR DG Preconditioner #4834

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

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open

Conversation

Toni-ko
Copy link

@Toni-ko Toni-ko commented Apr 28, 2025

This pr adds a batched gpu assembly of the lor dg preconditioner. New preconditioner is used in the lor solvers miniapp. A unit test is added to compare with legacy implementation.

PR Author Editor Reviewers Assignment Approval Merge
#4834 @Toni-ko @tzanio @pazner + @tzanio + @YohannDudouit 4/30/25 4/30/25 ⌛due 5/21/25
PR Checklist
  • Code builds.
  • Code passes make style.
  • Update CHANGELOG:
    • Is this a new feature users need to be aware of? New or updated example or miniapp?
    • Does it make sense to create a new section in the CHANGELOG to group with other related features?
  • Update INSTALL:
    • Had a new optional library been added? If so, what range of versions of this library are required? (Make sure the external library is compatible with our BSD license, e.g. it is not licensed under GPL!)
    • Have the version ranges for any required or optional libraries changed?
    • Does make or cmake have a new target?
    • Did the requirements or the installation process change? (rare)
  • Update continuous integration server configurations if necessary (e.g. with new version requirements for each of MFEM's dependencies)
    • .github
    • .appveyor.yml
  • Update .gitignore:
    • Check if make distclean; git status shows any files that were generated from the source by the project (not an IDE) but we don't want to track in the repository.
    • Add new patterns (just for the new files above) and re-run the above test.
  • New examples:
    • All sample runs at the top of the example source file work.
    • Update examples/makefile:
      • Add the example code to the appropriate SEQ_EXAMPLES and PAR_EXAMPLES variables.
      • Add any files generated by it to the clean target.
      • Add the example binary and any files generated by it to the top-level .gitignore file.
    • Update examples/CMakeLists.txt:
      • Add the example code to the ALL_EXE_SRCS variable.
      • Make sure THIS_TEST_OPTIONS is set correctly for the new example.
    • List the new example in doc/CodeDocumentation.dox.
    • If new examples directory (e.g.examples/pumi), list it in doc/CodeDocumentation.conf.in
    • Companion pull request for documentation in mfem/web repo:
      • Update or add example-specific documentation, see e.g. the src/examples.md.
      • Add the description, labels and screenshots in src/examples.md and src/img.
      • In examples.md, list the example under the appropriate categories, add new categories if necessary.
      • Add a short description of the example in the "Extensive Examples" section of features.md.
  • New miniapps:
    • All sample runs at the top of the miniapp source file work.
    • Update top-level makefile and makefile in corresponding miniapp directory.
    • Add the miniapp binary and any files generated by it to the top-level .gitignore file.
    • Update CMake build system:
      • Update the CMakeLists.txt file in the miniapps directory, if the new miniapp is in a new directory.
      • Add/update the CMakeLists.txt file in the new miniapp directory.
      • Consider adding a new test for the new miniapp.
    • List the new miniapp in doc/CodeDocumentation.dox
    • If new miniapps directory (e.g.miniapps/nurbs), add it to MINIAPP_SUBDIRS in the makefile.
    • If new miniapps directory (e.g.miniapps/nurbs), list it in doc/CodeDocumentation.conf.in
    • Companion pull request for documentation in mfem/web repo:
      • Update or add miniapp-specific documentation, see e.g. the src/meshing.md and src/electromagnetics.md files.
      • Add the description, labels and screenshots in src/examples.md and src/img.
      • The miniapps go at the end of the page, and are usually listed only under a specific "Application (PDE)" category.
      • Add a short description of the miniapp in the "Extensive Examples" section of features.md.
  • New capability:
    • All new public, protected, and private classes, methods, data members, and functions have full Doxygen-style documentation in source comments. Documentation should include descriptions of member data, function arguments and return values, template parameters, and prerequisites for calling new functions.
    • Pointer arguments and return values must specify whether ownership is being transferred or lent with the call.
    • Any new functions should include descriptions of their intended use e.g. for internal use only, user-facing, etc., along with references to example code whenever possible/appropriate.
    • Consider adding new sample runs in existing examples to highlight the new capability.
    • Consider saving cool simulation pictures with the new capability in the Confluence gallery (LLNL only) or submitting them, via pull request, to the gallery section of the mfem/web repo.
    • If this is a major new feature, consider mentioning it in the short summary inside README (rare).
    • List major new classes in doc/CodeDocumentation.dox (rare).
  • Update this checklist, if the new pull request affects it.
  • Run make unittest to make sure all unit tests pass.
  • Run the tests in tests/scripts.
  • (LLNL only) After merging:
    • Update internal tests to include the new features.

@Toni-ko Toni-ko requested a review from pazner April 28, 2025 22:20
@Toni-ko Toni-ko self-assigned this Apr 28, 2025
@tzanio
Copy link
Member

tzanio commented Apr 30, 2025

This PR is now under review (see the table in the PR description). To help with the review process, please do not force push to the branch.

@tzanio tzanio self-requested a review April 30, 2025 15:51
@tzanio tzanio added the in-next label Apr 30, 2025
@tzanio tzanio requested a review from YohannDudouit April 30, 2025 15:51
@tzanio tzanio removed the in-next label Apr 30, 2025
@github-project-automation github-project-automation bot moved this to Review Now in Pull Requests Apr 30, 2025
@tzanio tzanio added this to the mfem-4.9 milestone Apr 30, 2025
@tzanio tzanio requested a review from Copilot April 30, 2025 15:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces GPU‐accelerated assembly for the LOR DG preconditioner used in the LOR solvers miniapp. Key changes include the addition of batched GPU assembly kernels and associated tests, updated mesh permutation utilities and integration rule handling, and modifications to penalty parameter scaling in the DG discretizations.

Reviewed Changes

Copilot reviewed 16 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/linalg/test_same_matrices.hpp New utility to compare matrices for unit tests.
tests/unit/fem/test_lor_dg.cpp Unit tests updated for LOR DG preconditioner using batched assembly.
tests/unit/fem/test_lor_batched.cpp Refactored tests to remove redundant implementations for DG.
tests/unit/fem/test_face_permutation.cpp Mesh permutation tests now use new MeshOrientation helpers.
tests/unit/fem/make_permuted_mesh.{hpp,cpp} Refactored mesh permutation functionality for clarity and consistency.
miniapps/solvers/plor_solvers.cpp & lor_solvers.cpp Updated assembly-level conditions and changed penalty scaling (kappa) to 10×(order+1)².
fem/pfespace.hpp Added accessor for the face neighbor global dof map.
fem/lor/lor_dg_impl.hpp & lor_dg.hpp Introduced GPU assembly implementation for DG preconditioning with new methods for face info and boundary penalty factor computation.
fem/lor/lor_batched.{hpp,cpp} Extended batched LOR assembly support for DG spaces with customized CSR conversion routines.
fem/lininteg.hpp Minor documentation update for DGDiffusionIntegrator error terms.
fem/fe/face_map_utils.hpp Added new inline function to compute face-to-volume index mapping.
fem/bilininteg.hpp Exposed DG penalty parameter via a new getter in DGDiffusionIntegrator.
Files not reviewed (2)
  • fem/CMakeLists.txt: Language not supported
  • tests/unit/CMakeLists.txt: Language not supported

Co-authored-by: Will Pazner <11493037+pazner@users.noreply.github.com>
Copy link
Member

@pazner pazner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Toni-ko for this contribution!

Looks good to me, but I was also heavily involved in the PR, so we should get two more independent approvals.

pazner added 3 commits May 16, 2025 20:25
@pazner
Copy link
Member

pazner commented Jun 3, 2025

BTW @YohannDudouit, the preconditioner is defined in section 4.5 of this paper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review Now
Development

Successfully merging this pull request may close these issues.

4 participants