Hi Mat,
I defined pBuffer as integer (8) in the interface. Now the compiling seems OK, however the execution with cuda-memcheck gave me
========= Invalid global write of size 4
========= at 0x000004d0 in void pcrGtsvBatchFirstPass(pcrGtsvBatchGlobalMemParams_t)
========= by thread (160,0,0) in block (0,181,0)
========= Address 0x00a2a400 is out of bounds
========= Device Frame:void pcrGtsvBatchFirstPass(pcrGtsvBatchGlobalMemParams_t) (void pcrGtsvBatchFirstPass(pcrGtsvBatchGlobalMemParams_t) : 0x4d0)
I did not have any errors when using gtsv, of course gtsv did not need the interface to interpret the variables. The difference between the calling of gtsv and gtsv2 is just the pBuffer.
The interface for gtsv2 is as follows,
40 interface
41 integer (4) function cusparseSgtsv2StridedBatch(handle, m, dl, d, du, x, batchCount, batchStride,pBuffer) bind(C,name='cusparseSgtsv2StridedBatch')
42 use cusparse
43 implicit none
44 type(cusparseHandle),value :: handle
45 integer(4),value :: m, n, batchCount, batchStride
46 real(4),dimension(*), device :: dl, d, du, x
47 integer(8),value :: pBuffer
48 end function cusparseSgtsv2StridedBatch
49 integer (4) function cusparseSgtsv2StridedBatch_bufferSizeExt(handle, m, dl, d, du, x, batchCount, batchStride,pBuffer) bind(C,name='cusparseSgtsv2StridedBatch_bufferSizeExt')
50 use cusparse
51 implicit none
52 type(cusparseHandle),value :: handle
53 integer(4),value :: m, n, batchCount, batchStride
54 real(4),dimension(*), device :: dl, d, du, x
55 integer(8),value :: pBuffer
56 end function cusparseSgtsv2StridedBatch_bufferSizeExt
57 end interface
Part of the calling codes are as follows:
real(SP), dimension(:),ALLOCATABLE, device :: Arow,Brow,Crow,Drow
integer (8) :: buf
integer :: MGlob, NGlob
type(cusparseHandle),save :: cusparseh
status = cusparseSgtsv2StridedBatch_bufferSizeExt(cusparseh, MGlob, Arow, Brow, Crow, Drow, NGlob, MGlob,buf)
status = cusparseSgtsv2StridedBatch(cusparseh, MGlob, Arow, Brow, Crow, Drow, NGlob, MGlob,buf)