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

Sparse matrix addition (related to Trilinos pull request #1957) #122

Merged
merged 3 commits into from
Feb 14, 2018
Merged

Sparse matrix addition (related to Trilinos pull request #1957) #122

merged 3 commits into from
Feb 14, 2018

Conversation

brian-kelley
Copy link
Contributor

Same interface as spgemm (separate symbolic/numeric)
Implemented in sparse/KokkosSparse_spadd.hpp
Has associated handle type (like spgemm) and unit tests

Implemented in sparse/KokkosSparse_spadd.hpp
Has associated handle type (like spgemm) and unit tests
addHandle->set_a_b_pos(a_pos, b_pos);
}
//provide the number of NNZ in C to user through handle
addHandle->set_max_result_nnz(c_rowmap(nrows));
Copy link
Contributor

@mndevec mndevec Feb 14, 2018

Choose a reason for hiding this comment

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

This causes memory access errors if UVM is not enabled on GPUs. Something like below is needed for this.
auto d_c_nnz_size = Kokkos::subview(c_rowmap, nrows);
auto h_c_nnz_size = Kokkos::create_mirror_view (d_c_nnz_size);
Kokkos::deep_copy (h_c_nnz_size, d_c_nnz_size);
execution_space::fence();
addHandle->set_max_result_nnz(h_c_nnz_size());

Kokkos::parallel_scan(range_type(0, nrows + 1), prefix);
//compute uncompressed entries of C (just indices, no scalars)
execution_space::fence();
c_nnz_upperbound = c_rowmap_upperbound(nrows);
Copy link
Contributor

@mndevec mndevec Feb 14, 2018

Choose a reason for hiding this comment

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

    auto d_c_nnz_size = Kokkos::subview(c_rowmap_upperbound, nrows);
    auto h_c_nnz_size = Kokkos::create_mirror_view (d_c_nnz_size);
    Kokkos::deep_copy (h_c_nnz_size, d_c_nnz_size);
    execution_space::fence();
    c_nnz_upperbound = h_c_nnz_size();

execution_space::fence();
clno_nnz_view_t_ a_pos("A entry positions", a_rowmap(nrows));
clno_nnz_view_t_ b_pos("B entry positions", b_rowmap(nrows));
//merge the entries and compute Apos/Bpos, as well as Crowcounts
Copy link
Contributor

@mndevec mndevec Feb 14, 2018

Choose a reason for hiding this comment

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

same this for lines 477 and 478. The array cannot be accessed by the host.
Simply, we can use a_entries.dimension_0() here, right?

mndevec and others added 2 commits February 14, 2018 16:02
    - Changing the name of the function to spadd to be consistent with the file name.
    - Minor fixes for UVM spaces.
Minor edits for SpADD function.
@mndevec mndevec merged commit c8d99c8 into kokkos:develop Feb 14, 2018
@crtrott
Copy link
Member

crtrott commented Feb 14, 2018

Somebody needs to rework this to follow our coding guidelines as well as adding ETI and the TPL hooks etc.

@mndevec
Copy link
Contributor

mndevec commented Feb 14, 2018

@crtrott
I have the issue listed here:
#151

brian-kelley added a commit to brian-kelley/kokkos-kernels that referenced this pull request Aug 5, 2024
SpAdd handle was originally a copy-paste of the spgemm
handle way back in kokkos#122, and included get_sort_option() and
set_sort_option() from spgemm. But these try to use the member
bool sort_option, which doesn't exist. Somehow these functions never
produced compile errors until someone tried to call them.
brian-kelley added a commit that referenced this pull request Aug 6, 2024
SpAdd handle was originally a copy-paste of the spgemm
handle way back in #122, and included get_sort_option() and
set_sort_option() from spgemm. But these try to use the member
bool sort_option, which doesn't exist. Somehow these functions never
produced compile errors until someone tried to call them.
lucbv pushed a commit to lucbv/kokkos-kernels that referenced this pull request Aug 8, 2024
SpAdd handle was originally a copy-paste of the spgemm
handle way back in kokkos#122, and included get_sort_option() and
set_sort_option() from spgemm. But these try to use the member
bool sort_option, which doesn't exist. Somehow these functions never
produced compile errors until someone tried to call them.
ndellingwood pushed a commit to ndellingwood/kokkos-kernels that referenced this pull request Sep 4, 2024
SpAdd handle was originally a copy-paste of the spgemm
handle way back in kokkos#122, and included get_sort_option() and
set_sort_option() from spgemm. But these try to use the member
bool sort_option, which doesn't exist. Somehow these functions never
produced compile errors until someone tried to call them.
ndellingwood added a commit that referenced this pull request Sep 12, 2024
* Restore size_t as default offset, in Tribits builds (#2313)

If building KokkosKernels standalone, leave int as the default offset
(this was the case since #2140). But if building KokkosKernels as a
Trilinos/Tribits package, then make size_t the default offset because
this is what the Tpetra stack currently uses.

Signed-off-by: Brian Kelley <bmkelle@sandia.gov>

* Improve crs/bsr sorting performance (#2293)

* CRS sorting improvements

- Wrote bulk sort/permutation based sorting for CRS graph, matrix, and
  BSR matrix (bulk = one large sort of all the entries, using row-major
  dense index as keys)
  - This is more performant for imbalanced entries per row
- If matrix dimensions are too large to do bulk sort, fall back to
  sorting within each row with a thread.

* Add perf test for sort_crs_matrix
* sort_crs: improve parallel labels
* Work around kokkos issue 7036
* sort_crs: replace radix sort lambda with functor
(Lambda segfaults with nvcc+openmp)
---------
Signed-off-by: Brian Kelley <bmkelle@sandia.gov>

* SpAdd handle: delete sort_option getter/setter (#2296)

SpAdd handle was originally a copy-paste of the spgemm
handle way back in #122, and included get_sort_option() and
set_sort_option() from spgemm. But these try to use the member
bool sort_option, which doesn't exist. Somehow these functions never
produced compile errors until someone tried to call them.

* Improve GH action to produce release artifacts (#2312)

* coo2csr: add parens to function calls (#2318)

* Update changelog

* Update master_history.txt

* .github/workflows: Group jobs under common github-AT2 name (#2320)

* Update master_history.txt

---------

Signed-off-by: Brian Kelley <bmkelle@sandia.gov>
Co-authored-by: brian-kelley <bmkelle@sandia.gov>
Co-authored-by: Damien L-G <dalg24@gmail.com>
Co-authored-by: Carl Pearson <cwpearson@users.noreply.github.com>
Co-authored-by: Evan Harvey <57234914+e10harvey@users.noreply.github.com>
lucbv pushed a commit that referenced this pull request Sep 13, 2024
* Set version number to 4.4.01

* [4.4.01] Patches to 4.4.01 (#2327)

* Restore size_t as default offset, in Tribits builds (#2313)

If building KokkosKernels standalone, leave int as the default offset
(this was the case since #2140). But if building KokkosKernels as a
Trilinos/Tribits package, then make size_t the default offset because
this is what the Tpetra stack currently uses.

Signed-off-by: Brian Kelley <bmkelle@sandia.gov>

* Improve crs/bsr sorting performance (#2293)

* CRS sorting improvements

- Wrote bulk sort/permutation based sorting for CRS graph, matrix, and
  BSR matrix (bulk = one large sort of all the entries, using row-major
  dense index as keys)
  - This is more performant for imbalanced entries per row
- If matrix dimensions are too large to do bulk sort, fall back to
  sorting within each row with a thread.

* Add perf test for sort_crs_matrix
* sort_crs: improve parallel labels
* Work around kokkos issue 7036
* sort_crs: replace radix sort lambda with functor
(Lambda segfaults with nvcc+openmp)
---------
Signed-off-by: Brian Kelley <bmkelle@sandia.gov>

* SpAdd handle: delete sort_option getter/setter (#2296)

SpAdd handle was originally a copy-paste of the spgemm
handle way back in #122, and included get_sort_option() and
set_sort_option() from spgemm. But these try to use the member
bool sort_option, which doesn't exist. Somehow these functions never
produced compile errors until someone tried to call them.

* Improve GH action to produce release artifacts (#2312)

* coo2csr: add parens to function calls (#2318)

* Update changelog

* Update master_history.txt

* .github/workflows: Group jobs under common github-AT2 name (#2320)

* Update master_history.txt

---------

Signed-off-by: Brian Kelley <bmkelle@sandia.gov>
Co-authored-by: brian-kelley <bmkelle@sandia.gov>
Co-authored-by: Damien L-G <dalg24@gmail.com>
Co-authored-by: Carl Pearson <cwpearson@users.noreply.github.com>
Co-authored-by: Evan Harvey <57234914+e10harvey@users.noreply.github.com>

* Update master_history.txt for 4.4.01

---------

Signed-off-by: Brian Kelley <bmkelle@sandia.gov>
Co-authored-by: brian-kelley <bmkelle@sandia.gov>
Co-authored-by: Damien L-G <dalg24@gmail.com>
Co-authored-by: Carl Pearson <cwpearson@users.noreply.github.com>
Co-authored-by: Evan Harvey <57234914+e10harvey@users.noreply.github.com>
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.

4 participants