Skip to content
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

Fix using ZeroMemset for Serial #5077

Merged
merged 3 commits into from
Jun 2, 2022

Conversation

masterleinad
Copy link
Contributor

Fixes #5076. There is a specialization for DefaultHostExecutionSpace that we would not use for Serial when there is another host parallel execution space.

@masterleinad
Copy link
Contributor Author

The code for the default host space is

template <class DT, class... DP>
struct ZeroMemset<typename HostSpace::execution_space, DT, DP...> {
ZeroMemset(const typename HostSpace::execution_space& exec,
const View<DT, DP...>& dst,
typename View<DT, DP...>::const_value_type&) {
// Host spaces, except for HPX, are synchronous and we need to fence for HPX
// since we can't properly enqueue a std::memset otherwise.
// We can't use exec.fence() directly since we don't have a full definition
// of HostSpace here.
hostspace_fence(exec);
using ValueType = typename View<DT, DP...>::value_type;
std::memset(dst.data(), 0, sizeof(ValueType) * dst.size());
}
ZeroMemset(const View<DT, DP...>& dst,
typename View<DT, DP...>::const_value_type&) {
using ValueType = typename View<DT, DP...>::value_type;
std::memset(dst.data(), 0, sizeof(ValueType) * dst.size());
}
};
.

core/src/Kokkos_Serial.hpp Outdated Show resolved Hide resolved
@masterleinad
Copy link
Contributor Author

The failing jenkins test is

[ RUN      ] openmptarget.unique_token_global
4: /var/jenkins/workspace/Kokkos/core/unit_test/TestUniqueToken.hpp:151: Failure
4: Expected equality of these values:
4:   sum
4:     Which is: 9999990
4:   int64_t(N) * R
4:     Which is: 10000000

which looks unrelated.

@dalg24 dalg24 merged commit b3d0a20 into kokkos:develop Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants