qmcpack icon indicating copy to clipboard operation
qmcpack copied to clipboard

[WIP] Soa spherical tensor

Open anbenali opened this issue 2 years ago • 7 comments

Please review the developer documentation on the wiki of this project that contains help and requirements.

Proposed changes

Explicitly unrolling the functions in the Spherical harmonics evaluations based on Sloan, P., Efficient Spherical Harmonic Evaluation, Journal of Computer Graphics Techniques, vol. 2, no. 2, 84-90, 2013. Gets 1.6 to 6X speedup depending on the angular momentum.

Total Gain for Fe(CO)6 using bfd_vtz :1.8X

Total Gain for Au single Atom using ccecp_aug-cc-pcv5z : 2.4 X

Total Gain for H2O using ccecp_cc-pcvtz: 1.4X

Tests conducted on laptop.

What type(s) of changes does this code introduce?

Delete the items that do not apply

  • Refactoring (no functional changes, no api changes)

Does this introduce a breaking change?

  • no

What systems has this change been tested on?

  • Personal Laptops
  • Cooley [ALCF]

Checklist

Update the following with a yes where the items apply. If you're unsure about any of them, don't hesitate to ask. This is simply a reminder of what we are going to look for before merging your code.

  • Yes. This PR is up to date with current the current state of 'develop'
  • Yes. Code added or changed in the PR has been clang-formatted
  • No. This PR adds tests to cover any new code, or to catch a bug that is being fixed
  • Yes/No. Documentation has been added (if appropriate)

anbenali avatar Aug 25 '23 15:08 anbenali

Test this please

prckent avatar Aug 25 '23 18:08 prckent

leave some idea. We can technically generate constants using constexpr functions to avoid storing them in the source.

#include <cmath>
#include <iostream>

constexpr double foo(double a)
{
  double res = 0;
  for(int i=0;i<2;i++)
    res+= ::sin(a+i);
  return res;
}

int main()
{
  constexpr double b = foo(2); # can be evaluated at compile time even if it involves math function calls in it.
  std::cout << "b = " <<b <<std::endl;
  return b;
}

ye-luo avatar Sep 05 '23 21:09 ye-luo

  • Please post some of the data you have on the performance improvements with details of the system (basis etc.) and hardware. I do believe the result -- it is more than unrolling.

I added the data. Should I create tests for these or just the numbers as is are enough?

* Is this code a cut & paste from the cited article or do you have a generator code? If the latter we should capture it, just as we have been capturing Mark's python codes for optimization and wavefunction testing.

Yes There is a code generator. Kevin (@kgasperich ) will supply it.

* I hope we can get test coverage near 100% for these foundational numeric functions.

There is an existing test already covering this function but it is not clear if it is being called. Once the deadlines are past we will "clean" it.

anbenali avatar Sep 07 '23 18:09 anbenali

Generator code should be added in case "we" end up redoing this.

prckent avatar Sep 07 '23 19:09 prckent