crtutil

package
v0.0.0-...-c9f06ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2020 License: MIT Imports: 6 Imported by: 0

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

func CreateAllocator(s gocu.Streamer, d gocu.Device) (a *Allocator)

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

func NewReadWriter(p cutil.Pointer, size uint, s gocu.Streamer) *ReadWriter

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) Reset

func (r *ReadWriter) Reset()

Reset resets the index to 0.

func (*ReadWriter) Size

func (r *ReadWriter) Size() uint

Size returns the total size in bytes of the memory the readwriter holds

func (*ReadWriter) Write

func (r *ReadWriter) Write(b []byte) (n int, err error)

Write satisfies the io.Writer interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL