Skip to content

Commit 5b5eb03

Browse files
author
Timmy
committed
Merge pull request #126 from CNugteren/errorcheck_order
SYMM error-check order and removal of debug printf statements
2 parents 64d0ba3 + 4367daa commit 5b5eb03

File tree

19 files changed

+180
-47
lines changed

19 files changed

+180
-47
lines changed

src/library/blas/ixamax.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,31 @@ doiAmax(
5656

5757
retCode = checkMemObjects(X, scratchBuf, iMax, true, X_VEC_ERRSET, A_MAT_ERRSET, X_VEC_ERRSET );
5858
if (retCode) {
59-
printf("Invalid mem object..\n");
59+
#ifdef DEBUG_iAMAX
60+
printf("Invalid mem object..\n");
61+
#endif
6062
return retCode;
6163
}
6264

6365
// Check wheather enough memory was allocated
6466

6567
if ((retCode = checkVectorSizes(kargs->dtype, N, X, offx, incx, X_VEC_ERRSET ))) {
66-
printf("Invalid Size for X\n");
68+
#ifdef DEBUG_iAMAX
69+
printf("Invalid Size for X\n");
70+
#endif
6771
return retCode;
6872
}
6973
// Minimum size of scratchBuff is 2 * N
7074
if ((retCode = checkVectorSizes(kargs->dtype, (2 * N), scratchBuf, 0, 1, A_MAT_ERRSET ))) {
71-
printf("Insufficient ScratchBuff A\n");
75+
#ifdef DEBUG_iAMAX
76+
printf("Insufficient ScratchBuff A\n");
77+
#endif
7278
return retCode;
7379
}
7480
if ((retCode = checkVectorSizes(TYPE_UNSIGNED_INT, 1, iMax, offiMax, 1, X_VEC_ERRSET ))) {
75-
printf("Invalid Size for iX\n");
81+
#ifdef DEBUG_iAMAX
82+
printf("Invalid Size for iX\n");
83+
#endif
7684
return retCode;
7785
}
7886
///////////////////////////////////////////////////////////////

src/library/blas/xasum.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,32 @@ doAsum(
5959

6060
retCode = checkMemObjects(scratchBuff, asum, X, true, X_VEC_ERRSET, X_VEC_ERRSET, X_VEC_ERRSET );
6161
if (retCode) {
62-
printf("Invalid mem object..\n");
62+
#ifdef DEBUG_ASUM
63+
printf("Invalid mem object..\n");
64+
#endif
6365
return retCode;
6466
}
6567

6668
// Check wheather enough memory was allocated
6769

6870
if ((retCode = checkVectorSizes(kargs->dtype, N, X, offx, incx, X_VEC_ERRSET ))) {
69-
printf("Invalid Size for X\n");
71+
#ifdef DEBUG_ASUM
72+
printf("Invalid Size for X\n");
73+
#endif
7074
return retCode;
7175
}
7276
// Minimum size of scratchBuff is N
7377
if ((retCode = checkVectorSizes(kargs->dtype, N, scratchBuff, 0, 1, X_VEC_ERRSET ))) {
74-
printf("Insufficient ScratchBuff\n");
78+
#ifdef DEBUG_ASUM
79+
printf("Insufficient ScratchBuff\n");
80+
#endif
7581
return retCode;
7682
}
7783

7884
if ((retCode = checkVectorSizes(asumType, 1, asum, offAsum, 1, X_VEC_ERRSET ))) {
79-
printf("Invalid Size for asum\n");
85+
#ifdef DEBUG_ASUM
86+
printf("Invalid Size for asum\n");
87+
#endif
8088
return retCode;
8189
}
8290
///////////////////////////////////////////////////////////////

src/library/blas/xaxpy.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,24 @@ doAxpy(
5454

5555
retCode = checkMemObjects(X, Y, X, false, X_VEC_ERRSET, Y_VEC_ERRSET, X_VEC_ERRSET );
5656
if (retCode) {
57+
#ifdef DEBUG_AXPY
5758
printf("Invalid mem object..\n");
59+
#endif
5860
return retCode;
5961
}
6062

6163
// Check wheather enough memory was allocated
6264

6365
if ((retCode = checkVectorSizes(kargs->dtype, N, X, offx, incx, X_VEC_ERRSET))) {
66+
#ifdef DEBUG_AXPY
6467
printf("Invalid Size for X\n");
68+
#endif
6569
return retCode;
6670
}
6771
if ((retCode = checkVectorSizes(kargs->dtype, N, Y, offy, incy, Y_VEC_ERRSET))) {
72+
#ifdef DEBUG_AXPY
6873
printf("Invalid Size for Y\n");
74+
#endif
6975
return retCode;
7076
}
7177
///////////////////////////////////////////////////////////////

src/library/blas/xcopy.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,24 @@ doCopy(
5454

5555
retCode = checkMemObjects(X, Y, X, false, X_VEC_ERRSET, Y_VEC_ERRSET, X_VEC_ERRSET );
5656
if (retCode) {
57+
#ifdef DEBUG_COPY
5758
printf("Invalid mem object..\n");
59+
#endif
5860
return retCode;
5961
}
6062

6163
// Check wheather enough memory was allocated
6264

6365
if ((retCode = checkVectorSizes(kargs->dtype, N, X, offx, incx, X_VEC_ERRSET))) {
66+
#ifdef DEBUG_COPY
6467
printf("Invalid Size for X\n");
68+
#endif
6569
return retCode;
6670
}
6771
if ((retCode = checkVectorSizes(kargs->dtype, N, Y, offy, incy, Y_VEC_ERRSET))) {
72+
#ifdef DEBUG_COPY
6873
printf("Invalid Size for Y\n");
74+
#endif
6975
return retCode;
7076
}
7177
///////////////////////////////////////////////////////////////

src/library/blas/xdot.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,37 @@ doDot(
6161
retCode = checkMemObjects(X, Y, X, false, X_VEC_ERRSET, Y_VEC_ERRSET, X_VEC_ERRSET );
6262
retCode |= checkMemObjects(scratchBuff, dotProduct, X, false, X_VEC_ERRSET, X_VEC_ERRSET, Y_VEC_ERRSET );
6363
if (retCode) {
64-
printf("Invalid mem object..\n");
64+
#ifdef DEBUG_DOT
65+
printf("Invalid mem object..\n");
66+
#endif
6567
return retCode;
6668
}
6769

6870
// Check wheather enough memory was allocated
6971

7072
if ((retCode = checkVectorSizes(kargs->dtype, N, X, offx, incx, X_VEC_ERRSET))) {
71-
printf("Invalid Size for X\n");
73+
#ifdef DEBUG_DOT
74+
printf("Invalid Size for X\n");
75+
#endif
7276
return retCode;
7377
}
7478
if ((retCode = checkVectorSizes(kargs->dtype, N, Y, offy, incy, Y_VEC_ERRSET))) {
75-
printf("Invalid Size for Y\n");
79+
#ifdef DEBUG_DOT
80+
printf("Invalid Size for Y\n");
81+
#endif
7682
return retCode;
7783
}
7884
// Minimum size of scratchBuff is N
7985
if ((retCode = checkVectorSizes(kargs->dtype, N, scratchBuff, 0, 1, X_VEC_ERRSET))) {
80-
printf("Insufficient ScratchBuff\n");
86+
#ifdef DEBUG_DOT
87+
printf("Insufficient ScratchBuff\n");
88+
#endif
8189
return retCode;
8290
}
8391
if ((retCode = checkVectorSizes(kargs->dtype, 1, dotProduct, offDP, 1, Y_VEC_ERRSET))) {
84-
printf("Invalid Size for dotProduct\n");
92+
#ifdef DEBUG_DOT
93+
printf("Invalid Size for dotProduct\n");
94+
#endif
8595
return retCode;
8696
}
8797
///////////////////////////////////////////////////////////////

src/library/blas/xger.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,31 @@ doGer(
5959
/* Validate arguments */
6060

6161
if ((retCode = checkMemObjects(A, X, Y, true, A_MAT_ERRSET, X_VEC_ERRSET, Y_VEC_ERRSET))) {
62+
#ifdef DEBUG_GER
6263
printf("Invalid mem object..\n");
64+
#endif
6365
return retCode;
6466
}
6567

6668
// Check wheather enough memory was allocated
6769

6870
if ((retCode = checkMatrixSizes(kargs->dtype, order, clblasNoTrans, M, N, A, offa, lda, A_MAT_ERRSET))) {
6971

72+
#ifdef DEBUG_GER
7073
printf("Invalid Size for A %d\n",retCode );
74+
#endif
7175
return retCode;
7276
}
7377
if ((retCode = checkVectorSizes(kargs->dtype, M, X, offx, incx, X_VEC_ERRSET))) {
78+
#ifdef DEBUG_GER
7479
printf("Invalid Size for X\n");
80+
#endif
7581
return retCode;
7682
}
7783
if ((retCode = checkVectorSizes(kargs->dtype, N, Y, offy, incy, Y_VEC_ERRSET))) {
84+
#ifdef DEBUG_GER
7885
printf("Invalid Size for Y\n");
86+
#endif
7987
return retCode;
8088
}
8189
///////////////////////////////////////////////////////////////

src/library/blas/xher.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,22 @@ doher(
5757
/* Validate arguments */
5858

5959
if ((retCode = checkMemObjects(A, X, 0, false, A_MAT_ERRSET, X_VEC_ERRSET, END_ERRSET))) {
60-
printf("Invalid mem object..\n");
60+
#ifdef DEBUG_HER
61+
printf("Invalid mem object..\n");
62+
#endif
6163
return retCode;
6264
}
6365

6466
if ((retCode = checkMatrixSizes(kargs->dtype, order, clblasNoTrans, N, N, A, offa, lda, A_MAT_ERRSET))) {
67+
#ifdef DEBUG_HER
6568
printf("Invalid Size for A\n");
69+
#endif
6670
return retCode;
6771
}
6872
if ((retCode = checkVectorSizes(kargs->dtype, N, X, offx, incx, X_VEC_ERRSET))) {
73+
#ifdef DEBUG_HER
6974
printf("Invalid Size for X\n");
75+
#endif
7076
return retCode;
7177
}
7278

src/library/blas/xher2.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,29 @@ doHer2(
6060
/* Validate arguments */
6161

6262
if ((retCode = checkMemObjects(A, X, Y, true, A_MAT_ERRSET, X_VEC_ERRSET, Y_VEC_ERRSET))) {
63+
#ifdef DEBUG_HER2
6364
printf("Invalid mem object..\n");
65+
#endif
6466
return retCode;
6567
}
6668

6769
if ((retCode = checkMatrixSizes(kargs->dtype, order, clblasNoTrans, N, N, A, offa, lda, A_MAT_ERRSET))) {
70+
#ifdef DEBUG_HER2
6871
printf("Invalid Size for A\n");
72+
#endif
6973
return retCode;
7074
}
7175
if ((retCode = checkVectorSizes(kargs->dtype, N, X, offx, incx, X_VEC_ERRSET))) {
76+
#ifdef DEBUG_HER2
7277
printf("Invalid Size for X\n");
78+
#endif
7379
return retCode;
7480
}
7581

7682
if ((retCode = checkVectorSizes(kargs->dtype, N, Y, offy, incy, Y_VEC_ERRSET))) {
83+
#ifdef DEBUG_HER2
7784
printf("Invalid Size for Y\n");
85+
#endif
7886
return retCode;
7987
}
8088

src/library/blas/xrot.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,24 @@ doRot(
5252

5353
retCode = checkMemObjects(X, Y, X, false, X_VEC_ERRSET, Y_VEC_ERRSET, X_VEC_ERRSET );
5454
if (retCode) {
55-
printf("Invalid mem object..\n");
55+
#ifdef DEBUG_ROT
56+
printf("Invalid mem object..\n");
57+
#endif
5658
return retCode;
5759
}
5860

5961
// Check wheather enough memory was allocated
6062

6163
if ((retCode = checkVectorSizes(kargs->dtype, N, X, offx, incx, X_VEC_ERRSET))) {
62-
printf("Invalid Size for X\n");
64+
#ifdef DEBUG_ROT
65+
printf("Invalid Size for X\n");
66+
#endif
6367
return retCode;
6468
}
6569
if ((retCode = checkVectorSizes(kargs->dtype, N, Y, offy, incy, Y_VEC_ERRSET))) {
66-
printf("Invalid Size for Y\n");
70+
#ifdef DEBUG_ROT
71+
printf("Invalid Size for Y\n");
72+
#endif
6773
return retCode;
6874
}
6975
///////////////////////////////////////////////////////////////

src/library/blas/xrotg.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,33 +58,45 @@ doRotg(
5858

5959
retCode = checkMemObjects(A, B, A, false, X_VEC_ERRSET, Y_VEC_ERRSET, X_VEC_ERRSET );
6060
if (retCode) { // for mem objects A, B
61-
printf("Invalid mem object..\n");
61+
#ifdef DEBUG_ROTG
62+
printf("Invalid mem object..\n");
63+
#endif
6264
return retCode;
6365
}
6466
retCode = checkMemObjects(C, S, C, false, X_VEC_ERRSET, Y_VEC_ERRSET, X_VEC_ERRSET );
6567
if (retCode) { // for mem objects C, S
66-
printf("Invalid mem object..\n");
68+
#ifdef DEBUG_ROTG
69+
printf("Invalid mem object..\n");
70+
#endif
6771
return retCode;
6872
}
6973

7074
// Check wheather enough memory was allocated
7175

7276
if ((retCode = checkVectorSizes(kargs->dtype, 1, A, offA, 1, X_VEC_ERRSET))) {
73-
printf("Invalid Size for A\n");
77+
#ifdef DEBUG_ROTG
78+
printf("Invalid Size for A\n");
79+
#endif
7480
return retCode;
7581
}
7682
if ((retCode = checkVectorSizes(kargs->dtype, 1, B, offB, 1, Y_VEC_ERRSET))) {
77-
printf("Invalid Size for B\n");
83+
#ifdef DEBUG_ROTG
84+
printf("Invalid Size for B\n");
85+
#endif
7886
return retCode;
7987
}
8088

8189
if ((retCode = checkVectorSizes(cType, 1, C, offC, 1, X_VEC_ERRSET))) {
82-
printf("Invalid Size for C\n");
90+
#ifdef DEBUG_ROTG
91+
printf("Invalid Size for C\n");
92+
#endif
8393
return retCode;
8494
}
8595

8696
if ((retCode = checkVectorSizes(kargs->dtype, 1, S, offS, 1, Y_VEC_ERRSET))) {
87-
printf("Invalid Size for S\n");
97+
#ifdef DEBUG_ROTG
98+
printf("Invalid Size for S\n");
99+
#endif
88100
return retCode;
89101
}
90102
///////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)