Skip to content

Commit

Permalink
Fix :BSRMV throws warning "free(): invalid pointer"
Browse files Browse the repository at this point in the history
Input and Output vector memory allocation in test
code corrected for blocked CSR format.

Change-Id: I294cd64d3fc2a900b0339156d627365f0d74c877
Signed-off-by: Chithra Sankar <[email protected]>
AMD-Internal: [CPUPL-1334]
  • Loading branch information
chsankar committed Nov 26, 2020
1 parent 4637230 commit 9503b5a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tests/include/testing_bsrmv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,20 @@ void testing_bsrmv(const Arguments& arg)
issymm,
false);

// Update BSR block dimensions from generated matrix
aoclsparse_int mb = (M + bsr_dim - 1) / bsr_dim;
aoclsparse_int nb = (N + bsr_dim - 1) / bsr_dim;

// Allocate memory for vectors
std::vector<T> x(N);
std::vector<T> y(M);
std::vector<T> y_gold(M);
std::vector<T> x(nb * bsr_dim);
std::vector<T> y(mb * bsr_dim);
std::vector<T> y_gold(mb * bsr_dim);

// Initialize data
aoclsparse_init<T>(x, 1, N, 1);
aoclsparse_init<T>(y, 1, M, 1);
aoclsparse_init<T>(x, 1, nb * bsr_dim, 1);
aoclsparse_init<T>(y, 1, mb * bsr_dim, 1);
y_gold = y;

// Update BSR block dimensions from generated matrix
aoclsparse_int mb = (M + bsr_dim - 1) / bsr_dim;
aoclsparse_int nb = (N + bsr_dim - 1) / bsr_dim;
// Convert CSR to BSR
aoclsparse_int nnzb;
std::vector<aoclsparse_int> bsr_row_ptr(mb + 1);
Expand Down

0 comments on commit 9503b5a

Please sign in to comment.