Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • D dune-istl
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 32
    • Issues 32
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 29
    • Merge requests 29
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Core ModulesCore Modules
  • dune-istl
  • Merge requests
  • !478

WIP: Precompiled solverfactory

  • Review changes

  • Download
  • Patches
  • Plain diff
Open Nils-Arne Dreier requested to merge precompiled_solverfactory into master Mar 03, 2022
  • Overview 17
  • Commits 10
  • Pipelines 10
  • Changes 9

This MR adds a cmake function for precompiling solvers and preconditioners for the solverfactory. The function is called dune_precompile_solverfactory and accepts the following arguments:

  • REGISTER_GLOBALLY: Whether to register the library with dune_register_package_flags.
  • NAME: A name for the library target. If omitted it is generated with a hash of the OPERATORS and INCLUDES.
  • OPERATORS: The operator typenames for that the solvers and preconditioners should be precompiled.
  • INCLUDES: Files that should be included. E.g. for the definition of the operator types or for the definition of the solvers and preconditioners.

It works as follows:

  • The source file of the library defines a global variable that it initialized with a call to initSolverFactories<Op>() for every operator given in OPERATORS.
  • The problem is now to enforce the linker to import this symbol (in case of a static library) or to set it as a needed dependency (in case of a shared library). In the first case this can be solved by adding the linker flag -u <symbolname>, where symbolname is the name of the variable defined in the library. In the latter case the only solution if found is to add -Wl,--no-as-needed in the linker options.

There are two ways to use this:

  1. Register the library to the globally. Then all dune targets link to this library.
  2. Specify a name for the library and use target_link_library to link explicitly. I used this approach in the test.

Note that this does not reduce the compile time of the applications that use the solverfactory. But you can omit the call to initSolverFactories in the application or remove the includes to solvers.hh and preconditioners.hh (or other headers that define solvers). Both ways reduce the compile time then.

I'm not quite sure whether I used all the cmake things correctly. @simon.praetorius may you have a look?

@tkoch As you mentioned this at the dev-meeting can you check whether this works for you?

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: precompiled_solverfactory