Skip to content

Inlined Vmath library

BOYANG XIA requested to merge xby2233/nektar:feature/inlineVmath into master

Issue/feature addressed

Vmath.hpp has all of the template declarations but only some of the definitions, while most definitions are placed in Vmath.cpp, coming with a few specializations. This accelerates the compilation process but forbids inlining (isn't it?), and also breaks the generality of templates.

Making Vmath library inlined is helpful in the implementation of Matrix-Free implementation, where we prefer to work on a small chunk of data every time. Thus, the function call overheads should be minimized and an inlined Vmath library is ideal. We can also use constexpr as input size to let the compiler better optimize the code.

Proposed solution

  • Move the definitions back to Vmath.hpp.
  • Add inline keywords.

Implementation

Apart from the two changes shown above, other changes include:

  • Add some new interfaces to Gathr() Scatr() Assmb() to make them more flexible and useful.
  • Replace some for loop inside the AssemblyCommDG.cpp by Vmath::Gathr & Scatr, which should reduce the time of MPI communication in DG.

Tests

All existing tests should pass. No new tests are required. Let's see if the compilation time becomes extremely long or not.

Suggested reviewers

Please suggest any people who would be appropriate to review your code.

Notes

Please add any other information that could be useful for reviewers.

Checklist

  • Functions and classes, or changes to them, are documented.
  • [ ] User guide/documentation is updated.
  • Changelog is updated.
  • [ ] Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • [ ] License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).
Edited by Jacques Xing

Merge request reports