Skip to content

Commit 9cbc61c

Browse files
authored
Merge pull request #6275 from M-Colley/fix/getrs-zimatcopy-info
lapack/imatcopy: set *Info in getrs/zgetrs and fix zimatcopy ldb info
2 parents 8bbde63 + 441bd2e commit 9cbc61c

7 files changed

Lines changed: 65 additions & 17 deletions

File tree

‎interface/lapack/getrs.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ void NAME(char *TRANS, blasint *N, blasint *NRHS, FLOAT *a, blasint *ldA,
104104

105105
if (info != 0) {
106106
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME) - 1);
107+
*Info = -info;
107108
return;
108109
}
109110

‎interface/lapack/zgetrs.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ void NAME(char *TRANS, blasint *N, blasint *NRHS, FLOAT *a, blasint *ldA,
104104

105105
if (info != 0) {
106106
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME) - 1);
107+
*Info = -info;
107108
return;
108109
}
109110

‎interface/lapack/zlauum.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void NAME(char *UPLO, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){
9191
if (args.n < 0) info = 2;
9292
if (uplo < 0) info = 1;
9393
if (info) {
94-
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
94+
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME) - 1);
9595
*Info = - info;
9696
return;
9797
}

‎interface/zimatcopy.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,17 @@ void CNAME( enum CBLAS_ORDER CORDER, enum CBLAS_TRANSPOSE CTRANS, blasint crows,
103103

104104
if ( order == BlasColMajor)
105105
{
106-
if ( trans == BlasNoTrans && *ldb < MAX(1,*rows) ) info = 9;
107-
if ( trans == BlasConj && *ldb < MAX(1,*rows) ) info = 9;
108-
if ( trans == BlasTrans && *ldb < MAX(1,*cols) ) info = 9;
109-
if ( trans == BlasTransConj && *ldb < MAX(1,*cols) ) info = 9;
106+
if ( trans == BlasNoTrans && *ldb < MAX(1,*rows) ) info = 8;
107+
if ( trans == BlasConj && *ldb < MAX(1,*rows) ) info = 8;
108+
if ( trans == BlasTrans && *ldb < MAX(1,*cols) ) info = 8;
109+
if ( trans == BlasTransConj && *ldb < MAX(1,*cols) ) info = 8;
110110
}
111111
if ( order == BlasRowMajor)
112112
{
113-
if ( trans == BlasNoTrans && *ldb < MAX(1,*cols) ) info = 9;
114-
if ( trans == BlasConj && *ldb < MAX(1,*cols) ) info = 9;
115-
if ( trans == BlasTrans && *ldb < MAX(1,*rows) ) info = 9;
116-
if ( trans == BlasTransConj && *ldb < MAX(1,*rows) ) info = 9;
113+
if ( trans == BlasNoTrans && *ldb < MAX(1,*cols) ) info = 8;
114+
if ( trans == BlasConj && *ldb < MAX(1,*cols) ) info = 8;
115+
if ( trans == BlasTrans && *ldb < MAX(1,*rows) ) info = 8;
116+
if ( trans == BlasTransConj && *ldb < MAX(1,*rows) ) info = 8;
117117
}
118118

119119
if ( order == BlasColMajor && *lda < MAX(1,*rows) ) info = 7;

‎utest/test_extensions/test_cimatcopy.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ CTEST(cimatcopy, xerbla_rowmajor_notrans_invalid_ldb)
763763
blasint lda_src = 100, lda_dst = 50;
764764
char order = 'R';
765765
char trans = 'N';
766-
int expected_info = 9;
766+
int expected_info = 8;
767767

768768
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
769769
ASSERT_EQUAL(TRUE, passed);
@@ -780,7 +780,7 @@ CTEST(cimatcopy, xerbla_rowmajor_trans_invalid_ldb)
780780
blasint lda_src = 100, lda_dst = 50;
781781
char order = 'R';
782782
char trans = 'T';
783-
int expected_info = 9;
783+
int expected_info = 8;
784784

785785
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
786786
ASSERT_EQUAL(TRUE, passed);
@@ -797,7 +797,7 @@ CTEST(cimatcopy, xerbla_colmajor_notrans_invalid_ldb)
797797
blasint lda_src = 100, lda_dst = 50;
798798
char order = 'C';
799799
char trans = 'N';
800-
int expected_info = 9;
800+
int expected_info = 8;
801801

802802
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
803803
ASSERT_EQUAL(TRUE, passed);
@@ -814,7 +814,7 @@ CTEST(cimatcopy, xerbla_colmajor_trans_invalid_ldb)
814814
blasint lda_src = 100, lda_dst = 50;
815815
char order = 'C';
816816
char trans = 'T';
817-
int expected_info = 9;
817+
int expected_info = 8;
818818

819819
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
820820
ASSERT_EQUAL(TRUE, passed);

‎utest/test_extensions/test_zimatcopy.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ CTEST(zimatcopy, xerbla_rowmajor_notrans_invalid_ldb)
763763
blasint lda_src = 100, lda_dst = 50;
764764
char order = 'R';
765765
char trans = 'N';
766-
int expected_info = 9;
766+
int expected_info = 8;
767767

768768
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
769769
ASSERT_EQUAL(TRUE, passed);
@@ -780,7 +780,7 @@ CTEST(zimatcopy, xerbla_rowmajor_trans_invalid_ldb)
780780
blasint lda_src = 100, lda_dst = 50;
781781
char order = 'R';
782782
char trans = 'T';
783-
int expected_info = 9;
783+
int expected_info = 8;
784784

785785
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
786786
ASSERT_EQUAL(TRUE, passed);
@@ -797,7 +797,7 @@ CTEST(zimatcopy, xerbla_colmajor_notrans_invalid_ldb)
797797
blasint lda_src = 100, lda_dst = 50;
798798
char order = 'C';
799799
char trans = 'N';
800-
int expected_info = 9;
800+
int expected_info = 8;
801801

802802
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
803803
ASSERT_EQUAL(TRUE, passed);
@@ -814,7 +814,7 @@ CTEST(zimatcopy, xerbla_colmajor_trans_invalid_ldb)
814814
blasint lda_src = 100, lda_dst = 50;
815815
char order = 'C';
816816
char trans = 'T';
817-
int expected_info = 9;
817+
int expected_info = 8;
818818

819819
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
820820
ASSERT_EQUAL(TRUE, passed);

‎utest/test_potrs.c‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,3 +571,49 @@ CTEST(potrf, smoketest_trivial){
571571
}
572572
}
573573
}
574+
575+
static void silent_xerbla(const char *srname, const blasint *vinfo, size_t length)
576+
{
577+
(void)srname;
578+
(void)vinfo;
579+
(void)length;
580+
}
581+
582+
CTEST(potrf, getrs_invalid_arg_info){
583+
char trans = 'N', bad_uplo = 'X';
584+
blasint bad_n = -1, nrhs = 1, n1 = 1, lda = 1, ldb = 1, ipiv = 1, info;
585+
float as = 1.0f, bs = 1.0f;
586+
double ad = 1.0, bd = 1.0;
587+
float ac[2] = {1.0f, 0.0f}, bc[2] = {1.0f, 0.0f};
588+
double az[2] = {1.0, 0.0}, bz[2] = {1.0, 0.0};
589+
openblas_xerbla_handler prev = openblas_set_xerbla(silent_xerbla);
590+
591+
#ifdef BUILD_SINGLE
592+
info = 777;
593+
BLASFUNC(sgetrs)(&trans, &bad_n, &nrhs, &as, &lda, &ipiv, &bs, &ldb, &info);
594+
ASSERT_EQUAL(-2, info);
595+
#endif
596+
#ifdef BUILD_DOUBLE
597+
info = 777;
598+
BLASFUNC(dgetrs)(&trans, &bad_n, &nrhs, &ad, &lda, &ipiv, &bd, &ldb, &info);
599+
ASSERT_EQUAL(-2, info);
600+
#endif
601+
#ifdef BUILD_COMPLEX
602+
info = 777;
603+
BLASFUNC(cgetrs)(&trans, &bad_n, &nrhs, ac, &lda, &ipiv, bc, &ldb, &info);
604+
ASSERT_EQUAL(-2, info);
605+
info = 777;
606+
BLASFUNC(clauum)(&bad_uplo, &n1, ac, &lda, &info);
607+
ASSERT_EQUAL(-1, info);
608+
#endif
609+
#ifdef BUILD_COMPLEX16
610+
info = 777;
611+
BLASFUNC(zgetrs)(&trans, &bad_n, &nrhs, az, &lda, &ipiv, bz, &ldb, &info);
612+
ASSERT_EQUAL(-2, info);
613+
info = 777;
614+
BLASFUNC(zlauum)(&bad_uplo, &n1, az, &lda, &info);
615+
ASSERT_EQUAL(-1, info);
616+
#endif
617+
618+
openblas_set_xerbla(prev);
619+
}

0 commit comments

Comments
 (0)