@@ -57,7 +57,6 @@ class CSRSparseEnvironment : public ::testing::Environment {
5757 csrSMatrix.num_nonzeros = n_vals;
5858 csrSMatrix.num_rows = n_rows;
5959 csrSMatrix.num_cols = n_cols;
60- clsparseCsrMetaSize (&csrSMatrix, CLSE::control);
6160
6261 // Load single precision data from file; this API loads straight into GPU memory
6362 cl_int status;
@@ -70,13 +69,15 @@ class CSRSparseEnvironment : public ::testing::Environment {
7069 csrSMatrix.rowOffsets = ::clCreateBuffer (context, CL_MEM_READ_ONLY,
7170 (csrSMatrix.num_rows + 1 ) * sizeof (cl_int), NULL , &status);
7271
73- csrSMatrix.rowBlocks = ::clCreateBuffer (context, CL_MEM_READ_ONLY,
74- csrSMatrix.rowBlockSize * sizeof (cl_ulong), NULL , &status);
75-
7672 clsparseStatus fileError = clsparseSCsrMatrixfromFile (&csrSMatrix, file_name.c_str (), CLSE::control);
7773 if (fileError != clsparseSuccess)
7874 throw std::runtime_error (" Could not read matrix market data from disk" );
7975
76+ clsparseCsrMetaSize (&csrSMatrix, CLSE::control);
77+ csrSMatrix.rowBlocks = ::clCreateBuffer ( context, CL_MEM_READ_WRITE,
78+ csrSMatrix.rowBlockSize * sizeof ( cl_ulong ), NULL , &status );
79+ clsparseCsrMetaCompute ( &csrSMatrix, CLSE::control );
80+
8081 // Download sparse matrix data to host
8182 // First, create space on host to hold the data
8283 ublasSCsr = sMatrixType (n_rows, n_cols, n_vals);
@@ -310,4 +311,4 @@ class CSRSparseEnvironment : public ::testing::Environment {
310311};
311312
312313
313- #endif // _SPARSE_MATRIX_ENVIRONMENT_H_
314+ #endif // _SPARSE_MATRIX_ENVIRONMENT_H_
0 commit comments