-
Notifications
You must be signed in to change notification settings - Fork 377
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
EAMxx: refactor field manipulation interfaces, and add new ones #6970
base: master
Are you sure you want to change the base?
Conversation
* Implement scale/scale_inv in terms of update * Use fill_val only if needed
That is, we can do y.scale(x), if y's data type is double and x's data type is int, but not viceversa
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.
int->double conversions are going to be nice!
In Field::update_impl, in order to use if constexpr in a kernel we must use a functor, and not an extended host-device lambda.
@tcclevenger I added a few more improvements:
The biggest rework compared to earlier is the CombineViewsHelper struct. I needed that on CUDA, since apparently you can't use an |
09f6f77
to
094230b
Compare
} | ||
|
||
template<int N,HostOrDevice HD> | ||
using MDRange = Kokkos::MDRangePolicy<typename get_device<HD>::execution_space, |
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.
Seems like you are redefining MDRange
in the scream::impl::CombineViewsHelper
below instead of using this one?
Simplify implementation of the scale/scale_inv method, and add new ones for max/min.
[BFB]
First, the current implementation had several methods implemented that could just be expressed as a single call to
update
, if onlyupdate
accepted different combine mode values (likeupdate_impl
did). The solution was simple: templateupdate
on the combine mode, defaulting to the current behavior (i.e.,ScaleUpdate
). With this modification,scale
,scale_impl
and alsodeep_copy
(from a Field rhs) could be rewritten as a 1-liner call toupdate
.Second, the PR adds two more values for
CombineMode
, namelyMax
andMin
. The goal is to later use Field operations insidescorpio_output.cpp
, to avoid manually handling the same kind of stuff in that class, simplifying its implementation.Finally, allow do do stuff like
y.scale(x)
if y's data type is, say, double but x's data type is int (but not the other way around!).