robashaw / libecpint

A C++ library for the efficient evaluation of integrals over effective core potentials.
MIT License
28 stars 15 forks source link

Make calculation of integrals via ECPIntegral thread-safe #22

Closed thomas-dresselhaus closed 3 years ago

thomas-dresselhaus commented 3 years ago

This PR essentially marks the functions compute_shell_pair and related functions for derivatives as const. As a result, no members of the involved classes change during these function calls thus making these functions thread-safe.

This enables codes using libecpint to instantiate ECPIntegral only once and use it in all threads, whereas before one instance per thread was required.

Quite a number of changes were required to achieve the above. A small number of these changes may in principle affect performance, so it should be tested that performance is not degraded by the contents of this PR.

robashaw commented 3 years ago

Need to add

#include <cassert>

in gaussquad.cpp to fix build failure. You can either do this locally and update this pull request (preferred to keep merges granular), or I can include it in my next update - currently working on issue #21 has delayed things slightly

thomas-dresselhaus commented 3 years ago

Need to add

#include <cassert>

in gaussquad.cpp to fix build failure. You can either do this locally and update this pull request (preferred to keep merges granular), or I can include it in my next update - currently working on issue #21 has delayed things slightly

Done. Sorry about that.

codecov[bot] commented 3 years ago

Codecov Report

Merging #22 (59d0909) into master (fa8df43) will decrease coverage by 0.44%. The diff coverage is 87.80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #22      +/-   ##
==========================================
- Coverage   90.07%   89.62%   -0.45%     
==========================================
  Files          19       19              
  Lines        1964     1956       -8     
==========================================
- Hits         1769     1753      -16     
- Misses        195      203       +8     
Impacted Files Coverage Δ
include/libecpint/ecpint.hpp 100.00% <ø> (ø)
include/libecpint/gaussquad.hpp 100.00% <ø> (ø)
src/lib/radial_quad.cpp 82.27% <77.27%> (+1.14%) :arrow_up:
src/lib/bessel.cpp 97.95% <100.00%> (ø)
src/lib/ecpint.cpp 100.00% <100.00%> (ø)
src/lib/gaussquad.cpp 89.79% <100.00%> (-10.21%) :arrow_down:
src/lib/radial_gen.cpp 81.46% <100.00%> (-0.08%) :arrow_down:
include/libecpint/multiarr.hpp 95.34% <0.00%> (-0.11%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fa8df43...59d0909. Read the comment docs.