-
Notifications
You must be signed in to change notification settings - Fork 19
impl::compute_coupling tests
#1537
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
impl::compute_coupling tests
#1537
Conversation
| for (int ielem = 0; ielem < virtual_chunk_size; ++ielem) { | ||
| for (int ipoint = 0; ipoint < TransferFunction2D::nquad_intersection; | ||
| ++ipoint) { | ||
| for (int icomp = 0; icomp < ncomp_self; ++icomp) { | ||
| computed_coupling_function(iedge_start + ielem, ipoint, icomp) = | ||
| CCF(ielem, ipoint, icomp); | ||
| } | ||
| } | ||
| } |
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.
What's happening here. Shouldn't passing the subbview already store it in computed_coupling_function. Are you doing a = a; here ?
| typename decltype( | ||
| computed_coupling_function)::HostMirror h_computed_coupling_function = | ||
| Kokkos::create_mirror_view(computed_coupling_function); | ||
|
|
||
| Kokkos::deep_copy(h_computed_coupling_function, computed_coupling_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.
| typename decltype( | |
| computed_coupling_function)::HostMirror h_computed_coupling_function = | |
| Kokkos::create_mirror_view(computed_coupling_function); | |
| Kokkos::deep_copy(h_computed_coupling_function, computed_coupling_function); | |
| const auto h_computed_coupling_function = Kokkos::create_mirror_view_and_copy(computed_coupling_function); |
| for (int ipoint = 0; ipoint < TransferFunction2D::nquad_intersection; | ||
| ++ipoint) { | ||
| for (int icomp = 0; icomp < ncomp_self; ++icomp) { | ||
| const type_real got = computed_coupling_function(ielem, ipoint, icomp); |
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.
| const type_real got = computed_coupling_function(ielem, ipoint, icomp); | |
| const type_real got = h_computed_coupling_function(ielem, ipoint, icomp); |
| /** | ||
| * @brief Concatenates k functions into an array-valued function. | ||
| * | ||
| */ | ||
| template <typename... AnalyticalFunctions> | ||
| struct Vectorized : AnalyticalFunctionType { |
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 needs more description
| /** | ||
| * @brief Sums k functions. | ||
| * | ||
| */ | ||
| template <typename... AnalyticalFunctions> struct Sum : AnalyticalFunctionType { |
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 here.
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.
I think this should be reworked into a parameterized test. It seems overengineered. TransferFunctionTestTypes2D_AcousticElastic_Natural could just be a set of parameters from a map that initialize whatever needs to be tested. But maybe I'm missing something.
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.
See PR
Updated the tests create single tests that call a templated run function.
|
Note I changed the base to |
| // for (int ielem = 0; ielem < virtual_chunk_size; ++ielem) { | ||
| // for (int ipoint = 0; ipoint < | ||
| // TransferFunction2D::nquad_intersection; | ||
| // ++ipoint) { | ||
| // for (int icomp = 0; icomp < ncomp_self; ++icomp) { | ||
| // computed_coupling_function(iedge_start + ielem, ipoint, icomp) | ||
| // = | ||
| // CCF(ielem, ipoint, icomp); | ||
| // } | ||
| // } | ||
| // } |
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.
| // for (int ielem = 0; ielem < virtual_chunk_size; ++ielem) { | |
| // for (int ipoint = 0; ipoint < | |
| // TransferFunction2D::nquad_intersection; | |
| // ++ipoint) { | |
| // for (int icomp = 0; icomp < ncomp_self; ++icomp) { | |
| // computed_coupling_function(iedge_start + ielem, ipoint, icomp) | |
| // = | |
| // CCF(ielem, ipoint, icomp); | |
| // } | |
| // } | |
| // } |
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.
Minor changes.
| specfem::test_fixture::IntersectionFunction2D<ExpectedSolutionInit> | ||
| expected_solution{ ExpectedSolutionInit{} }; |
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 will not be generalizable. For example, a case where we manually compute the expected solution for a simplied transfer/intersection function, you'd have to write another runner. I would suggest creating a compute_expected_solution function and write a specialization that calls this initializer, when you know the solution analytically.
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'm not sure what you mean, here. IntersectionFunction2D is the array itself. The compute_expected_solution is embedded within the initializer, which gives the 3D array of type_real.
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 sure what you mean by compute_expected_solution is embedded within the initializer. What would happen if the expected solution init is not a function of type analytical function?
I would have thought that in a general case you'd compute the expected solution using a serial loop, similar to how we do it in the gradient test.
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 PR int-ptr-ptr#5
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'm not sure why the intersection function is needed. The purpose of adding the mock classes was to supply input for the functions under test. The intersection function seems to be attempting to mock the return type. Am I overlooking something?
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.
IntersectionFunction is an input type for the coupling integrals (and normal vector).
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.
Ah okay, Thanks!
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.
Ah okay, Thanks!
Review comment suggestions from Rohit
Description
Please describe the changes/features in this pull request.
Issue Number
If there is an issue created for these changes, link it here
#1258
Checklist
Please make sure to check developer documentation on specfem docs.