Documentation
¶
Overview ¶
Package crtutil allows cudart to work with Go's io Reader and Writer interfaces.
This package only works with devices that have Compute Capability 6.1 and up.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator struct {
// contains filtered or unexported fields
}
Allocator alocates memory to the current device
func CreateAllocator ¶
CreateAllocator creates an allocator whose memory it creates does async mem copies. This creates its own worker for device passed.
func (*Allocator) AllocateMemory ¶
func (a *Allocator) AllocateMemory(size uint) (r *ReadWriter, err error)
AllocateMemory allocates memory on the current device. Allocater allocates memory for device that was passed when created onto the devices default context.
type ReadWriter ¶
type ReadWriter struct {
// contains filtered or unexported fields
}
ReadWriter is made to work with the golang io packages
func NewReadWriter ¶
NewReadWriter returns ReadWriter from already allocated memory passed in p. It just needs to know the size of the memory. If s is nil. Then it will do a non async copy. If it is not nil then it will do a async copy.
func (*ReadWriter) DPtr ¶
func (r *ReadWriter) DPtr() *unsafe.Pointer
DPtr satisfies cutil.DPointer interface.
func (*ReadWriter) Len ¶
func (r *ReadWriter) Len() int
Len returns the remaining bytes that are not read.
func (*ReadWriter) Ptr ¶
func (r *ReadWriter) Ptr() unsafe.Pointer
Ptr satisfies cutil.Pointer interface.
func (*ReadWriter) Read ¶
func (r *ReadWriter) Read(b []byte) (n int, err error)
Read satisfies the io.Reader interface
func (*ReadWriter) Size ¶
func (r *ReadWriter) Size() uint
Size returns the total size in bytes of the memory the readwriter holds