Skip to content

Commit

Permalink
Add numerical checking helper to Level 2 functions (#1237)
Browse files Browse the repository at this point in the history
* Added numerical checking to symmetric, hermitian and triangular matrices

* Some more changes

* Removed a header in rocblas_init.hpp

* more changes

* Addressed the comments

* reverted to strerror

* Added numerical checking helper to Level 2 functions
  • Loading branch information
NaveenElumalaiAMD authored May 10, 2022
1 parent 003a63a commit 1585f4d
Show file tree
Hide file tree
Showing 40 changed files with 404 additions and 157 deletions.
70 changes: 37 additions & 33 deletions library/src/blas2/rocblas_gemv_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,39 +689,43 @@ rocblas_status rocblas_gemv_check_numerics(const char* function_name,
const int check_numerics,
bool is_input)
{
rocblas_status check_numerics_status
= rocblas_internal_check_numerics_matrix_template(function_name,
handle,
rocblas_operation_none,
rocblas_fill_full,
rocblas_client_general_matrix,
m,
n,
A,
offset_a,
lda,
stride_a,
batch_count,
check_numerics,
is_input);
if(check_numerics_status != rocblas_status_success)
return check_numerics_status;

//Checking trans_a to transpose a vector 'x'
rocblas_int n_x = trans_a == rocblas_operation_none ? n : m;

check_numerics_status = rocblas_internal_check_numerics_vector_template(function_name,
handle,
n_x,
x,
offset_x,
inc_x,
stride_x,
batch_count,
check_numerics,
is_input);
if(check_numerics_status != rocblas_status_success)
return check_numerics_status;
rocblas_status check_numerics_status = rocblas_status_success;
if(is_input)
{
check_numerics_status
= rocblas_internal_check_numerics_matrix_template(function_name,
handle,
rocblas_operation_none,
rocblas_fill_full,
rocblas_client_general_matrix,
m,
n,
A,
offset_a,
lda,
stride_a,
batch_count,
check_numerics,
is_input);
if(check_numerics_status != rocblas_status_success)
return check_numerics_status;

//Checking trans_a to transpose a vector 'x'
rocblas_int n_x = trans_a == rocblas_operation_none ? n : m;

check_numerics_status = rocblas_internal_check_numerics_vector_template(function_name,
handle,
n_x,
x,
offset_x,
inc_x,
stride_x,
batch_count,
check_numerics,
is_input);
if(check_numerics_status != rocblas_status_success)
return check_numerics_status;
}

//Checking trans_a to transpose a vector 'y'
rocblas_int n_y = trans_a == rocblas_operation_none ? m : n;
Expand Down
50 changes: 26 additions & 24 deletions library/src/blas2/rocblas_ger_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,30 +264,32 @@ rocblas_status rocblas_ger_check_numerics(const char* function_name,
if(check_numerics_status != rocblas_status_success)
return check_numerics_status;

check_numerics_status = rocblas_internal_check_numerics_vector_template(function_name,
handle,
m,
x,
offset_x,
inc_x,
stride_x,
batch_count,
check_numerics,
is_input);
if(check_numerics_status != rocblas_status_success)
return check_numerics_status;

check_numerics_status = rocblas_internal_check_numerics_vector_template(function_name,
handle,
n,
y,
offset_y,
inc_y,
stride_y,
batch_count,
check_numerics,
is_input);

if(is_input)
{
check_numerics_status = rocblas_internal_check_numerics_vector_template(function_name,
handle,
m,
x,
offset_x,
inc_x,
stride_x,
batch_count,
check_numerics,
is_input);
if(check_numerics_status != rocblas_status_success)
return check_numerics_status;

check_numerics_status = rocblas_internal_check_numerics_vector_template(function_name,
handle,
n,
y,
offset_y,
inc_y,
stride_y,
batch_count,
check_numerics,
is_input);
}
return check_numerics_status;
}

Expand Down
2 changes: 2 additions & 0 deletions library/src/blas2/rocblas_hemv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ namespace
rocblas_status hemv_check_numerics_status
= rocblas_hemv_check_numerics(rocblas_hemv_name<T>,
handle,
uplo,
n,
A,
0,
Expand Down Expand Up @@ -196,6 +197,7 @@ namespace
rocblas_status hemv_check_numerics_status
= rocblas_hemv_check_numerics(rocblas_hemv_name<T>,
handle,
uplo,
n,
A,
0,
Expand Down
2 changes: 2 additions & 0 deletions library/src/blas2/rocblas_hemv_batched.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ namespace
rocblas_status hemv_check_numerics_status
= rocblas_hemv_check_numerics(rocblas_hemv_name<T>,
handle,
uplo,
n,
A,
0,
Expand Down Expand Up @@ -200,6 +201,7 @@ namespace
rocblas_status hemv_check_numerics_status
= rocblas_hemv_check_numerics(rocblas_hemv_name<T>,
handle,
uplo,
n,
A,
0,
Expand Down
2 changes: 2 additions & 0 deletions library/src/blas2/rocblas_hemv_strided_batched.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ namespace
rocblas_status hemv_check_numerics_status
= rocblas_hemv_check_numerics(rocblas_hemv_name<T>,
handle,
uplo,
n,
A,
0,
Expand Down Expand Up @@ -220,6 +221,7 @@ namespace
rocblas_status hemv_check_numerics_status
= rocblas_hemv_check_numerics(rocblas_hemv_name<T>,
handle,
uplo,
n,
A,
0,
Expand Down
2 changes: 2 additions & 0 deletions library/src/blas2/rocblas_hemv_symv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ ROCBLAS_INTERNAL_EXPORT_NOINLINE rocblas_status
template <typename T, typename U>
rocblas_status rocblas_hemv_check_numerics(const char* function_name,
rocblas_handle handle,
rocblas_fill uplo,
rocblas_int n,
T A,
rocblas_stride offset_a,
Expand All @@ -147,6 +148,7 @@ rocblas_status rocblas_hemv_check_numerics(const char* function_name,
template <typename T, typename U>
rocblas_status rocblas_symv_check_numerics(const char* function_name,
rocblas_handle handle,
rocblas_fill uplo,
rocblas_int n,
T A,
rocblas_stride offset_a,
Expand Down
Loading

0 comments on commit 1585f4d

Please sign in to comment.