-
Notifications
You must be signed in to change notification settings - Fork 51
Basic kokkos #206
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
Merged
Merged
Basic kokkos #206
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
060bfc4
Kokkos: Add git submodule and CMake changes
ajpowelsnl 8da0e88
Kokkos: Initialize/Finalize Kokkos in Driver
ajpowelsnl 2da3277
Kokkos: Add basic kernel group variants
ajpowelsnl a8b4fc5
Clean up basic kernels and CMakeLists.txt
ajpowelsnl 42f1181
Addressing PR comments before merge with RPS develop
ajpowelsnl a9ed2f7
Add DAXPY_ATOMIC, formatting, in REDUCE3, Kokkos::min, Kokkos::max
ajpowelsnl 2ba3c9d
DAXPY_ATOMIC: copying files from llnl/develop to restore original fil…
ajpowelsnl f6b8232
Delete code now in KokkosViewUtils.hpp
800bd44
RAJAPerfSuite.hpp 0d8b139: removing RUN_KOKKOS infrastructure in unfo…
ff93ba6
RAJAPerfSuite.hpp: rm line 18 to minimize changes
73dc173
reverting formatting changes
ajpowelsnl c843d99
Restore destructor in DAXPY_ATOMIC.cpp
ajpowelsnl 422f8d0
Kokkos updates for running with the current RAJA + Kokkos
ajpowelsnl a0f5c31
Addressing D. Beckingsale PR comments
ajpowelsnl 593489b
Build and runtime fix ups with Jason B.
ajpowelsnl d042c8a
MULADDSUB-Kokkos.cpp: add guard to fix failing CI
ajpowelsnl eb3fa28
Update src/RAJAPerfSuiteDriver.cpp
ajpowelsnl 0ee2fce
Addressing Jason B. PR comments
ajpowelsnl 4b529c4
Merge branch 'basic-kokkos' of github.com:ajpowelsnl/RAJAPerf into ba…
ajpowelsnl a9bd651
Addressing Jason B. PR requests: re-adding two includes + rm Kokkos_…
ajpowelsnl f8eef46
RAJAPerfSuite.hpp: addressing final-ish PR comments from Jason B.
ajpowelsnl 0407c36
Update src/common/RAJAPerfSuite.hpp
ajpowelsnl d57a5d9
Update src/common/RAJAPerfSuite.hpp
ajpowelsnl 3e49f7d
Update src/common/RAJAPerfSuite.hpp
ajpowelsnl c28aff3
Update src/common/RAJAPerfSuite.hpp
ajpowelsnl 8ed1554
Remove extra whitespace
MrBurmark dbbae25
Add back in newline
MrBurmark 9c2c431
Remove whitespace change
MrBurmark 6add081
Remove whitespace change
MrBurmark File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| ############################################################################### | ||
| # Copyright (c) 2017-20, Lawrence Livermore National Security, LLC | ||
| # and RAJA Performance Suite project contributors. | ||
| # See the RAJAPerf/COPYRIGHT file for details. | ||
| # | ||
| # SPDX-License-Identifier: (BSD-3-Clause) | ||
| ############################################################################### | ||
|
|
||
| #include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/../basic) | ||
|
|
||
| blt_add_library( | ||
| NAME basic-kokkos | ||
| SOURCES | ||
| PI_ATOMIC-Kokkos.cpp | ||
| DAXPY-Kokkos.cpp | ||
| IF_QUAD-Kokkos.cpp | ||
| INIT3-Kokkos.cpp | ||
| INIT_VIEW1D-Kokkos.cpp | ||
| INIT_VIEW1D_OFFSET-Kokkos.cpp | ||
| MULADDSUB-Kokkos.cpp | ||
| NESTED_INIT-Kokkos.cpp | ||
| REDUCE3_INT-Kokkos.cpp | ||
| TRAP_INT-Kokkos.cpp | ||
| DAXPY_ATOMIC-Kokkos.cpp | ||
| INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/../basic | ||
| DEPENDS_ON common ${RAJA_PERFSUITE_DEPENDS} | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// | ||
| // Copyright (c) 2017-20, Lawrence Livermore National Security, LLC | ||
| // and RAJA Performance Suite project contributors. | ||
| // See the RAJAPerf/COPYRIGHT file for details. | ||
| // | ||
| // SPDX-License-Identifier: (BSD-3-Clause) | ||
| //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// | ||
|
|
||
| #include "DAXPY.hpp" | ||
| #if defined(RUN_KOKKOS) | ||
| #include "common/KokkosViewUtils.hpp" | ||
| #include <iostream> | ||
|
|
||
| namespace rajaperf { | ||
| namespace basic { | ||
|
|
||
| struct DaxpyFunctor { | ||
| Real_ptr x; | ||
| Real_ptr y; | ||
| Real_type a; | ||
| DaxpyFunctor(Real_ptr m_x, Real_ptr m_y, Real_type m_a) | ||
| : x(m_x), y(m_y), a(m_a) {} | ||
| void operator()(Index_type i) const { DAXPY_BODY; } | ||
| }; | ||
|
|
||
| void DAXPY::runKokkosVariant(VariantID vid, size_t RAJAPERF_UNUSED_ARG(tune_idx)) { | ||
| const Index_type run_reps = getRunReps(); | ||
| const Index_type ibegin = 0; | ||
| const Index_type iend = getActualProblemSize(); | ||
|
|
||
| DAXPY_DATA_SETUP; | ||
|
|
||
| auto x_view = getViewFromPointer(x, iend); | ||
| auto y_view = getViewFromPointer(y, iend); | ||
|
|
||
| switch (vid) { | ||
|
|
||
| case Kokkos_Lambda: { | ||
|
|
||
| Kokkos::fence(); | ||
| startTimer(); | ||
|
|
||
| for (RepIndex_type irep = 0; irep < run_reps; ++irep) { | ||
| Kokkos::parallel_for( | ||
| "DAXPY-Kokkos Kokkos_Lambda", | ||
| Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>(ibegin, iend), | ||
| KOKKOS_LAMBDA(Index_type i) { y_view[i] += a * x_view[i]; }); | ||
| } | ||
|
|
||
| Kokkos::fence(); | ||
| stopTimer(); | ||
|
|
||
| break; | ||
| } | ||
| default: { | ||
| std::cout << "\n DAXPY : Unknown variant id = " << vid << std::endl; | ||
| } | ||
| } | ||
|
|
||
| // Move data (i.e., pointer, KokkosView-wrapped ponter) back to the host from | ||
| // the device | ||
|
|
||
| moveDataToHostFromKokkosView(x, x_view, iend); | ||
| moveDataToHostFromKokkosView(y, y_view, iend); | ||
| } | ||
|
|
||
| } // end namespace basic | ||
| } // end namespace rajaperf | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// | ||
| // Copyright (c) 2017-21, Lawrence Livermore National Security, LLC | ||
| // and RAJA Performance Suite project contributors. | ||
| // See the RAJAPerf/LICENSE file for details. | ||
| // | ||
| // SPDX-License-Identifier: (BSD-3-Clause) | ||
| //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// | ||
|
|
||
| #include "DAXPY_ATOMIC.hpp" | ||
| #if defined(RUN_KOKKOS) | ||
| #include "common/KokkosViewUtils.hpp" | ||
| #include <iostream> | ||
|
|
||
| // Delete me | ||
| // For de-bugging: | ||
| #include "RAJA/RAJA.hpp" | ||
|
|
||
| namespace rajaperf { | ||
| namespace basic { | ||
|
|
||
| void DAXPY_ATOMIC::runKokkosVariant(VariantID vid, size_t RAJAPERF_UNUSED_ARG(tune_idx)) | ||
| { | ||
|
|
||
| const Index_type run_reps = getRunReps(); | ||
| const Index_type ibegin = 0; | ||
| const Index_type iend = getActualProblemSize(); | ||
|
|
||
| DAXPY_ATOMIC_DATA_SETUP; | ||
| // | ||
| // Kokkos Views to wrap pointers declared in DAXPY_ATOMIC.hpp | ||
| // | ||
|
|
||
| auto x_view = getViewFromPointer(x, iend); | ||
| auto y_view = getViewFromPointer(y, iend); | ||
|
|
||
| switch (vid) { | ||
|
|
||
| case Kokkos_Lambda: { | ||
|
|
||
| Kokkos::fence(); | ||
| startTimer(); | ||
|
|
||
| for (RepIndex_type irep = 0; irep < run_reps; ++irep) { | ||
|
|
||
| Kokkos::parallel_for( | ||
| "DAXPY_ATOMIC_Kokkos Kokkos_Lambda", | ||
| Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>(ibegin, iend), | ||
| KOKKOS_LAMBDA(Index_type i) { | ||
| Kokkos::atomic_add(&y_view[i], a * x_view[i]); | ||
| }); | ||
| } | ||
|
|
||
| Kokkos::fence(); | ||
| stopTimer(); | ||
|
|
||
| break; | ||
| } | ||
|
|
||
| default: { | ||
| getCout() << "\n DAXPY_ATOMIC : Unknown variant id = " << vid << std::endl; | ||
| } | ||
| } | ||
|
|
||
| moveDataToHostFromKokkosView(x, x_view, iend); | ||
| moveDataToHostFromKokkosView(y, y_view, iend); | ||
| } | ||
|
|
||
| } // end namespace basic | ||
| } // end namespace rajaperf | ||
| #endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.