@@ -216,8 +216,8 @@ for (fname,elty) in ((:cusparseScsr2bsr, :Float32),
216
216
indc:: SparseChar = ' O' )
217
217
m,n = size (csr)
218
218
nnz_ref = Ref {Cint} (1 )
219
- mb = div ((m + blockDim - 1 ), blockDim)
220
- nb = div ((n + blockDim - 1 ), blockDim)
219
+ mb = cld (m, blockDim)
220
+ nb = cld (n, blockDim)
221
221
bsrRowPtr = CUDA. zeros (Cint,mb + 1 )
222
222
cudesca = CuMatrixDescriptor (' G' , ' L' , ' N' , inda)
223
223
cudescc = CuMatrixDescriptor (' G' , ' L' , ' N' , indc)
@@ -242,8 +242,8 @@ for (fname,elty) in ((:cusparseSbsr2csr, :Float32),
242
242
function CuSparseMatrixCSR {$elty} (bsr:: CuSparseMatrixBSR{$elty} ;
243
243
inda:: SparseChar = ' O' , indc:: SparseChar = ' O' )
244
244
m,n = size (bsr)
245
- mb = div (m,bsr. blockDim)
246
- nb = div (n,bsr. blockDim)
245
+ mb = cld (m, bsr. blockDim)
246
+ nb = cld (n, bsr. blockDim)
247
247
cudesca = CuMatrixDescriptor (' G' , ' L' , ' N' , inda)
248
248
cudescc = CuMatrixDescriptor (' G' , ' L' , ' N' , indc)
249
249
csrRowPtr = CUDA. zeros (Cint, m + 1 )
@@ -253,7 +253,9 @@ for (fname,elty) in ((:cusparseSbsr2csr, :Float32),
253
253
cudesca, nonzeros (bsr), bsr. rowPtr, bsr. colVal,
254
254
bsr. blockDim, cudescc, csrNzVal, csrRowPtr,
255
255
csrColInd)
256
- CuSparseMatrixCSR (csrRowPtr, csrColInd, csrNzVal, size (bsr))
256
+ # XXX : the size here may not match the expected size, when the matrix dimension
257
+ # is not a multiple of the block dimension!
258
+ CuSparseMatrixCSR (csrRowPtr, csrColInd, csrNzVal, (mb* bsr. blockDim, nb* bsr. blockDim))
257
259
end
258
260
end
259
261
end
0 commit comments