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

SPILUK: Move host allocations to symbolic #1480

Merged
merged 29 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
22972e6
Add find method to HashmapAccumulator
vqd8a Apr 29, 2022
3271248
Merge branch 'develop' into hash-map-find-method
vqd8a May 10, 2022
3f64eda
Initial hash map spiluk numeric impl
vqd8a May 10, 2022
14a6991
Update implementation
vqd8a May 11, 2022
33523f9
Delete comments
vqd8a May 11, 2022
9d19a74
Fix nnz calculation
vqd8a May 12, 2022
f911f45
Apply clang format
May 12, 2022
399e6d8
Add printf statements
vqd8a May 26, 2022
1e02e34
Merge branch 'develop' into hash-map-find-method
vqd8a May 26, 2022
f9f433b
Test
vqd8a May 27, 2022
2eb530c
Some changes to symbolic and mumeric of spiluk
vqd8a May 31, 2022
6c8a945
Merge branch 'develop' into hash-map-find-method
vqd8a May 31, 2022
7ef9815
Merge branch 'develop' into hash-map-find-method
vqd8a Jun 13, 2022
96cb395
Merge branch 'develop' into hash-map-find-method
vqd8a Jun 26, 2022
e4c05bf
Try some changes
vqd8a Jul 6, 2022
034ef5d
Merge branch 'develop' into hash-map-find-method
vqd8a Jul 6, 2022
7a0aaa0
Use LayoutRight for work view
vqd8a Jul 7, 2022
b982e23
Update spiluk numeric
vqd8a Jul 20, 2022
941387e
Some clean ups
vqd8a Jul 20, 2022
95227eb
Merge branch 'develop' into hash-map-find-method
vqd8a Jul 20, 2022
8b747ea
Apply clang format
vqd8a Jul 21, 2022
728eabf
Merge branch 'develop' into hash-map-find-method
vqd8a Jul 21, 2022
7d14979
Remove printf
vqd8a Jul 21, 2022
f72b456
Clean up
vqd8a Jul 26, 2022
8b6c7b8
Apply clang format
vqd8a Jul 26, 2022
c150c0d
Remove unused variables
vqd8a Jul 26, 2022
0eb52ac
Apply clang format
vqd8a Jul 26, 2022
d615dd1
Remove unused typedef
vqd8a Jul 26, 2022
e40909a
Fix type for k1 and k2
vqd8a Jul 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 37 additions & 13 deletions src/sparse/KokkosSparse_spiluk_handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <Kokkos_Core.hpp>
#include <iostream>
#include <string>
#include <KokkosKernels_HashmapAccumulator.hpp>

#ifndef _SPILUKHANDLE_HPP
#define _SPILUKHANDLE_HPP
Expand Down Expand Up @@ -87,6 +88,12 @@ class SPILUKHandle {
typedef typename Kokkos::View<nnz_lno_t *, HandlePersistentMemorySpace>
nnz_lno_view_t;

typedef typename Kokkos::View<size_type *, Kokkos::HostSpace>
nnz_row_view_host_t;

typedef typename Kokkos::View<nnz_lno_t *, Kokkos::HostSpace>
nnz_lno_view_host_t;

typedef typename std::make_signed<
typename nnz_row_view_t::non_const_value_type>::type signed_integral_t;
typedef Kokkos::View<signed_integral_t *,
Expand All @@ -95,14 +102,19 @@ class SPILUKHandle {
typename nnz_row_view_t::memory_traits>
signed_nnz_lno_view_t;

typedef Kokkos::View<nnz_lno_t **, Kokkos::LayoutRight,
HandlePersistentMemorySpace>
work_view_t;

private:
nnz_row_view_t level_list; // level IDs which the rows belong to
nnz_lno_view_t level_idx; // the list of rows in each level
nnz_lno_view_t
level_ptr; // the starting index (into the view level_idx) of each level
nnz_lno_view_t level_nchunks; // number of chunks of rows at each level
nnz_lno_view_t
nnz_lno_view_host_t level_nchunks; // number of chunks of rows at each level
nnz_lno_view_host_t
level_nrowsperchunk; // maximum number of rows among chunks at each level
work_view_t iw; // working view for mapping dense indices to sparse indices

size_type nrows;
size_type nlevels;
Expand All @@ -128,6 +140,7 @@ class SPILUKHandle {
level_ptr(),
level_nchunks(),
level_nrowsperchunk(),
iw(),
nrows(nrows_),
nlevels(0),
nnzL(nnzL_),
Expand All @@ -147,11 +160,12 @@ class SPILUKHandle {
set_nnzU(nnzU_);
set_level_maxrows(0);
set_level_maxrowsperchunk(0);
level_list = nnz_row_view_t("level_list", nrows_),
level_idx = nnz_lno_view_t("level_idx", nrows_),
level_ptr = nnz_lno_view_t("level_ptr", nrows_ + 1),
level_nchunks = nnz_lno_view_t(), level_nrowsperchunk = nnz_lno_view_t(),
reset_symbolic_complete();
level_list = nnz_row_view_t("level_list", nrows_),
level_idx = nnz_lno_view_t("level_idx", nrows_),
level_ptr = nnz_lno_view_t("level_ptr", nrows_ + 1),
level_nchunks = nnz_lno_view_host_t(),
level_nrowsperchunk = nnz_lno_view_host_t(), reset_symbolic_complete(),
iw = work_view_t();
}

virtual ~SPILUKHandle(){};
Expand All @@ -170,17 +184,28 @@ class SPILUKHandle {
nnz_lno_view_t get_level_ptr() const { return level_ptr; }

KOKKOS_INLINE_FUNCTION
nnz_lno_view_t get_level_nchunks() const { return level_nchunks; }
nnz_lno_view_host_t get_level_nchunks() const { return level_nchunks; }

void alloc_level_nchunks(const size_type nlevels_) {
level_nchunks = nnz_lno_view_t("level_nchunks", nlevels_);
level_nchunks = nnz_lno_view_host_t("level_nchunks", nlevels_);
}

KOKKOS_INLINE_FUNCTION
nnz_lno_view_t get_level_nrowsperchunk() const { return level_nrowsperchunk; }
nnz_lno_view_host_t get_level_nrowsperchunk() const {
return level_nrowsperchunk;
}

void alloc_level_nrowsperchunk(const size_type nlevels_) {
level_nrowsperchunk = nnz_lno_view_t("level_nrowsperchunk", nlevels_);
level_nrowsperchunk = nnz_lno_view_host_t("level_nrowsperchunk", nlevels_);
}

KOKKOS_INLINE_FUNCTION
work_view_t get_iw() const { return iw; }

void alloc_iw(const size_type nrows_, const size_type ncols_) {
iw = work_view_t(Kokkos::view_alloc(Kokkos::WithoutInitializing, "iw"),
nrows_, ncols_);
Kokkos::deep_copy(iw, nnz_lno_t(-1));
}

KOKKOS_INLINE_FUNCTION
Expand Down Expand Up @@ -238,8 +263,7 @@ class SPILUKHandle {
if (algm == SPILUKAlgorithm::SEQLVLSCHD_TP1)
std::cout << "SEQLVLSCHD_TP1" << std::endl;

/*
if ( algm == SPILUKAlgorithm::SEQLVLSCHED_TP2 ) {
/*if ( algm == SPILUKAlgorithm::SEQLVLSCHED_TP2 ) {
std::cout << "SEQLVLSCHED_TP2" << std::endl;;
std::cout << "WARNING: With CUDA this is currently only reliable with
int-int ordinal-offset pair" << std::endl;
Expand Down
Loading