Documentation ¶
Overview ¶
Package gocu contains common interfaces to allow the different cuda packages/libraries to intermix with each other and with go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
type Attributes interface { MaxThreadsPerMultiProcessor() (int32, error) MultiProcessorCount() (int32, error) MaxThreadsPerBlock() (int32, error) MaxGridDimXYZ() ([]int32, error) MaxBlockDimXYZ() ([]int32, error) }
Attributes are the attributes a device needs to return.
type Config ¶
type Config struct { Dimx int32 Dimy int32 Dimz int32 ThreadPerBlockx uint32 ThreadPerBlocky uint32 ThreadPerBlockz uint32 BlockCountx uint32 BlockCounty uint32 BlockCountz uint32 }
Config holds configuration values for launching a kernel
type ConfigHelper ¶
type ConfigHelper struct {
// contains filtered or unexported fields
}
ConfigHelper creates Config structs through methods.
func CreateConfigHelper ¶
func CreateConfigHelper(device Attributes) (*ConfigHelper, error)
CreateConfigHelper a launch config helper.
func (*ConfigHelper) CreateLaunchConfig ¶
func (l *ConfigHelper) CreateLaunchConfig(x, y, z int32) (launch Config)
CreateLaunchConfig creates a launch configurator. It is used when launching kernels
type CudaPtr ¶
type CudaPtr struct {
// contains filtered or unexported fields
}
CudaPtr can be used to allocate mem that is used by cuda. I didn't want to do this but it is unintuitive in the means of making it otherwise. The reason being is that cgo will yell at you if you try to use an unsafe pointer using a go type. Just make one by the built in x:=new(gocu.DevicePtr)
func WrapUnsafe ¶
WrapUnsafe wraps an unsafe.Pointer around a *CudaPtr
type Device ¶
type Device interface {
Set() error
}
Device is a cuda device that can be set on the host thread Major is the major compute capability Minor is the minor compute capability
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker works on functions on a device
func (*Worker) Work ¶
Work takes a call back function, sends it through a channel to a locked thread hosting a gpu.
This function will block until work is done. You don't have to wait though.
If not wanting to wait. I would recomend wrapping this around a go func(){}() so that you could pick up the error.
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
Wrapper allows go memory to interact with cuda using the Mem interface
func MakeGoMem ¶
MakeGoMem returns a GoMem considering the input type. Will only support slices and pointers to go types
func (*Wrapper) TotalBytes ¶
TotalBytes returns the total bytes this has