Documentation
¶
Overview ¶
Package gocca provides Go bindings for OCCA (Open Concurrent Compute Abstraction).
OCCA is a portable and vendor-neutral framework for parallel programming on heterogeneous platforms. It supports multiple backends including Serial, OpenMP, CUDA, OpenCL, HIP, SYCL, and Metal.
Basic usage:
device, err := gocca.NewDevice(`{"mode": "Serial"}`)
if err != nil {
log.Fatal(err)
}
defer device.Free()
For more information about OCCA, see https://github.com/libocca/occa
Index ¶
- Constants
- Variables
- func Bool(value bool) C.occaType
- func Char(value int8) C.occaType
- func CopyMemToMem(dest, src *OCCAMemory, bytes int64, destOffset, srcOffset int64, ...)
- func CopyMemToPtr(dest unsafe.Pointer, src *OCCAMemory, bytes int64, offset int64, ...)
- func CopyPtrToMem(dest *OCCAMemory, src unsafe.Pointer, bytes int64, offset int64, ...)
- func Double(value float64) C.occaType
- func DtypesAreEqual(a, b *OCCADtype) bool
- func DtypesMatch(a, b *OCCADtype) bool
- func Finish()
- func Float(value float32) C.occaType
- func Free(value *C.occaType)
- func GetGoccaVersion() string
- func GetMajorVersion() int
- func GetMinorVersion() int
- func GetOccaVersion() string
- func GetPatchVersion() int
- func GetVersionInfo() string
- func HeaderVersion() string
- func HeaderVersionNumber() string
- func Int(value int) C.occaType
- func Int8(value int8) C.occaType
- func Int16(value int16) C.occaType
- func Int32(value int32) C.occaType
- func Int64(value int64) C.occaType
- func IsDefault(value C.occaType) bool
- func IsUndefined(value C.occaType) bool
- func Long(value int64) C.occaType
- func OverrideStderr(err func(string))
- func OverrideStdout(out func(string))
- func PrintModeInfo()
- func PrintTypeInfo(value C.occaType)
- func Ptr(value unsafe.Pointer) C.occaType
- func SetDevice(device *OCCADevice)
- func SetDeviceFromString(info string)
- func SetStream(stream *OCCAStream)
- func Short(value int16) C.occaType
- func StreamUnwrap(stream *OCCAStream) unsafe.Pointer
- func String(str string) C.occaType
- func Struct(value unsafe.Pointer, bytes uint64) C.occaType
- func TimeBetweenTags(startTag, endTag *OCCAStreamTag) float64
- func UChar(value uint8) C.occaType
- func UInt(value uint) C.occaType
- func UInt8(value uint8) C.occaType
- func UInt16(value uint16) C.occaType
- func UInt32(value uint32) C.occaType
- func UInt64(value uint64) C.occaType
- func ULong(value uint64) C.occaType
- func UShort(value uint16) C.occaType
- func Version() string
- func VersionNumber() string
- func WaitForTag(tag *OCCAStreamTag)
- type OCCADevice
- func (d *OCCADevice) BuildKernel(filename, kernelName string, props *OCCAJson) (*OCCAKernel, error)
- func (d *OCCADevice) BuildKernelFromBinary(filename, kernelName string, props *OCCAJson) (*OCCAKernel, error)
- func (d *OCCADevice) BuildKernelFromString(source, kernelName string, props *OCCAJson) (*OCCAKernel, error)
- func (d *OCCADevice) CreateMemoryPool(props *OCCAJson) *OCCAMemoryPool
- func (d *OCCADevice) CreateStream(props *OCCAJson) *OCCAStream
- func (d *OCCADevice) Finish()
- func (d *OCCADevice) Free()
- func (d *OCCADevice) GetKernelProperties() *OCCAJson
- func (d *OCCADevice) GetMemoryProperties() *OCCAJson
- func (d *OCCADevice) GetProperties() *OCCAJson
- func (d *OCCADevice) GetStream() *OCCAStream
- func (d *OCCADevice) HasSeparateMemorySpace() bool
- func (d *OCCADevice) IsInitialized() bool
- func (d *OCCADevice) IsThreadLocked() bool
- func (d *OCCADevice) Malloc(bytes int64, src unsafe.Pointer, props *OCCAJson) *OCCAMemory
- func (d *OCCADevice) MallocFloat32(data []float32) *OCCAMemory
- func (d *OCCADevice) MallocFloat64(data []float64) *OCCAMemory
- func (d *OCCADevice) MallocInt32(data []int32) *OCCAMemory
- func (d *OCCADevice) MallocInt64(data []int64) *OCCAMemory
- func (d *OCCADevice) MemoryAllocated() int64
- func (d *OCCADevice) MemorySize() int64
- func (d *OCCADevice) Mode() string
- func (d *OCCADevice) SetStream(stream *OCCAStream)
- func (d *OCCADevice) TagStream() *OCCAStreamTag
- func (d *OCCADevice) TimeBetweenTags(startTag, endTag *OCCAStreamTag) float64
- func (d *OCCADevice) TypedMalloc(entries int64, dtype *OCCADtype, src unsafe.Pointer, props *OCCAJson) *OCCAMemory
- func (d *OCCADevice) TypedWrapMemory(ptr unsafe.Pointer, entries int64, dtype *OCCADtype, props *OCCAJson) *OCCAMemory
- func (d *OCCADevice) WaitForTag(tag *OCCAStreamTag)
- func (d *OCCADevice) WrapMemory(ptr unsafe.Pointer, bytes int64, props *OCCAJson) *OCCAMemory
- type OCCADim
- type OCCADtype
- type OCCAJson
- func (j *OCCAJson) ArrayClear()
- func (j *OCCAJson) ArrayGet(index int) interface{}
- func (j *OCCAJson) ArrayInsert(index int, value interface{}) error
- func (j *OCCAJson) ArrayPop()
- func (j *OCCAJson) ArrayPush(value interface{}) error
- func (j *OCCAJson) ArraySize() int
- func (j *OCCAJson) CastToArray()
- func (j *OCCAJson) CastToBoolean()
- func (j *OCCAJson) CastToNumber()
- func (j *OCCAJson) CastToObject()
- func (j *OCCAJson) CastToString()
- func (j *OCCAJson) Dump(indent int) string
- func (j *OCCAJson) Free()
- func (j *OCCAJson) GetBoolean() bool
- func (j *OCCAJson) GetNumber(typeFlag int) interface{}
- func (j *OCCAJson) GetString() string
- func (j *OCCAJson) IsArray() bool
- func (j *OCCAJson) IsBoolean() bool
- func (j *OCCAJson) IsNumber() bool
- func (j *OCCAJson) IsObject() bool
- func (j *OCCAJson) IsString() bool
- func (j *OCCAJson) ObjectGet(key string, defaultValue interface{}) interface{}
- func (j *OCCAJson) ObjectHas(key string) bool
- func (j *OCCAJson) ObjectSet(key string, value interface{}) error
- func (j *OCCAJson) Write(filename string)
- type OCCAKernel
- func (k *OCCAKernel) BinaryFilename() string
- func (k *OCCAKernel) ClearArgs()
- func (k *OCCAKernel) Free()
- func (k *OCCAKernel) FullHash() string
- func (k *OCCAKernel) GetDevice() *OCCADevice
- func (k *OCCAKernel) GetProperties() *OCCAJson
- func (k *OCCAKernel) Hash() string
- func (k *OCCAKernel) IsInitialized() bool
- func (k *OCCAKernel) MaxDims() int
- func (k *OCCAKernel) MaxInnerDims() OCCADim
- func (k *OCCAKernel) MaxOuterDims() OCCADim
- func (k *OCCAKernel) Name() string
- func (k *OCCAKernel) PushArg(arg interface{}) error
- func (k *OCCAKernel) Run(args ...interface{})
- func (k *OCCAKernel) RunFromArgs()
- func (k *OCCAKernel) RunWithArgs(args ...interface{}) error
- func (k *OCCAKernel) SetRunDims(outerDims, innerDims OCCADim)
- func (k *OCCAKernel) SourceFilename() string
- type OCCAMemory
- func Malloc(bytes int64, src unsafe.Pointer, props *OCCAJson) *OCCAMemory
- func TypedMalloc(entries int64, dtype *OCCADtype, src unsafe.Pointer, props *OCCAJson) *OCCAMemory
- func TypedWrapMemory(ptr unsafe.Pointer, entries int64, dtype *OCCADtype, props *OCCAJson) *OCCAMemory
- func WrapMemory(ptr unsafe.Pointer, bytes int64, props *OCCAJson) *OCCAMemory
- func (m *OCCAMemory) Clone() *OCCAMemory
- func (dst *OCCAMemory) CopyDeviceToDevice(dstOffset int64, src *OCCAMemory, srcOffset int64, bytes int64)
- func (dst *OCCAMemory) CopyDeviceToDeviceWithProps(dstOffset int64, src *OCCAMemory, srcOffset int64, bytes int64, ...)
- func (m *OCCAMemory) CopyFrom(src unsafe.Pointer, bytes int64)
- func (m *OCCAMemory) CopyFromFloat32(data []float32)
- func (m *OCCAMemory) CopyFromFloat64(data []float64)
- func (m *OCCAMemory) CopyFromInt32(data []int32)
- func (m *OCCAMemory) CopyFromInt64(data []int64)
- func (m *OCCAMemory) CopyFromWithOffset(src unsafe.Pointer, bytes int64, offset int64)
- func (m *OCCAMemory) CopyFromWithProps(src unsafe.Pointer, bytes int64, offset int64, props *OCCAJson)
- func (m *OCCAMemory) CopyTo(dst unsafe.Pointer, bytes int64)
- func (m *OCCAMemory) CopyToFloat32(data []float32)
- func (m *OCCAMemory) CopyToFloat64(data []float64)
- func (m *OCCAMemory) CopyToInt32(data []int32)
- func (m *OCCAMemory) CopyToInt64(data []int64)
- func (m *OCCAMemory) CopyToWithOffset(dst unsafe.Pointer, bytes int64, offset int64)
- func (m *OCCAMemory) CopyToWithProps(dst unsafe.Pointer, bytes int64, offset int64, props *OCCAJson)
- func (m *OCCAMemory) Detach()
- func (m *OCCAMemory) Free()
- func (m *OCCAMemory) GetDevice() *OCCADevice
- func (m *OCCAMemory) GetProperties() *OCCAJson
- func (m *OCCAMemory) IsInitialized() bool
- func (m *OCCAMemory) Ptr() unsafe.Pointer
- func (m *OCCAMemory) Size() uint64
- func (m *OCCAMemory) Slice(offset, bytes int64) *OCCAMemory
- type OCCAMemoryPool
- func (p *OCCAMemoryPool) Alignment() uint64
- func (p *OCCAMemoryPool) Free()
- func (p *OCCAMemoryPool) GetDevice() *OCCADevice
- func (p *OCCAMemoryPool) GetProperties() *OCCAJson
- func (p *OCCAMemoryPool) IsInitialized() bool
- func (p *OCCAMemoryPool) NumReservations() uint64
- func (p *OCCAMemoryPool) Reserve(bytes uint64) *OCCAMemory
- func (p *OCCAMemoryPool) Reserved() uint64
- func (p *OCCAMemoryPool) Resize(bytes uint64)
- func (p *OCCAMemoryPool) SetAlignment(alignment uint64)
- func (p *OCCAMemoryPool) ShrinkToFit()
- func (p *OCCAMemoryPool) Size() uint64
- func (p *OCCAMemoryPool) TypedReserve(entries uint64, dtype *OCCADtype) *OCCAMemory
- type OCCAStream
- type OCCAStreamTag
Constants ¶
const ( OccaMajorVersion = C.OCCA_MAJOR_VERSION OccaMinorVersion = C.OCCA_MINOR_VERSION OccaPatchVersion = C.OCCA_PATCH_VERSION OccaVersionStr = C.OCCA_VERSION_STR // GoCCA version - automatically updated by git export-subst // $Format:Describe=%D$ // $Format:CommitHash=%H$ GoccaVersionInfo = "$Format:%d$" GoccaCommitHash = "$Format:%h$" )
Version constants from OCCA headers at compile time
Variables ¶
var ( DtypeNone = &OCCADtype{dtype: C.getDtypeNone()} DtypeVoid = &OCCADtype{dtype: C.getDtypeVoid()} DtypeByte = &OCCADtype{dtype: C.getDtypeByte()} DtypeBool = &OCCADtype{dtype: C.getDtypeBool()} DtypeChar = &OCCADtype{dtype: C.getDtypeChar()} DtypeShort = &OCCADtype{dtype: C.getDtypeShort()} DtypeInt = &OCCADtype{dtype: C.getDtypeInt()} DtypeLong = &OCCADtype{dtype: C.getDtypeLong()} DtypeFloat = &OCCADtype{dtype: C.getDtypeFloat()} DtypeDouble = &OCCADtype{dtype: C.getDtypeDouble()} DtypeInt8 = &OCCADtype{dtype: C.getDtypeInt8()} DtypeUint8 = &OCCADtype{dtype: C.getDtypeUint8()} DtypeInt16 = &OCCADtype{dtype: C.getDtypeInt16()} DtypeUint16 = &OCCADtype{dtype: C.getDtypeUint16()} DtypeInt32 = &OCCADtype{dtype: C.getDtypeInt32()} DtypeUint32 = &OCCADtype{dtype: C.getDtypeUint32()} DtypeInt64 = &OCCADtype{dtype: C.getDtypeInt64()} DtypeUint64 = &OCCADtype{dtype: C.getDtypeUint64()} // OKL Primitives DtypeUchar2 = &OCCADtype{dtype: C.getDtypeUchar2()} DtypeUchar3 = &OCCADtype{dtype: C.getDtypeUchar3()} DtypeUchar4 = &OCCADtype{dtype: C.getDtypeUchar4()} DtypeChar2 = &OCCADtype{dtype: C.getDtypeChar2()} DtypeChar3 = &OCCADtype{dtype: C.getDtypeChar3()} DtypeChar4 = &OCCADtype{dtype: C.getDtypeChar4()} DtypeUshort2 = &OCCADtype{dtype: C.getDtypeUshort2()} DtypeUshort3 = &OCCADtype{dtype: C.getDtypeUshort3()} DtypeUshort4 = &OCCADtype{dtype: C.getDtypeUshort4()} DtypeShort2 = &OCCADtype{dtype: C.getDtypeShort2()} DtypeShort3 = &OCCADtype{dtype: C.getDtypeShort3()} DtypeShort4 = &OCCADtype{dtype: C.getDtypeShort4()} DtypeUint2 = &OCCADtype{dtype: C.getDtypeUint2()} DtypeUint3 = &OCCADtype{dtype: C.getDtypeUint3()} DtypeUint4 = &OCCADtype{dtype: C.getDtypeUint4()} DtypeInt2 = &OCCADtype{dtype: C.getDtypeInt2()} DtypeInt3 = &OCCADtype{dtype: C.getDtypeInt3()} DtypeInt4 = &OCCADtype{dtype: C.getDtypeInt4()} DtypeUlong2 = &OCCADtype{dtype: C.getDtypeUlong2()} DtypeUlong3 = &OCCADtype{dtype: C.getDtypeUlong3()} DtypeUlong4 = &OCCADtype{dtype: C.getDtypeUlong4()} DtypeLong2 = &OCCADtype{dtype: C.getDtypeLong2()} DtypeLong3 = &OCCADtype{dtype: C.getDtypeLong3()} DtypeLong4 = &OCCADtype{dtype: C.getDtypeLong4()} DtypeFloat2 = &OCCADtype{dtype: C.getDtypeFloat2()} DtypeFloat3 = &OCCADtype{dtype: C.getDtypeFloat3()} DtypeFloat4 = &OCCADtype{dtype: C.getDtypeFloat4()} DtypeDouble2 = &OCCADtype{dtype: C.getDtypeDouble2()} DtypeDouble3 = &OCCADtype{dtype: C.getDtypeDouble3()} DtypeDouble4 = &OCCADtype{dtype: C.getDtypeDouble4()} )
Built-in data types
var ( OCCA_UNDEFINED = int(C.getOccaUndefined()) OCCA_DEFAULT = int(C.getOccaDefault()) OCCA_NULL = int(C.getOccaNull()) OCCA_PTR = int(C.getOccaPtr()) OCCA_BOOL = int(C.getOccaBool()) OCCA_INT8 = int(C.getOccaInt8()) OCCA_UINT8 = int(C.getOccaUint8()) OCCA_INT16 = int(C.getOccaInt16()) OCCA_UINT16 = int(C.getOccaUint16()) OCCA_INT32 = int(C.getOccaInt32()) OCCA_UINT32 = int(C.getOccaUint32()) OCCA_INT64 = int(C.getOccaInt64()) OCCA_UINT64 = int(C.getOccaUint64()) OCCA_FLOAT = int(C.getOccaFloat()) OCCA_DOUBLE = int(C.getOccaDouble()) OCCA_STRUCT = int(C.getOccaStruct()) OCCA_STRING = int(C.getOccaString()) OCCA_DEVICE = int(C.getOccaDevice()) OCCA_KERNEL = int(C.getOccaKernel()) OCCA_KERNELBUILDER = int(C.getOccaKernelBuilder()) OCCA_MEMORY = int(C.getOccaMemory()) OCCA_MEMORYPOOL = int(C.getOccaMemoryPool()) OCCA_STREAM = int(C.getOccaStream()) OCCA_STREAMTAG = int(C.getOccaStreamTag()) OCCA_DTYPE = int(C.getOccaDtype()) OCCA_SCOPE = int(C.getOccaScope()) OCCA_JSON = int(C.getOccaJson()) )
Type flags
var (
OccaAllBytes = uint64(C.getOccaAllBytes())
)
Global values
Functions ¶
func CopyMemToMem ¶ added in v1.2.0
func CopyMemToMem(dest, src *OCCAMemory, bytes int64, destOffset, srcOffset int64, props *OCCAJson)
CopyMemToMem copies memory from one device memory to another
func CopyMemToPtr ¶ added in v1.2.0
CopyMemToPtr copies from device memory to host pointer
func CopyPtrToMem ¶ added in v1.2.0
CopyPtrToMem copies from host pointer to device memory
func DtypesAreEqual ¶ added in v0.9.1
DtypesAreEqual checks if two data types are equal
func DtypesMatch ¶ added in v0.9.1
DtypesMatch checks if two data types match
func Finish ¶ added in v0.9.1
func Finish()
Finish waits for all operations to complete on current device
func GetGoccaVersion ¶ added in v1.2.0
func GetGoccaVersion() string
GetGoccaVersion returns the GoCCA wrapper version
func GetMajorVersion ¶ added in v1.2.0
func GetMajorVersion() int
GetMajorVersion returns the OCCA major version number
func GetMinorVersion ¶ added in v1.2.0
func GetMinorVersion() int
GetMinorVersion returns the OCCA minor version number
func GetOccaVersion ¶ added in v1.2.0
func GetOccaVersion() string
GetOccaVersion returns the OCCA version this wrapper was compiled against
func GetPatchVersion ¶ added in v1.2.0
func GetPatchVersion() int
GetPatchVersion returns the OCCA patch version number
func GetVersionInfo ¶ added in v1.2.0
func GetVersionInfo() string
GetVersionInfo returns version information string
func HeaderVersion ¶ added in v1.2.0
func HeaderVersion() string
HeaderVersion returns the OCCA header version string (same as Version for compatibility)
func HeaderVersionNumber ¶ added in v1.2.0
func HeaderVersionNumber() string
HeaderVersionNumber returns the OCCA header version number (same as VersionNumber for compatibility)
func IsUndefined ¶ added in v0.9.1
IsUndefined checks if a value is undefined
func OverrideStderr ¶ added in v0.9.1
func OverrideStderr(err func(string))
OverrideStderr is a placeholder for OCCA stderr override Currently not implemented due to CGo callback limitations
func OverrideStdout ¶ added in v0.9.1
func OverrideStdout(out func(string))
OverrideStdout is a placeholder for OCCA stdout override Currently not implemented due to CGo callback limitations
func PrintModeInfo ¶ added in v0.9.1
func PrintModeInfo()
PrintModeInfo prints information about available modes
func PrintTypeInfo ¶ added in v0.9.1
PrintTypeInfo prints information about an OCCA type
func SetDevice ¶ added in v0.9.1
func SetDevice(device *OCCADevice)
SetDevice sets the current device
func SetDeviceFromString ¶ added in v0.9.1
func SetDeviceFromString(info string)
SetDeviceFromString sets the current device from a string
func SetStream ¶ added in v0.9.1
func SetStream(stream *OCCAStream)
SetStream sets the current stream
func StreamUnwrap ¶ added in v0.9.1
func StreamUnwrap(stream *OCCAStream) unsafe.Pointer
StreamUnwrap returns the underlying stream pointer
func TimeBetweenTags ¶ added in v0.9.1
func TimeBetweenTags(startTag, endTag *OCCAStreamTag) float64
TimeBetweenTags returns the time in seconds between two tags
func Version ¶ added in v1.2.0
func Version() string
Version returns the OCCA version string (for api_completeness_test.go)
func VersionNumber ¶ added in v1.2.0
func VersionNumber() string
VersionNumber returns the OCCA version as a formatted string "major.minor.patch"
func WaitForTag ¶ added in v0.9.1
func WaitForTag(tag *OCCAStreamTag)
WaitForTag waits for a stream tag to be reached
Types ¶
type OCCADevice ¶
type OCCADevice struct {
// contains filtered or unexported fields
}
func CreateDevice ¶ added in v1.2.0
func CreateDevice(props *OCCAJson) (*OCCADevice, error)
CreateDevice creates a new OCCA device from JSON properties (direct C API equivalent)
func CreateDeviceFromString ¶ added in v0.9.1
func CreateDeviceFromString(info string) (*OCCADevice, error)
CreateDeviceFromString creates a device from a string configuration
func NewDevice ¶
func NewDevice(deviceInfo string) (*OCCADevice, error)
NewDevice creates a new OCCA device with the given properties (string convenience method)
func (*OCCADevice) BuildKernel ¶
func (d *OCCADevice) BuildKernel(filename, kernelName string, props *OCCAJson) (*OCCAKernel, error)
BuildKernel builds a kernel from source file
func (*OCCADevice) BuildKernelFromBinary ¶ added in v0.9.1
func (d *OCCADevice) BuildKernelFromBinary(filename, kernelName string, props *OCCAJson) (*OCCAKernel, error)
BuildKernelFromBinary builds a kernel from binary file
func (*OCCADevice) BuildKernelFromString ¶ added in v0.9.1
func (d *OCCADevice) BuildKernelFromString(source, kernelName string, props *OCCAJson) (*OCCAKernel, error)
BuildKernelFromString builds a kernel from source string
func (*OCCADevice) CreateMemoryPool ¶ added in v0.9.1
func (d *OCCADevice) CreateMemoryPool(props *OCCAJson) *OCCAMemoryPool
CreateMemoryPool creates a new memory pool
func (*OCCADevice) CreateStream ¶ added in v0.9.1
func (d *OCCADevice) CreateStream(props *OCCAJson) *OCCAStream
CreateStream creates a new stream
func (*OCCADevice) Finish ¶ added in v0.9.1
func (d *OCCADevice) Finish()
Finish waits for all operations to complete
func (*OCCADevice) Free ¶
func (d *OCCADevice) Free()
Free frees the device and unlocks the thread if it's locked
func (*OCCADevice) GetKernelProperties ¶ added in v0.9.1
func (d *OCCADevice) GetKernelProperties() *OCCAJson
GetKernelProperties returns kernel properties
func (*OCCADevice) GetMemoryProperties ¶ added in v0.9.1
func (d *OCCADevice) GetMemoryProperties() *OCCAJson
GetMemoryProperties returns memory properties
func (*OCCADevice) GetProperties ¶ added in v0.9.1
func (d *OCCADevice) GetProperties() *OCCAJson
GetProperties returns device properties
func (*OCCADevice) GetStream ¶ added in v0.9.1
func (d *OCCADevice) GetStream() *OCCAStream
GetStream returns the current stream
func (*OCCADevice) HasSeparateMemorySpace ¶ added in v0.9.1
func (d *OCCADevice) HasSeparateMemorySpace() bool
HasSeparateMemorySpace checks if device has separate memory space
func (*OCCADevice) IsInitialized ¶ added in v0.9.1
func (d *OCCADevice) IsInitialized() bool
IsInitialized checks if the device is initialized
func (*OCCADevice) IsThreadLocked ¶ added in v1.2.0
func (d *OCCADevice) IsThreadLocked() bool
IsThreadLocked returns whether this device has locked the OS thread
func (*OCCADevice) Malloc ¶
func (d *OCCADevice) Malloc(bytes int64, src unsafe.Pointer, props *OCCAJson) *OCCAMemory
Malloc allocates memory on the device
func (*OCCADevice) MallocFloat32 ¶
func (d *OCCADevice) MallocFloat32(data []float32) *OCCAMemory
MallocFloat32 allocates memory for float32 slice
func (*OCCADevice) MallocFloat64 ¶ added in v0.9.1
func (d *OCCADevice) MallocFloat64(data []float64) *OCCAMemory
MallocFloat64 allocates memory for float64 slice
func (*OCCADevice) MallocInt32 ¶
func (d *OCCADevice) MallocInt32(data []int32) *OCCAMemory
MallocInt32 allocates memory for int32 slice
func (*OCCADevice) MallocInt64 ¶ added in v0.9.1
func (d *OCCADevice) MallocInt64(data []int64) *OCCAMemory
MallocInt64 allocates memory for int64 slice
func (*OCCADevice) MemoryAllocated ¶ added in v0.9.1
func (d *OCCADevice) MemoryAllocated() int64
MemoryAllocated returns the amount of memory allocated
func (*OCCADevice) MemorySize ¶ added in v0.9.1
func (d *OCCADevice) MemorySize() int64
MemorySize returns the device memory size
func (*OCCADevice) Mode ¶ added in v0.9.1
func (d *OCCADevice) Mode() string
Mode returns the device mode (e.g., "Serial", "OpenMP", "CUDA", etc.)
func (*OCCADevice) SetStream ¶ added in v0.9.1
func (d *OCCADevice) SetStream(stream *OCCAStream)
SetStream sets the current stream
func (*OCCADevice) TagStream ¶ added in v0.9.1
func (d *OCCADevice) TagStream() *OCCAStreamTag
TagStream tags the current position in the stream
func (*OCCADevice) TimeBetweenTags ¶ added in v0.9.1
func (d *OCCADevice) TimeBetweenTags(startTag, endTag *OCCAStreamTag) float64
TimeBetweenTags returns the time in seconds between two tags
func (*OCCADevice) TypedMalloc ¶ added in v0.9.1
func (d *OCCADevice) TypedMalloc(entries int64, dtype *OCCADtype, src unsafe.Pointer, props *OCCAJson) *OCCAMemory
TypedMalloc allocates typed memory on the device
func (*OCCADevice) TypedWrapMemory ¶ added in v0.9.1
func (d *OCCADevice) TypedWrapMemory(ptr unsafe.Pointer, entries int64, dtype *OCCADtype, props *OCCAJson) *OCCAMemory
TypedWrapMemory wraps existing typed memory
func (*OCCADevice) WaitForTag ¶ added in v0.9.1
func (d *OCCADevice) WaitForTag(tag *OCCAStreamTag)
WaitForTag waits for a stream tag to be reached
func (*OCCADevice) WrapMemory ¶ added in v0.9.1
func (d *OCCADevice) WrapMemory(ptr unsafe.Pointer, bytes int64, props *OCCAJson) *OCCAMemory
WrapMemory wraps existing memory
type OCCADtype ¶ added in v0.9.1
type OCCADtype struct {
// contains filtered or unexported fields
}
func CreateDtype ¶ added in v0.9.1
CreateDtype creates a new data type
func CreateDtypeTuple ¶ added in v0.9.1
CreateDtypeTuple creates a tuple data type
func DtypeFromJson ¶ added in v0.9.1
DtypeFromJson creates a data type from JSON
func DtypeFromJsonString ¶ added in v0.9.1
DtypeFromJsonString creates a data type from JSON string
func (*OCCADtype) IsRegistered ¶ added in v0.9.1
IsRegistered checks if the data type is registered
func (*OCCADtype) RegisterType ¶ added in v0.9.1
func (d *OCCADtype) RegisterType()
RegisterType registers the data type
type OCCAJson ¶ added in v0.9.1
type OCCAJson struct {
// contains filtered or unexported fields
}
func DeviceProperties ¶ added in v0.9.1
func DeviceProperties() *OCCAJson
DeviceProperties returns properties of the current device
func (*OCCAJson) ArrayClear ¶ added in v0.9.1
func (j *OCCAJson) ArrayClear()
ArrayClear clears the JSON array
func (*OCCAJson) ArrayInsert ¶ added in v0.9.1
ArrayInsert inserts a value into JSON array
func (*OCCAJson) ArrayPop ¶ added in v0.9.1
func (j *OCCAJson) ArrayPop()
ArrayPop pops a value from JSON array
func (*OCCAJson) CastToArray ¶ added in v0.9.1
func (j *OCCAJson) CastToArray()
CastToArray casts JSON to array
func (*OCCAJson) CastToBoolean ¶ added in v0.9.1
func (j *OCCAJson) CastToBoolean()
CastToBoolean casts JSON to boolean
func (*OCCAJson) CastToNumber ¶ added in v0.9.1
func (j *OCCAJson) CastToNumber()
CastToNumber casts JSON to number
func (*OCCAJson) CastToObject ¶ added in v0.9.1
func (j *OCCAJson) CastToObject()
CastToObject casts JSON to object
func (*OCCAJson) CastToString ¶ added in v0.9.1
func (j *OCCAJson) CastToString()
CastToString casts JSON to string
func (*OCCAJson) GetBoolean ¶ added in v0.9.1
GetBoolean returns the boolean value
type OCCAKernel ¶
type OCCAKernel struct {
// contains filtered or unexported fields
}
func BuildKernel ¶ added in v0.9.1
func BuildKernel(filename, kernelName string, props *OCCAJson) (*OCCAKernel, error)
BuildKernel builds a kernel from source file
func BuildKernelFromBinary ¶ added in v0.9.1
func BuildKernelFromBinary(filename, kernelName string, props *OCCAJson) (*OCCAKernel, error)
BuildKernelFromBinary builds a kernel from binary file
func BuildKernelFromString ¶ added in v0.9.1
func BuildKernelFromString(source, kernelName string, props *OCCAJson) (*OCCAKernel, error)
BuildKernelFromString builds a kernel from source string
func (*OCCAKernel) BinaryFilename ¶ added in v0.9.1
func (k *OCCAKernel) BinaryFilename() string
BinaryFilename returns the binary filename
func (*OCCAKernel) ClearArgs ¶ added in v0.9.1
func (k *OCCAKernel) ClearArgs()
ClearArgs clears all kernel arguments
func (*OCCAKernel) FullHash ¶ added in v0.9.1
func (k *OCCAKernel) FullHash() string
FullHash returns the full kernel hash
func (*OCCAKernel) GetDevice ¶ added in v0.9.1
func (k *OCCAKernel) GetDevice() *OCCADevice
GetDevice returns the device associated with the kernel
func (*OCCAKernel) GetProperties ¶ added in v0.9.1
func (k *OCCAKernel) GetProperties() *OCCAJson
GetProperties returns kernel properties
func (*OCCAKernel) Hash ¶ added in v0.9.1
func (k *OCCAKernel) Hash() string
Hash returns the kernel hash
func (*OCCAKernel) IsInitialized ¶ added in v0.9.1
func (k *OCCAKernel) IsInitialized() bool
IsInitialized checks if the kernel is initialized
func (*OCCAKernel) MaxDims ¶ added in v0.9.1
func (k *OCCAKernel) MaxDims() int
MaxDims returns the maximum dimensions
func (*OCCAKernel) MaxInnerDims ¶ added in v0.9.1
func (k *OCCAKernel) MaxInnerDims() OCCADim
MaxInnerDims returns the maximum inner dimensions
func (*OCCAKernel) MaxOuterDims ¶ added in v0.9.1
func (k *OCCAKernel) MaxOuterDims() OCCADim
MaxOuterDims returns the maximum outer dimensions
func (*OCCAKernel) Name ¶ added in v0.9.1
func (k *OCCAKernel) Name() string
Name returns the kernel name
func (*OCCAKernel) PushArg ¶ added in v0.9.1
func (k *OCCAKernel) PushArg(arg interface{}) error
PushArg pushes an argument to the kernel
func (*OCCAKernel) Run ¶
func (k *OCCAKernel) Run(args ...interface{})
For backward compatibility or if you prefer panic over error return
func (*OCCAKernel) RunFromArgs ¶ added in v0.9.1
func (k *OCCAKernel) RunFromArgs()
RunFromArgs runs the kernel with previously pushed arguments
func (*OCCAKernel) RunWithArgs ¶
func (k *OCCAKernel) RunWithArgs(args ...interface{}) error
RunWithArgs runs the kernel with arbitrary arguments using occaKernelRunWithArgs
func (*OCCAKernel) SetRunDims ¶ added in v0.9.1
func (k *OCCAKernel) SetRunDims(outerDims, innerDims OCCADim)
SetRunDims sets the run dimensions
func (*OCCAKernel) SourceFilename ¶ added in v0.9.1
func (k *OCCAKernel) SourceFilename() string
SourceFilename returns the source filename
type OCCAMemory ¶
type OCCAMemory struct {
// contains filtered or unexported fields
}
func Malloc ¶ added in v0.9.1
func Malloc(bytes int64, src unsafe.Pointer, props *OCCAJson) *OCCAMemory
Malloc allocates memory on the current device
func TypedMalloc ¶ added in v0.9.1
TypedMalloc allocates typed memory on the current device
func TypedWrapMemory ¶ added in v0.9.1
func TypedWrapMemory(ptr unsafe.Pointer, entries int64, dtype *OCCADtype, props *OCCAJson) *OCCAMemory
TypedWrapMemory wraps existing typed memory
func WrapMemory ¶ added in v0.9.1
func WrapMemory(ptr unsafe.Pointer, bytes int64, props *OCCAJson) *OCCAMemory
WrapMemory wraps existing memory
func (*OCCAMemory) Clone ¶ added in v0.9.1
func (m *OCCAMemory) Clone() *OCCAMemory
Clone creates a copy of the memory
func (*OCCAMemory) CopyDeviceToDevice ¶
func (dst *OCCAMemory) CopyDeviceToDevice(dstOffset int64, src *OCCAMemory, srcOffset int64, bytes int64)
CopyDeviceToDevice performs an efficient device-to-device memory copy
func (*OCCAMemory) CopyDeviceToDeviceWithProps ¶ added in v0.9.1
func (dst *OCCAMemory) CopyDeviceToDeviceWithProps(dstOffset int64, src *OCCAMemory, srcOffset int64, bytes int64, props *OCCAJson)
CopyDeviceToDeviceWithProps performs device-to-device copy with properties
func (*OCCAMemory) CopyFrom ¶
func (m *OCCAMemory) CopyFrom(src unsafe.Pointer, bytes int64)
CopyFrom copies data from host memory to device memory
func (*OCCAMemory) CopyFromFloat32 ¶ added in v0.9.1
func (m *OCCAMemory) CopyFromFloat32(data []float32)
CopyFromFloat32 copies float32 slice to device memory
func (*OCCAMemory) CopyFromFloat64 ¶ added in v0.9.1
func (m *OCCAMemory) CopyFromFloat64(data []float64)
CopyFromFloat64 copies float64 slice to device memory
func (*OCCAMemory) CopyFromInt32 ¶ added in v0.9.1
func (m *OCCAMemory) CopyFromInt32(data []int32)
CopyFromInt32 copies int32 slice to device memory
func (*OCCAMemory) CopyFromInt64 ¶ added in v0.9.1
func (m *OCCAMemory) CopyFromInt64(data []int64)
CopyFromInt64 copies int64 slice to device memory
func (*OCCAMemory) CopyFromWithOffset ¶ added in v0.9.1
func (m *OCCAMemory) CopyFromWithOffset(src unsafe.Pointer, bytes int64, offset int64)
CopyFromWithOffset copies data from host memory to device memory with offset
func (*OCCAMemory) CopyFromWithProps ¶ added in v0.9.1
func (m *OCCAMemory) CopyFromWithProps(src unsafe.Pointer, bytes int64, offset int64, props *OCCAJson)
CopyFromWithProps copies data from host memory to device memory with properties
func (*OCCAMemory) CopyTo ¶
func (m *OCCAMemory) CopyTo(dst unsafe.Pointer, bytes int64)
CopyTo copies data from device memory to host memory
func (*OCCAMemory) CopyToFloat32 ¶
func (m *OCCAMemory) CopyToFloat32(data []float32)
CopyToFloat32 copies memory to float32 slice
func (*OCCAMemory) CopyToFloat64 ¶ added in v0.9.1
func (m *OCCAMemory) CopyToFloat64(data []float64)
CopyToFloat64 copies memory to float64 slice
func (*OCCAMemory) CopyToInt32 ¶ added in v0.9.1
func (m *OCCAMemory) CopyToInt32(data []int32)
CopyToInt32 copies memory to int32 slice
func (*OCCAMemory) CopyToInt64 ¶ added in v0.9.1
func (m *OCCAMemory) CopyToInt64(data []int64)
CopyToInt64 copies memory to int64 slice
func (*OCCAMemory) CopyToWithOffset ¶ added in v0.9.1
func (m *OCCAMemory) CopyToWithOffset(dst unsafe.Pointer, bytes int64, offset int64)
CopyToWithOffset copies data from device memory to host memory with offset
func (*OCCAMemory) CopyToWithProps ¶ added in v0.9.1
func (m *OCCAMemory) CopyToWithProps(dst unsafe.Pointer, bytes int64, offset int64, props *OCCAJson)
CopyToWithProps copies data from device memory to host memory with properties
func (*OCCAMemory) Detach ¶ added in v0.9.1
func (m *OCCAMemory) Detach()
Detach detaches the memory
func (*OCCAMemory) GetDevice ¶ added in v0.9.1
func (m *OCCAMemory) GetDevice() *OCCADevice
GetDevice returns the device associated with the memory
func (*OCCAMemory) GetProperties ¶ added in v0.9.1
func (m *OCCAMemory) GetProperties() *OCCAJson
GetProperties returns memory properties
func (*OCCAMemory) IsInitialized ¶ added in v0.9.1
func (m *OCCAMemory) IsInitialized() bool
IsInitialized checks if the memory is initialized
func (*OCCAMemory) Ptr ¶ added in v0.9.1
func (m *OCCAMemory) Ptr() unsafe.Pointer
Ptr returns the underlying memory pointer
func (*OCCAMemory) Size ¶ added in v0.9.1
func (m *OCCAMemory) Size() uint64
Size returns the size of the memory in bytes
func (*OCCAMemory) Slice ¶ added in v0.9.1
func (m *OCCAMemory) Slice(offset, bytes int64) *OCCAMemory
Slice creates a slice of the memory
type OCCAMemoryPool ¶ added in v0.9.1
type OCCAMemoryPool struct {
// contains filtered or unexported fields
}
func CreateMemoryPool ¶ added in v0.9.1
func CreateMemoryPool(props *OCCAJson) *OCCAMemoryPool
CreateMemoryPool creates a new memory pool
func (*OCCAMemoryPool) Alignment ¶ added in v0.9.1
func (p *OCCAMemoryPool) Alignment() uint64
Alignment returns the memory alignment
func (*OCCAMemoryPool) Free ¶ added in v0.9.1
func (p *OCCAMemoryPool) Free()
Free frees the memory pool
func (*OCCAMemoryPool) GetDevice ¶ added in v0.9.1
func (p *OCCAMemoryPool) GetDevice() *OCCADevice
GetDevice returns the device associated with the memory pool
func (*OCCAMemoryPool) GetProperties ¶ added in v0.9.1
func (p *OCCAMemoryPool) GetProperties() *OCCAJson
GetProperties returns memory pool properties
func (*OCCAMemoryPool) IsInitialized ¶ added in v0.9.1
func (p *OCCAMemoryPool) IsInitialized() bool
IsInitialized checks if the memory pool is initialized
func (*OCCAMemoryPool) NumReservations ¶ added in v0.9.1
func (p *OCCAMemoryPool) NumReservations() uint64
NumReservations returns the number of reservations
func (*OCCAMemoryPool) Reserve ¶ added in v0.9.1
func (p *OCCAMemoryPool) Reserve(bytes uint64) *OCCAMemory
Reserve reserves memory from the pool
func (*OCCAMemoryPool) Reserved ¶ added in v0.9.1
func (p *OCCAMemoryPool) Reserved() uint64
Reserved returns the amount of reserved memory
func (*OCCAMemoryPool) Resize ¶ added in v0.9.1
func (p *OCCAMemoryPool) Resize(bytes uint64)
Resize resizes the memory pool
func (*OCCAMemoryPool) SetAlignment ¶ added in v0.9.1
func (p *OCCAMemoryPool) SetAlignment(alignment uint64)
SetAlignment sets the memory alignment
func (*OCCAMemoryPool) ShrinkToFit ¶ added in v0.9.1
func (p *OCCAMemoryPool) ShrinkToFit()
ShrinkToFit shrinks the memory pool to fit current reservations
func (*OCCAMemoryPool) Size ¶ added in v0.9.1
func (p *OCCAMemoryPool) Size() uint64
Size returns the total size of the memory pool
func (*OCCAMemoryPool) TypedReserve ¶ added in v0.9.1
func (p *OCCAMemoryPool) TypedReserve(entries uint64, dtype *OCCADtype) *OCCAMemory
TypedReserve reserves typed memory from the pool
type OCCAStream ¶ added in v0.9.1
type OCCAStream struct {
// contains filtered or unexported fields
}
func CreateStream ¶ added in v0.9.1
func CreateStream(props *OCCAJson) *OCCAStream
CreateStream creates a new stream with optional properties
type OCCAStreamTag ¶ added in v0.9.1
type OCCAStreamTag struct {
// contains filtered or unexported fields
}
func TagStream ¶ added in v0.9.1
func TagStream() *OCCAStreamTag
TagStream tags the current position in the stream
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
halo
mesh_halo2.go - Production code
|
mesh_halo2.go - Production code |
|
hello_world
command
|