Repository navigation
Port to Ginkgo develop and reuse the Multigrid hierarchy - #171
Merged
Merged
Conversation
Ginkgo develop removed EnableLinOp and EnablePolymorphicObject. Custom LinOps now derive from gko::LinOp and gko::EnableCloneable, and the stopping criterion derives from gko::stop::Criterion directly. - port CombinationMatrix, RepartDistMatrix, Adaptive and OpenFOAMDistStoppingCriterion to the new base classes - use get_diag_matrix/get_off_diag_matrix instead of the deprecated get_local_matrix/get_non_local_matrix of the distributed matrix - default to the Ginkgo branch rebased/pr-2099 (updatable PGM values)
When the caching period of a preconditioner ran out, the new preconditioner was only assigned to a local copy, so every later caching period reused the very first preconditioner. Replace the stored preconditioner instead. Also remove the Multigrid value update for cached preconditioners. It was guarded by GINKGO_WITH_OGL_EXTENSION, which is never defined (CMake sets GINKGO_WITH_OGL_EXTENSIONS), and used UpdateMatrixValue, which Ginkgo no longer provides.
Add the opt-in Multigrid option reuseHierarchy. If enabled, the preconditioner is generated via LinOpFactory::generate_reuse and the reuse data is kept in the object registry, so regenerations keep the recorded Pgm aggregates and transfer operators and only recompute the coarse matrices, smoothers and coarsest solver. If the matrix no longer fits the recorded hierarchy, the recording starts again. Supported for both the Schwarz and the Distributed Multigrid type.
With reuseHierarchy, the hierarchy recorded from the first matrix was kept for the whole run. The new option maxHierarchyReuses records it again from the current matrix after it has been reused that many times (default 0, never). The number of reuses is kept per system matrix in the solver properties and reset whenever the hierarchy is recorded.
Ginkgo develop now implements the reuse of the Multigrid hierarchy via generate_reuse (ginkgo-project/ginkgo#2117), which supersedes the closed PR #2099. Use develop as the default Ginkgo version and update the note on the lifetime of the reuse data: the result of generate_reuse is independent of its reuse data, which stays usable if generate_reuse throws.
The conda packages of OpenFOAM, as used in the openfoam-ginkgo images of exasim-project/openfoam-conda, do not install META-INFO, so OGL was compiled without WITH_ESI_VERSION. FOAM_API is only set by the ESI version, so accept it as well.
Use the openfoam-ginkgo-{cuda,rocm,sycl} images of
exasim-project/openfoam-conda: OpenFOAM v2512 on the Ginkgo develop
images (Ginkgo 0dfd8c5, including ginkgo-project/ginkgo#2117), where
OpenFOAM uses the MPI of the image, so Pstream and Ginkgo load the same
MPI. Dated tags, since the runner caches the images by name.
Sync the setup with NeoN:
- activate OpenFOAM through the activate.sh of the image instead of
setting the OpenFOAM environment by hand
- add the MPICH and CUDA paths back to PATH, launch the MPI tests with
the MPI of the image and start the ranks locally
- port the trigger script and drop the NeoN/NeoFOAM specific parts of
the cancel script
- drop the Kokkos options copied from NeoN
Also fix the trigger workflow: trigger on pushes to dev instead of
develop, only run in hpsim/OGL and not for PRs from forks, and remove
the step cancelling the pipelines after waiting for them.
Multigrid.hpp creates DevicePersistentBase<ReuseData> in several translation units, while its typeName is only defined in Base.cpp. Clang-based compilers warned about this (-Wundefined-var-template), so declare the explicit specialization in the header.
All MPI unit tests of the SYCL job failed in MPI_Init: the libfabric provider Intel MPI picks for the interconnect fails in the container (OFI EP enable failed: Cannot allocate memory). The tests run on one node, so use FI_PROVIDER=tcp.
OpenFOAM v2506 deprecated UPstream::commIntraHost in favour of commLocalNode, which every translation unit including ExecutorHandler.hpp warned about with v2512. Define OPENFOAM to the API version of the ESI version, as wmake does, and use commLocalNode from v2506 on.
Silences the CMP0135 developer warning of FetchContent.
After the unit tests, run the icoFoam cavity tutorial on 2 ranks with the pressure (p and pFinal) solved by GKOCG on the GPU executor of the job (cuda, hip, sycl). The job fails unless icoFoam completes, every pressure solve went through GKOCG, and the last pFinal solve reached its tolerance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR ports OGL to the current Ginkgo
developAPI and uses the reusable multigrid hierarchy ofLinOpFactory::generate_reusefrom ginkgo-project/ginkgo#2117, which is merged into Ginkgodevelopand supersedes the closed ginkgo-project/ginkgo#2099. It also moves the LRZ GitLab CI to images with Ginkgodevelopand OpenFOAM.Changes
Port to the current Ginkgo API
developremovedEnableLinOpandEnablePolymorphicObject:CombinationMatrix,RepartDistMatrixandAdaptivenow derive fromgko::LinOpandgko::EnableCloneable, andOpenFOAMDistStoppingCriterionderives fromgko::stop::Criterionget_diag_matrix()/get_off_diag_matrix()instead of the deprecatedget_local_matrix()/get_non_local_matrix()of the distributed matrixOGL_GINKGO_CHECKOUT_VERSIONdefaults todevelopMultigrid hierarchy reuse
reuseHierarchy(defaultfalse), for both theSchwarzandDistributedtypeLinOpFactory::generate_reuse, and the reuse data is kept in the object registry. Regenerations keep the recorded Pgm aggregates and transfer operators and only recompute the coarse matrices, smoothers and the coarsest solvermaxHierarchyReuses(default0, no limit): once the hierarchy has been reused that many times, the next regeneration records it again from the current matrix. The reuse count is kept per system matrix and reset whenever the hierarchy is recordedLRZ GitLab CI
openfoam-ginkgo-{cuda,rocm,sycl}images of exasim-project/openfoam-conda: OpenFOAM v2512 on the Ginkgodevelopimages (Ginkgo0dfd8c5, the merge of Enable PGM to reuse aggregates with thegenerate_reuse. ginkgo-project/ginkgo#2117). OpenFOAM uses the MPI of the image, so Pstream and Ginkgo load the same MPI. Dated tags, since the runner caches images by nameactivate.sh, restore the MPICH/CUDA paths, launch the MPI tests with the MPI of the image and start the ranks locally, port the trigger script, drop the NeoN-specific parts and the Kokkos optionsdev(wasdevelop), only in hpsim/OGL and not for PRs from forks, and no longer cancel the pipelines after waiting for themFOAM_API, since the conda packages do not installMETA-INFOFixes
cachingperiod of a preconditioner ran out, the regenerated preconditioner was not stored, so every later caching period reused the very first preconditionerGINKGO_WITH_OGL_EXTENSION, while CMake definesGINKGO_WITH_OGL_EXTENSIONS) and usedUpdateMatrixValue, which Ginkgo no longer providesUsage
The hierarchy is recorded from the first matrix, so reuse only pays off if later matrices are similar to it.
maxHierarchyReuseslimits how far the matrix can drift from the recorded one.Compatibility
This branch no longer builds against the previous default Ginkgo (
ogl_0600_gko190). It needs Ginkgodevelopwith ginkgo-project/ginkgo#2117, which is now the default checkout. All sources compile against Ginkgodevelop(d5a8402, syntax-only check).Testing
icoFoamon the 100x100 lid-driven cavity, 2 ranks on 2x AMD MI200 (gfx90a, ROCm 6.4.3),GKOCGwithexecutor hipandscaling -1, run to t = 0.5 (200 pressure solves).Measured on
rebased/pr-2099, before ginkgo-project/ginkgo#2117 was merged; not yet re-run ondevelop. The new Ginkgo API gives the same results as the previous Ginkgo. Pressure iterations in the last time step:rebased/pr-2099PCG+ diagonal)Multigrid hierarchy reuse (Multigrid regenerates on every solve unless
cachingis set):reuseHierarchyreuseHierarchyreuseHierarchy+caching 5The final p and U fields at t = 0.5 are identical, to the written precision, with and without reuse and to the OpenFOAM baseline. The re-recording after a sparsity change is not covered, since the cavity mesh is static.
maxHierarchyReuseshas not been tested on GPUs yet.The LRZ pipeline on the new images has not run yet; this PR is its first run.