cgoutils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsyncCopyDeviceToDevice added in v0.0.2

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 added in v0.0.2

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 added in v0.0.2

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 added in v0.0.2

func CreateCudaStream(device int) unsafe.Pointer

CreateCudaStream creates a Cuda stream.

func CudaProfilerStart added in v0.0.2

func CudaProfilerStart()

CudaProfilerStart starts/resumes the profiler.

func CudaProfilerStop added in v0.0.2

func CudaProfilerStop()

CudaProfilerStop stops/pauses the profiler.

func DestroyCudaStream added in v0.0.2

func DestroyCudaStream(stream unsafe.Pointer, device int)

DestroyCudaStream destroys the specified Cuda stream.

func DeviceAllocate added in v0.0.2

func DeviceAllocate(bytes, device int) unsafe.Pointer

DeviceAllocate allocates the specified amount of memory on the device.

func DeviceFree added in v0.0.2

func DeviceFree(ptr unsafe.Pointer, device int)

DeviceFree frees the specified memory from the device.

func DoCGoCall

func DoCGoCall(f func() (uintptr, unsafe.Pointer)) uintptr

DoCGoCall is the function wrapper to call a cgo function, check whether there is any exception thrown by the function and converted it to a golang error if any.

func GetDeviceCount added in v0.0.2

func GetDeviceCount() int

GetDeviceCount returns the number of GPU devices

func GetDeviceGlobalMemoryInMB added in v0.0.2

func GetDeviceGlobalMemoryInMB(device int) int

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

func GetDeviceMemoryInfo added in v0.0.2

func GetDeviceMemoryInfo(device int) (int, int)

GetDeviceMemoryInfo returns information about total size and free size of device memory in bytes for a specfic device.

func GetFlags added in v0.0.2

func GetFlags() C.DeviceMemoryFlags

GetFlags return flags about the memory management.

func HostAlloc added in v0.0.2

func HostAlloc(bytes int) unsafe.Pointer

HostAlloc allocates memory in C.

func HostFree added in v0.0.2

func HostFree(p unsafe.Pointer)

HostFree frees memory allocated in C.

func HostMemCpy added in v0.0.2

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

HostMemCpy copies memory between two host addresses

func IsDeviceMemoryImplementation added in v0.0.2

func IsDeviceMemoryImplementation() bool

func IsPooledMemory added in v0.0.2

func IsPooledMemory() bool

func MakeSliceFromCPtr added in v0.0.2

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 SupportHashReduction added in v0.0.2

func SupportHashReduction() bool

func WaitForCudaStream added in v0.0.2

func WaitForCudaStream(stream unsafe.Pointer, device int)

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

Types

type AsyncMemCopyFunc added in v0.0.2

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