-
Notifications
You must be signed in to change notification settings - Fork 17
NCI accessors: chunk_edge (normal, intersection_factor) and point (transfer_function) #1339
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
base: devel
Are you sure you want to change the base?
Conversation
Rohit-Kakodkar
left a comment
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.
Small changes.
| KOKKOS_INLINE_FUNCTION const TransferViewType &get_transfer_function() const { | ||
| return transfer_function_self; | ||
| } |
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.
We dont need the get function since transfer_function_self is itself public.
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.
get_transfer_function() is used to abstract the difference between transfer_function_self and transfer_function_coupled so that the same code can be used.
As an example, here's the transfer algorithm using it, where interface_data has already been checked to inherit only one of transfer_function<is_self=true> and transfer_function<is_self=false>. get_transfer_function() is used instead of something like
(stores_self_transfer_function<decltype(interface_data)>::type)?
interface_data.transfer_function_self : interface_data.transfer_function_coupled
Would storing a const TransferViewType& field be better than the function?
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 am not getting this. What cant you directly reference it in the line you linked const auto& transfer_functions = interface_data.transfer_function
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 am not getting this. What cant you directly reference it in the line you linked
const auto& transfer_functions = interface_data.transfer_function
transfer_function_self is different from transfer_function_coupled. You would need a compile-time ternary, which is what the get_transfer_function() method is.
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.
SPECFEMPP/core/specfem/point/impl/nonconforming_transfer_function.hpp
Lines 57 to 62 in 68e7089
| /** @brief Transfer function (edge -> mortar). Only the relevant side is | |
| * enabled. | |
| */ | |
| TransferViewType transfer_function_self; | |
| TransferViewType &transfer_function = transfer_function_self; | |
SPECFEMPP/include/algorithms/transfer.hpp
Lines 108 to 111 in 68e7089
| intersection_point_view(icomp) += | |
| coupled_field(iedge, ipoint_edge, icomp) * | |
| interface_data.transfer_function(iedge, ipoint_edge, | |
| ipoint_intersection); |
Is this what you had in mind?
| template <typename MemberType> | ||
| KOKKOS_INLINE_FUNCTION nonconforming_transfer_function(const MemberType &team) | ||
| : transfer_function_self(team.team_scratch(0)) {} | ||
|
|
||
| /** | ||
| * @brief Get the amount memory in bytes required for shared memory | ||
| * | ||
| * @return int Amount of shared memory in bytes | ||
| */ | ||
| constexpr static int shmem_size() { return TransferViewType::shmem_size(); } |
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.
Point views would not use a team allocator. Point views are instantiated in register space and not scrach space. For example, shmem_size() does not exist for datatype::VectorPointViewType
| * enabled. | ||
| */ | ||
| TransferViewType transfer_function_coupled; | ||
| KOKKOS_INLINE_FUNCTION const TransferViewType &get_transfer_function() const { |
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.
See comment above.
| template <typename MemberType> | ||
| KOKKOS_INLINE_FUNCTION nonconforming_transfer_function(const MemberType &team) | ||
| : transfer_function_coupled(team.team_scratch(0)) {} | ||
|
|
||
| /** | ||
| * @brief Get the amount memory in bytes required for shared memory | ||
| * | ||
| * @return int Amount of shared memory in bytes | ||
| */ | ||
| constexpr static int shmem_size() { return TransferViewType::shmem_size(); } |
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.
See comment above.
| specfem::data_access::is_point<PointType>::value, int> = 0> | ||
| KOKKOS_FORCEINLINE_FUNCTION void impl_load(const IndexType &index, | ||
| PointType &point) const { | ||
| if constexpr (on_device) { |
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.
Was this wrong before?
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 was outdated and never had to be compiled, since no point<connection_tag=nonconforming> accessor existed.
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.
Can you merge branch issue-1350 into this. That branch should provide a fix for this.
lsawade
left a comment
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.
LGTM
Rohit-Kakodkar
left a comment
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.
See comments.
| KOKKOS_INLINE_FUNCTION const TransferViewType &get_transfer_function() const { | ||
| return transfer_function_self; | ||
| } | ||
| TransferViewType &transfer_function = transfer_function_self; |
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 still dont understand why you need a reference type? Can you not name the above variable just transfer_function?
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.
There will be a flux scheme where compute_coupling needs both transfer_function_self and transfer_function_coupled, and it makes more sense to do it this way than to do something like
intersection_data.specfem::chunk_edge::nonconforming_transfer_function<true,...>::transfer_function.
Right now, the compatibility checker looks for the field names, so if this is something to change, I would rather wait until we rework that.
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.
Would updating this to const auto &transfer_function = interface_container.transfer_function_self in the transfer kernel do the trick?
| /** | ||
| * @brief Constructor that initializes data views in Scratch | ||
| * Memory. | ||
| * | ||
| * @tparam MemberType Kokos team member type. | ||
| * @param team Kokkos team member. | ||
| */ | ||
| template <typename MemberType> | ||
| KOKKOS_INLINE_FUNCTION nonconforming_transfer_function(const MemberType &team) | ||
| : transfer_function_self(team.team_scratch(0)) {} |
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.
Point views should not have team operator.
| /** | ||
| * @brief Constructor that initializes data views in Scratch | ||
| * Memory. | ||
| * | ||
| * @tparam MemberType Kokos team member type. | ||
| * @param team Kokkos team member. | ||
| */ | ||
| template <typename MemberType> | ||
| KOKKOS_INLINE_FUNCTION nonconforming_transfer_function(const MemberType &team) | ||
| : transfer_function_coupled(team.team_scratch(0)) {} |
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.
Same as above
| specfem::dimension::type DimensionTag, bool UseSIMD> | ||
| struct nonconforming_transfer_function; | ||
|
|
||
| template <int NQuadIntersection, bool UseSIMD> |
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 dont think we'd be able to SIMD vectorize compute coupling yet just because of how data is layed out.
- [x] Update index function in edge/intersection iterator - [x] Update `for_all` execution function
| specfem::data_access::is_point<PointType>::value, int> = 0> | ||
| KOKKOS_FORCEINLINE_FUNCTION void impl_load(const IndexType &index, | ||
| PointType &point) const { | ||
| if constexpr (on_device) { |
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.
Can you merge branch issue-1350 into this. That branch should provide a fix for this.
revert ncmarked_conforming_grid_curved CMakeLists.txt sources to relative (to match ncmarked_conforming_grid_flat CmakeLists)
Description
Please describe the changes/features in this pull request.
impl_loadfor nonconforming interfaceschunk_edgecontainers forcompute_couplinginterface_datacontainer. We can decide how to handle delegation along with the accessor compatibility update we will have to do in the future for coupled interfaces.Issue Number
If there is an issue created for these changes, link it here
Checklist
Please make sure to check developer documentation on specfem docs.