-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
build | ||
external_dependencies/build | ||
external_dependencies/install | ||
.spack-env |
This file contains 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 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 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 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 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,51 @@ | ||
|
||
#include <hpx/hpx_main.hpp> | ||
#include <hpx/include/async.hpp> | ||
#include <hpx/include/lcos.hpp> | ||
|
||
#include <hpx/kokkos.hpp> | ||
|
||
#include <Kokkos_Core.hpp> | ||
#include <cstdio> | ||
#include <typeinfo> | ||
|
||
#include "../include/buffer_manager.hpp" | ||
#include "../include/cuda_buffer_util.hpp" | ||
#include "../include/kokkos_buffer_util.hpp" | ||
#include <hpx/timing/high_resolution_timer.hpp> | ||
#include <memory> | ||
|
||
constexpr size_t view_size_0 = 10; | ||
constexpr size_t view_size_1 = 50; | ||
template <class T> | ||
using kokkos_um_array = Kokkos::View<T**, Kokkos::HostSpace, Kokkos::MemoryUnmanaged>; | ||
template <class T> | ||
using recycled_host_view = recycled_view<kokkos_um_array<T>, recycle_std<T>, T>; | ||
|
||
|
||
template <typename Executor, typename ViewType> | ||
auto get_iteration_policy(const Executor&& executor, const ViewType& view_to_iterate){ | ||
return get_iteration_policy(executor, view_to_iterate); | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
constexpr size_t passes = 1; | ||
for (size_t pass = 0; pass < passes; pass++) | ||
{ | ||
recycled_host_view<double> hostView(view_size_0,view_size_1); | ||
|
||
// works - usage counter goes up to 9 for the hostView | ||
// auto host_space = hpx::kokkos::make_execution_space<Kokkos::Serial>(); | ||
|
||
// broken - usage counter goes up to 13 for the hostView - goes only down to 2 | ||
auto host_space = hpx::kokkos::make_execution_space<Kokkos::DefaultHostExecutionSpace>(); | ||
auto policy_host = get_iteration_policy(host_space, hostView); | ||
Kokkos::parallel_for( | ||
"host init", | ||
policy_host, | ||
KOKKOS_LAMBDA(int n, int o) { | ||
hostView(n, o) = 1.0; | ||
}); | ||
} | ||
} |