Skip to content

Conversation

@chrisrichardson
Copy link
Contributor

@chrisrichardson chrisrichardson commented May 22, 2022

This adds an implementation of std::mdspan for internal use only. In theory, std::mdspan will be part of the C++23 standard, so in the future we can switch to it.

  • faster runtime for tabulate_* functions (timed 10^6 point evaluations on P3 tets, runs 3x faster than xtensor with all optimisations on).
  • we can gain experience of using mdspan
  • Includes the single header implementation of mdspan from kokkos
  • Not exposed in any external interfaces, only used internally in polyset.cpp
  • In future, we can switch to use a standard implementation.

@jorgensd
Copy link
Member

The runtime is compared to main (after the col->row) transition?

@chrisrichardson
Copy link
Contributor Author

chrisrichardson commented May 22, 2022

The runtime is compared to main (after the col->row) transition?

Yes, but would be good for more people to check, if you have time.

#include <numeric>
#include <array>
#include <tuple> // std::apply
#include <utility> // std::pair
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a lot of these includes are repeated

Copy link
Member

Choose a reason for hiding this comment

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

I think these are automatically generated, so I wouldn't bother. (the file has more 5k lines of code)
Same for the other comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is due to the autogeneration of the single-header file

@chrisrichardson
Copy link
Contributor Author

I've now done a few timing tests from Python, and there is a reasonable speedup with mdspan, for higher order cells. Not huge, but from 1.1x to 2x, generally. I think this is worthwhile.

@chrisrichardson chrisrichardson merged commit 0cfa728 into main May 24, 2022
@chrisrichardson chrisrichardson deleted the chris/mdspan branch May 24, 2022 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants