memutils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsyncCopyDeviceToDevice

func AsyncCopyDeviceToDevice(
	dst, src unsafe.Pointer, bytes int, stream unsafe.Pointer, device int)

AsyncCopyDeviceToDevice asynchronously copies the src device buffer to the dst device buffer buffer on the specified stream.

func AsyncCopyDeviceToHost

func AsyncCopyDeviceToHost(
	dst, src unsafe.Pointer, bytes int, stream unsafe.Pointer, device int)

AsyncCopyDeviceToHost asynchronously copies the device buffer to the host buffer on the specified stream.

func AsyncCopyHostToDevice

func AsyncCopyHostToDevice(
	dst, src unsafe.Pointer, bytes int, stream unsafe.Pointer, device int)

AsyncCopyHostToDevice asynchronously copies the host buffer to the device buffer on the specified stream.

func CreateCudaStream

func CreateCudaStream(device int) unsafe.Pointer

CreateCudaStream creates a Cuda stream.

func CudaProfilerStart

func CudaProfilerStart()

CudaProfilerStart starts/resumes the profiler.

func CudaProfilerStop

func CudaProfilerStop()

CudaProfilerStop stops/pauses the profiler.

func DestroyCudaStream

func DestroyCudaStream(stream unsafe.Pointer, device int)

DestroyCudaStream destroys the specified Cuda stream.

func DeviceAllocate

func DeviceAllocate(bytes, device int) unsafe.Pointer

DeviceAllocate allocates the specified amount of memory on the device.

func DeviceFree

func DeviceFree(ptr unsafe.Pointer, device int)

DeviceFree frees the specified memory from the device.

func GetDeviceCount

func GetDeviceCount() int

GetDeviceCount returns the number of GPU devices

func GetDeviceGlobalMemoryInMB

func GetDeviceGlobalMemoryInMB(device int) int

GetDeviceGlobalMemoryInMB returns the total global memory(MB) for a given device

func HostAlloc

func HostAlloc(bytes int) unsafe.Pointer

HostAlloc allocates memory in C.

func HostFree

func HostFree(p unsafe.Pointer)

HostFree frees memory allocated in C.

func MakeSliceFromCPtr

func MakeSliceFromCPtr(cptr uintptr, length int) []byte

MakeSliceFromCPtr make a slice that points to data that cptr points to. cptr must be a c-allocated pointer as the garbage collector will not update that uintptr's value if the golang object movee.

func MemAccess

func MemAccess(p unsafe.Pointer, offset int) unsafe.Pointer

MemAccess access memory location with starting pointer and an offset.

func MemCopy

func MemCopy(dst unsafe.Pointer, src unsafe.Pointer, bytes int)

MemCopy performs memory copy of specified bytes from src to dst

func MemDist

func MemDist(p1 unsafe.Pointer, p2 unsafe.Pointer) int64

MemDist returns the distance between two unsafe pointer.

func MemEqual

func MemEqual(a unsafe.Pointer, b unsafe.Pointer, bytes int) bool

MemEqual performs byte to byte comparison.

func MemSwap

func MemSwap(dst unsafe.Pointer, src unsafe.Pointer, bytes int)

MemSwap performs memory copy of specified bytes from src to dst

func WaitForCudaStream

func WaitForCudaStream(stream unsafe.Pointer, device int)

WaitForCudaStream block waits until all pending operations are finished on the specified Cuda stream.

Types

type AsyncMemCopyFunc

type AsyncMemCopyFunc func(dst, src unsafe.Pointer, bytes int, stream unsafe.Pointer, device int)

AsyncMemCopyFunc is a abstraction of DeviceToDevice, DeviceToHost, HostToDevice memcopy functions

Jump to

Keyboard shortcuts

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