Exemplo n.º 1
0
func init() {
	kernels = make(map[string]*cl.Kernel)
	flag.Parse()

	platforms := cl.GetPlatforms()
	platform = platforms[0]

	if ImageSupport() == false {
		log.Fatal("Your device doesn't support images through OpenCL")
	}
}
Exemplo n.º 2
0
// FIXME(utkan): let user choose other platform/device.
func NewEnv() (*Env, error) {
	e := new(Env)

	e.kernels = make(map[string]*cl.Kernel)

	platforms := cl.GetPlatforms()
	e.platform = platforms[0]

	if e.platform.Devices[0].Property(cl.DEVICE_IMAGE_SUPPORT).(bool) == false {
		return nil, errors.New("Your device doesn't support images through OpenCL")
	}

	err := e.initAndPrepCL()

	return e, err
}