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

Implement KOKKOS_IF_ON_{HOST,DEVICE} macros #4660

Merged
merged 23 commits into from
Jan 21, 2022
Merged

Conversation

dalg24
Copy link
Member

@dalg24 dalg24 commented Jan 11, 2022

Proposing a solution to #3404

Copy link
Contributor

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer KOKKOS_IF_ON_HOST/DEVICE slightly but otherwise, this looks pretty good to me already.

@dalg24 dalg24 force-pushed the if_on_host branch 2 times, most recently from e0672ee to 1b09cfb Compare January 14, 2022 17:47
@crtrott crtrott marked this pull request as ready for review January 19, 2022 00:39
Copy link
Member

@crtrott crtrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good: just need to discuss naming in meeting tomorrow.

@crtrott crtrott added the Blocks Promotion Overview issue for release-blocking bugs label Jan 19, 2022
@nmm0 nmm0 added this to In progress in Kokkos Release 3.6 via automation Jan 19, 2022
@crtrott
Copy link
Member

crtrott commented Jan 19, 2022

Name: IF_ON_HOST/DEVICE or IF_HOST/DEVICE
(F means IF_ON_HOST/DEVICE)
F N A
7 5 3

@janciesko
Copy link
Contributor

janciesko commented Jan 19, 2022

Now that I think of it - since KOKKOS_IF_{HOST,DEVICE} refers to code (sources and files) itself which reside wherever, leaving it as proposed by Damien makes it sound like KOKKOS_IF_{HOST_CODE,DEVICE_CODE} w/o stating the obvious “CODE”, which I like more now.

@dalg24 dalg24 changed the title Implement KOKKOS_IF_{HOST,DEVICE} macros Implement KOKKOS_IF_ON_{HOST,DEVICE} macros Jan 19, 2022
@dalg24
Copy link
Member Author

dalg24 commented Jan 20, 2022

Retest this please

Copy link
Contributor

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please comment on deprecating ActiveExecutionMemorySpace?
I left some comments but other than that, the pull request looks good to me.

Rebasing some pull requests will be fun. 🙂

core/src/Kokkos_Core_fwd.hpp Show resolved Hide resolved
Comment on lines +258 to +268
KOKKOS_DEPRECATED KOKKOS_FUNCTION static void check() {}
};

template <typename DstMemorySpace, typename SrcMemorySpace>
struct verify_space<DstMemorySpace, SrcMemorySpace, false> {
KOKKOS_FUNCTION static void check() {
KOKKOS_DEPRECATED KOKKOS_FUNCTION static void check() {
Kokkos::abort(
"Kokkos::View ERROR: attempt to access inaccessible memory space");
};
};
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting deprecations.

Comment on lines +282 to +290
#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
#define KOKKOS_RESTRICT_EXECUTION_TO_DATA(DATA_SPACE, DATA_PTR) \
Kokkos::Impl::verify_space<Kokkos::Impl::ActiveExecutionMemorySpace, \
DATA_SPACE>::check();

#define KOKKOS_RESTRICT_EXECUTION_TO_(DATA_SPACE) \
Kokkos::Impl::verify_space<Kokkos::Impl::ActiveExecutionMemorySpace, \
DATA_SPACE>::check();
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting deprecations.

@@ -538,7 +538,7 @@ class MemoryPool {
#else
const uint32_t block_id_hint =
(uint32_t)(Kokkos::Impl::clock_tic()
#if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA)
#ifdef __CUDA_ARCH__ // FIXME_CUDA
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting

core/src/Kokkos_MemoryPool.hpp Outdated Show resolved Hide resolved
Comment on lines +649 to +650
// No __host__ __device__ annotation because long double treated as double in
// device code. May be revisited later if that is not true any more.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// No __host__ __device__ annotation because long double treated as double in
// device code. May be revisited later if that is not true any more.
// FIXME No __host__ __device__ annotation because long double treated as double in
// device code. May be revisited later if that is not true any more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a FIXME

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think comments such as "Maybe revisited later" are entirely ignored if they don't have a FIXME with them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME_MAYBE if one gpu backend supports this one day and we really need it

Comment on lines +210 to +216
KOKKOS_IF_ON_HOST((impl_wait_until_equal_host(ptr, v, active_wait);))

KOKKOS_IF_ON_DEVICE(((void)active_wait; while (!test_equal(ptr, v)){}))
}

static void impl_wait_until_equal_host(int* ptr, const int v,
bool active_wait = true) noexcept {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are specifically here defining a different function but noting other places?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of all the #ifdefs

@@ -314,7 +314,7 @@ class Task : public TaskBase, public FunctorType {
// If team then only one thread calls destructor.

const bool only_one_thread =
#if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA)
#ifdef __CUDA_ARCH__ // FIXME_CUDA
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting

@@ -669,7 +669,7 @@ class alignas(16) RunnableTask
// If team then only one thread calls destructor.

const bool only_one_thread =
#if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA)
#ifdef __CUDA_ARCH__ // FIXME_CUDA
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting

Co-Authored-By: Daniel Arndt <arndtd@ornl.gov>
@dalg24 dalg24 merged commit c74499d into kokkos:develop Jan 21, 2022
Kokkos Release 3.6 automation moved this from In progress to Done Jan 21, 2022
@dalg24 dalg24 deleted the if_on_host branch January 21, 2022 16:00
@ajpowelsnl
Copy link
Contributor

Morning @dalg24 -- Is it ok to close this PR ?

@dalg24
Copy link
Member Author

dalg24 commented Feb 21, 2022

What do you mean close a PR? There is nothing to close it is already merged. You may remove the "Blocks Promotion" label if you like.

@ajpowelsnl ajpowelsnl removed the Blocks Promotion Overview issue for release-blocking bugs label Feb 21, 2022
@ajpowelsnl
Copy link
Contributor

What do you mean close a PR? There is nothing to close it is already merged. You may remove the "Blocks Promotion" label if you like.

OK, sounds good. Sorry for the clumsiness , just trying to figure out how to handle the flow of information, so that nothing slips through the cracks.

ndellingwood added a commit to trilinos/Trilinos that referenced this pull request Aug 30, 2022
Remove use of ActiveExecutionMemorySpace for compatibility with disable of kokkos deprecated code
See kokkos/kokkos#4668 and kokkos/kokkos#4660
ndellingwood added a commit to trilinos/Trilinos that referenced this pull request Aug 30, 2022
Remove use of ActiveExecutionMemorySpace for compatibility with disable of kokkos deprecated code
See kokkos/kokkos#4668 and kokkos/kokkos#4660
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants