-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement SPOSetT<T> template class hierarchy #4684
base: develop
Are you sure you want to change the base?
Conversation
7306248
to
c65db6a
Compare
Changed to the option suggested by @ye-luo to only concretize class type. |
6d3edef
to
3449762
Compare
2ddcc63
to
7dc04f6
Compare
744c05f
to
df14b5a
Compare
Thinking of how to avoid adding new files. Can we make |
@ye-luo thanks for chiming in. We just thought having a separate SPOSetT hierarchy would help us with CI (at least build errors we introduce are caught) and for us to work in parallel. Once we have that we can start integrating with current SPOSet consumers without rewriting those and once done remove SPOSet and rename SPOSetT->SPOSet. Thoughts? |
probably I didn't fully understand the current status of this PR. I saw multiple files (SPOSetT and derived classes) got added and was thinking of how to make the change mergeable without the need of porting every SPOSet derived classes before merging. By making SPOSet a base of SPOSetT probably allows us to keep ported and not yet ported classes to co-exist without any duplication. All the high level classes still just see SPOSet. |
9c61923
to
eaae12d
Compare
d5f6b9b
to
c03543c
Compare
bd5d50f
to
ca0baf4
Compare
12cfc1f
to
90194bc
Compare
90194bc
to
1359f2d
Compare
@@ -178,6 +177,7 @@ class RealSpacePositionsTOMPTarget : public DynamicCoordinatesT<T> | |||
const size_t mw_pos_stride = mw_new_pos.capacity(); | |||
|
|||
PRAGMA_OFFLOAD("omp target teams distribute parallel for \ | |||
is_device_ptr(mw_pos_ptr, mw_rosa_ptr) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// | ||
// Copyright (c) 2022 QMCPACK developers. | ||
// | ||
// File developed by: Joshua Townsend, [email protected], Sandia National |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like someone is running clang-format with a column limit of 80 (vs the qmcpack default of 120). (Or is using an editor that does auto-wrapping). While technically within the guidelines (line length is < 120), it is creating extra differences between files.
It looks like the "new" files have been run through clang-format that is more restrictive than the default one, or been modified in an editor that does some formatting.
I think it would be better if the copyright headers had a consistent format in every file. Unfortunately, these aren't new files - they're renamed and changed versions of existing files. |
develop
ref-add-SPOSetT
|
template<typename T> | ||
struct ValueApproxHelper | ||
{ | ||
using Type = Catch::Detail::Approx; | ||
}; | ||
template<typename T> | ||
struct ValueApproxHelper<std::complex<T>> | ||
{ | ||
using Type = Catch::Detail::ComplexApprox; | ||
}; | ||
|
||
template<typename T> | ||
using ValueApprox = typename ValueApproxHelper<T>::Type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code might be useful elsewhere, and could get moved to src/external_codes/complex_approx.hpp or src/Configuration.h
(Not necessary for this PR, though)
f147c17
to
4712b2f
Compare
@markdewing thanks for the catch. The latest commit should have addressed clang-format related issues. I will double-check. I used clang-format-16. Thanks! |
Test this please |
A lot of these changes are at the |
4712b2f
to
3adc50f
Compare
Test this please |
3adc50f
to
a9c510b
Compare
What's going on with the The explicit definition of MCPWalker from Walker instead of pulling in Walker_t from elsewhere was intended to decouple classes that were tightly bound via Walker type aliases. Then they can be built and tested without creating cascading rebuilds. There seems to be a clash now between QMCTraits and ParticleTraits which is making a bit of a mess that is just getting fixed by adding includes that shouldn't really be included. Similar issues seem behind the many forward declarations that were successfully decoupling headers that have been reverted by this PR. I'm not sure if we should put this in and then work to refactor away the new includes and MCPWalker type aliases or just stage this in such a way we don't add all these design regressions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assent to merge this subject to the conflicts being fixed and there not being any new issues there.
If we are concerned about possible offload errors, we could check this code is OK on Frontier and Aurora, so that we don't risk breaking develop for FOM runs. Our CI coverage of offload is not great (only NV, limited coverage).
Our earlier decision was that this would be a large PR instead of a lot of small ones since the large PR route was much more practical. As Peter said, we can work to refactor away some of the new design dependencies. Breaking this PR up would not be consistent with what we agreed on, and from a project perspective there simply is not time to rework this PR. There are very few weeks remaining in the year to get unified complex-real builds completed.
Next step: William & co to fix the conflicts.
dae4c3f
to
cc14aae
Compare
Test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, I appreciated the effort. It is a very heavy workload.
After looking through the change. I feel two aspects are mixed when rushing to make the code compile and run.
- real/complex. This is what we would like to explore.
- full/mixed precision. This is what I would like to leave aside.
by looking at all the changes. I'm surprised to see ParticleSet being template as ValueType. When making such massive changes. Certain choices may not be made optimal. Merging this PR as it is will be a challenge for post-ECP develops as there is very limited understanding of this PR and some modifications are not necessary and needs undo. So I still would like to explore a way to make piece wise changing possible.
I have additional thoughts about how to handle mixed precision and also simplify the code. It will be a separate discussion.
}; | ||
using DistanceTable = DistanceTableT<QMCTraits::ValueType>; | ||
using DistanceTableAA = DistanceTableAAT<QMCTraits::ValueType>; | ||
using DistanceTableAB = DistanceTableABT<QMCTraits::ValueType>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Distance tables are real only. Should not be in ValueType.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This needs to be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That can't be fixed without removing the member variable const ParticleSetT<T>& origin_;
or making ParticleSetT<T>
real-only.
qmcpack/src/Particle/DistanceTable.h
Line 51 in 864c22d
const ParticleSet& origin_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that in the current state of develop
DistanceTable
depends tightly on ParticleSet
and ValueType
, I think it falls outside the scope of this PR.
coordinates_->resize(numPtcl); | ||
} | ||
}; | ||
using ParticleSet = ParticleSetT<QMCTraits::ValueType>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ParticleSet should be real-only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is MCWalkerConfiguration, which inherits from ParticleSet, real-only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since ParticleSet
contains GradType
and QMCTraits::GradType
depends on ValueType
. I don't see a straightforward way to make ParticleSet real-only.
qmcpack/src/type_traits/QMCTypes.h
Line 44 in 864c22d
using GradType = TinyVector<ValueType, DIM>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that in the current state of develop
ParticleSet
depends on ValueType
, I think it falls outside the scope of this PR.
This was done to satisfy the requirement to not specialize on a single function basis, but rather class level since
The PR itself is about undoing things, and there is plenty of pending things (e.g. we are still depending of #ifdef for template class definitions). I'm afraid any other attempt to make this piece wise won't add value and we we will end up with something very similar to what we have (or worse, combining current non-generic #ifdef patterns with template generic patterns). This is a good opportunity to identify pieces towards major re-architecture redesign, refactoring and add more testing. This PR can be summarized as |
cc14aae
to
ac9fb92
Compare
Test this please |
Asses the effort to change this. Currently without consumers or tests. Concretize friend class declaration Define testing::getMyVars for SPOSetT Add FakeSPOT class Move SpinorSet to a templated class Refactor FreeOrbital class Base typed aliases on SPOSet<T> on OrbitalSetTraits<T> Add FullRealType in SPOSet and RotatedSPOs Add this in templated meta class Add explicit function instantions for FreeOrbital Add templated class SHOSetT Signed-off-by: Steven Hahn <[email protected]> Add PWRealOrbitalSetT template class Revert test_RotatedSPOs.cpp Revert test_RotatedSPOs.cpp Reorder specialized function definitions to appease OMP target compilation Add ConstantSPOSetT Refactor BsplineSet and SplineC2C Follow existing pattern for SplineC2C allowing for std::complex<T> PWOribitalSetT and PWBasisT Add FullRealType in SPOSet and RotatedSPOs Move generic definition after specialization add implicit implementations Fix some errors initial commit of templated PWOribitSetT that compiles cleanup templateitze PWBasis as well, as is dependancy remove inaccurate comment remove polluted commit Add LCAOrbitalSetT Add templated class LCAOrbitalSetWithCorrectionT Signed-off-by: Steven Hahn <[email protected]> Add SPOSetBuilderT, SHOSetBuilderT and SoaCuspCorrectionT Fix PWOrbitalSet alias types Fix LCAOrbitalSetWithCorrectionT Reuse SPOSet types Signed-off-by: Steven Hahn <[email protected]> Implement CompositeSPOSetT class Specialize functions in RotatedSPOsT Fix function signature Change order of definition Implement SPOSetBuilderFactoryT and most required builders Add missing implementation to SPOSetBuilderT Signed-off-by: Steven Hahn <[email protected]> Add CI to WIP refactoring branch add SplineR2RT Empty-Commit Further template propagation to fix offload build Implement SplineC2RTOMPTarget template class add missing particlesetT Refactored everything needed for test_RotatedSPOsT Add new bits to RotatedSPOsT Bugfix: removed QMC_COMPLEX conditions where no longer needed Accomodate new refactored headers simd::dot and Spline classes Move memory reference inside PRAGMA Causes a memory corruption when defining internal pos Fix pragma typo with is_device_ptr Implement SPOSetT template class Asses the initial effort to refactor SPOSet into templates without consumers or tests. Concretize friend class declaration Define testing::getMyVars for SPOSetT Add FakeSPOT class Move SpinorSet to a templated class Refactor FreeOrbital class Base typed aliases on SPOSet<T> on OrbitalSetTraits<T> Add FullRealType in SPOSet and RotatedSPOs Add this in templated meta class Add explicit function instantions for FreeOrbital Add templated class SHOSetT Add PWRealOrbitalSetT template class Revert test_RotatedSPOs.cpp Signed-off-by: Steven Hahn <[email protected]> Revert test_RotatedSPOs.cpp PWOribitalSetT and PWBasisT Add FullRealType in SPOSet and RotatedSPOs Move generic definition after specialization add implicit implementations Fix some errors initial commit of templated PWOribitSetT that compiles cleanup templateitze PWBasis as well, as is dependancy remove inaccurate comment remove polluted commit Start replacing legacy code with templated classes Fix ornl CI tests sulfur: Add missing SPOSet header in NiO tests nitrogen: Add missing memory header for std::unique_ptr clang-format-16 on new files Fix license file headers Fix typo with T1->T
Signed-off-by: Steven Hahn <[email protected]>
630c02e
to
c3298e8
Compare
Test this please |
@prckent @ye-luo @quantumsteve this is a new checkpoint that CI tests are passing and conflicts are resolved. |
Proposed changes
Introduce a shim template class to asses the effort to change
SPOSet
toSPOSet<T>
.SPOSetT<T>
currently does not have consumers nor tests.Testing compilation in CI and define concrete types for the template classes.
The challenge is to adapt
SPOSetT<T>
toSPOSet
current consumers.Related to #4099
What type(s) of changes does this code introduce?
Delete the items that do not apply
Does this introduce a breaking change?
What systems has this change been tested on?
sulfur
Checklist