void setup_buffer( double alpha, double beta, const std::string& path ) { int fileError = sparseHeaderfromFile(&n_vals, &n_rows, &n_cols, path.c_str()); if (fileError != 0) { throw clsparse::io_exception( "Could not read matrix market header from disk: " + path); } if (csrMatrixfromFile(row_offsets, col_indices, values, path.c_str(), explicit_zeroes)) { throw clsparse::io_exception( "Could not read matrix market from disk: " + path); } //n_rows = row_offsets.size( ); //n_cols = col_indices.size( ); //n_vals = values.size( ); cudaError_t err = cudaMalloc( (void**) &device_row_offsets, (n_rows + 1) * sizeof( clsparseIdx_t ) ); CUDA_V_THROW( err, "cudaMalloc device_row_offsets" ); err = cudaMalloc( (void**) &device_col_indices, n_vals * sizeof( clsparseIdx_t ) ); CUDA_V_THROW( err, "cudaMalloc device_col_indices" ); err = cudaMalloc( (void**) &device_values, n_vals * sizeof( T ) ); CUDA_V_THROW( err, "cudaMalloc device_values" ); err = cudaMalloc( (void**) &device_A, n_rows * n_cols * sizeof( T ) ); CUDA_V_THROW( err, "cudaMalloc device_A" ); }
void setup_buffer(double alpha, double beta, const std::string& path) { int fileError = sparseHeaderfromFile(&n_vals, &n_rows, &n_cols, path.c_str()); if (fileError != 0) { throw clsparse::io_exception("Could not read matrix market header from disk"); } if (csrMatrixfromFile(row_offsets, col_indices, values, path.c_str())) { throw clsparse::io_exception("Could not read matrix market header from disk"); } cudaError_t err = cudaMalloc((void**)&device_row_offsets, (n_rows + 1) * sizeof(int)); CUDA_V_THROW(err, "cudaMalloc device_row_offsets"); err = cudaMalloc((void**)&device_col_indices, n_vals * sizeof(int)); CUDA_V_THROW(err, "cudaMalloc device_col_indices"); err = cudaMalloc((void**)&device_values, n_vals * sizeof(T)); CUDA_V_THROW(err, "cudaMalloc device_values"); err = cudaMalloc((void**)&device_A, n_rows * n_cols * sizeof(T)); CUDA_V_THROW(err, "cudaMalloc device_A"); // Output CSR err = cudaMalloc((void**)&devRowOffsets, (n_rows + 1) * sizeof(int)); CUDA_V_THROW(err, "cudaMalloc devRowOffsets"); err = cudaMalloc((void**)&devColIndices, n_vals * sizeof(int)); CUDA_V_THROW(err, "cudaMalloc devColIndices"); err = cudaMalloc((void**)&devValues, n_vals * sizeof(T)); CUDA_V_THROW(err, "cudaMalloc devValues"); // Allocate memory for nnzPerRow err = cudaMalloc((void**)&nnzPerRow, n_rows * sizeof(int)); CUDA_V_THROW(err, "cudaMalloc nnzPerRow"); }// end