-
Notifications
You must be signed in to change notification settings - Fork 99
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
Add early return if numRows == 0 in trsv to avoid integer divide-by-zero error #2180
Add early return if numRows == 0 in trsv to avoid integer divide-by-zero error #2180
Conversation
@MalachiTimothyPhillips thanks for the PR, can you reset this to point at the develop branch instead of master? |
Here's the clang-format diff:
diff --git a/sparse/impl/KokkosSparse_trsv_impl.hpp b/sparse/impl/KokkosSparse_trsv_impl.hpp
index 6d43c55dc..6d04a4287 100644
--- a/sparse/impl/KokkosSparse_trsv_impl.hpp
+++ b/sparse/impl/KokkosSparse_trsv_impl.hpp
@@ -184,8 +184,8 @@ struct TrsvWrap {
static void lowerTriSolveCsrUnitDiag(RangeMultiVectorType X,
const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numPointRows = A.numPointRows();
const lno_t block_size = numPointRows / numRows;
@@ -213,8 +213,8 @@ struct TrsvWrap {
static void lowerTriSolveCsr(RangeMultiVectorType X, const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numPointRows = A.numPointRows();
const lno_t block_size = numPointRows / numRows;
@@ -258,8 +258,8 @@ struct TrsvWrap {
static void upperTriSolveCsrUnitDiag(RangeMultiVectorType X,
const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numPointRows = A.numPointRows();
const lno_t block_size = numPointRows / numRows;
@@ -310,8 +310,8 @@ struct TrsvWrap {
static void upperTriSolveCsr(RangeMultiVectorType X, const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numPointRows = A.numPointRows();
const lno_t block_size = numPointRows / numRows;
@@ -379,8 +379,8 @@ struct TrsvWrap {
static void upperTriSolveCscUnitDiag(RangeMultiVectorType X,
const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numCols = A.numCols();
const lno_t numPointRows = A.numPointRows();
@@ -432,8 +432,8 @@ struct TrsvWrap {
static void upperTriSolveCsc(RangeMultiVectorType X, const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numCols = A.numCols();
const lno_t numPointRows = A.numPointRows();
@@ -493,8 +493,8 @@ struct TrsvWrap {
static void lowerTriSolveCscUnitDiag(RangeMultiVectorType X,
const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numCols = A.numCols();
const lno_t numPointRows = A.numPointRows();
@@ -524,8 +524,8 @@ struct TrsvWrap {
static void upperTriSolveCscUnitDiagConj(RangeMultiVectorType X,
const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numCols = A.numCols();
const lno_t numPointRows = A.numPointRows();
@@ -578,8 +578,8 @@ struct TrsvWrap {
static void upperTriSolveCscConj(RangeMultiVectorType X,
const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numCols = A.numCols();
const lno_t numPointRows = A.numPointRows();
@@ -638,8 +638,8 @@ struct TrsvWrap {
static void lowerTriSolveCsc(RangeMultiVectorType X, const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numCols = A.numCols();
const lno_t numPointRows = A.numPointRows();
@@ -677,8 +677,8 @@ struct TrsvWrap {
static void lowerTriSolveCscUnitDiagConj(RangeMultiVectorType X,
const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numCols = A.numCols();
const lno_t numPointRows = A.numPointRows();
@@ -708,8 +708,8 @@ struct TrsvWrap {
static void lowerTriSolveCscConj(RangeMultiVectorType X,
const CrsMatrixType& A,
DomainMultiVectorType Y) {
- const lno_t numRows = A.numRows();
- if(numRows == 0) return;
+ const lno_t numRows = A.numRows();
+ if (numRows == 0) return;
const lno_t numCols = A.numCols();
const lno_t numPointRows = A.numPointRows(); Edit: separated the job output from the diff patch |
Thank you! I didn't realize there was a |
46afef0
to
35e115a
Compare
Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging |
Status Flag 'Pre-Test Inspection' - SUCCESS: The last commit to this Pull Request has been INSPECTED by label AT: PRE-TEST INSPECTED! Autotester is Removing Label; this inspection will remain valid until a new commit to source branch is performed. |
Status Flag 'Pull Request AutoTester' - Testing Jenkins Projects: Pull Request Auto Testing STARTING (click to expand)Build InformationTest Name: KokkosKernels_PullRequest_CUDA11_CUDA11_LayoutRight
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_GCC930_Light_Tpls_GCC930_Tpls_CLANG13CUDA10
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_GNU1021
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_GNU1021_Light_LayoutRight
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_Tpls_GNU1021
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_Tpls_INTEL19_solo
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_CLANG1001_solo
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_A64FX_Tpls_ARMPL2110
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_A64FX_GCC1020
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_VEGA90A_ROCM561
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_VEGA90A_Tpls_ROCM561
Jenkins Parameters
Using Repos:
Pull Request Author: MalachiTimothyPhillips |
Status Flag 'Pull Request AutoTester' - Jenkins Testing: all Jobs PASSED Pull Request Auto Testing has PASSED (click to expand)Build InformationTest Name: KokkosKernels_PullRequest_CUDA11_CUDA11_LayoutRight
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_GCC930_Light_Tpls_GCC930_Tpls_CLANG13CUDA10
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_GNU1021
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_GNU1021_Light_LayoutRight
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_Tpls_GNU1021
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_Tpls_INTEL19_solo
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_CLANG1001_solo
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_A64FX_Tpls_ARMPL2110
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_A64FX_GCC1020
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_VEGA90A_ROCM561
Jenkins Parameters
Build InformationTest Name: KokkosKernels_PullRequest_VEGA90A_Tpls_ROCM561
Jenkins Parameters
|
Status Flag 'Pre-Merge Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging |
All Jobs Finished; status = PASSED, However Inspection must be performed before merge can occur... |
Thanks, @ndellingwood! |
…de-by-zero-in-trsv Add early return if numRows == 0 in trsv to avoid integer divide-by-zero error (cherry picked from commit 83374bf)
Fixes #2179, although some unit test coverage for this case would be nice.