Skip to content

opencl-pure/pureCL

 
 

Repository files navigation

pure

This is fork and simplify of Zyko0's opencl, big thank.
This package provide low level wrapper to OpenCL, that means it is 1:1 wrapper C:GO - no GO error handling only GO types map OpenCL function and cl_types without cgo, powered by purego and inspired by libopencl-stub. This package use constantsCL
Thank to both of them!

goal

  • low level wrap of OpenCL for
  • be minimalistic
  • try to have all functions of OpenCL (so if you have some, give PR)
  • easy to multiplatform (thank purego)
  • easy find path (custumize path to openclLib shared library)
  • easy to compile, we do not need cgo and not need knowing link to shared library
  • try purego and bring opencl on android without complicate link

not goal

  • be faster as cgo version, purego is using same mechanism as cgo

examples

you can also use to your package independent from others ..., you can also use as this:

example

package main

import (
	"errors"
	constants "github.com/opencl-pure/constantsCL"
	pure "github.com/opencl-pure/pureCL"
	"log"
)

func main() {
  //init with version of OpenCL and variadic special paths (if you know)
	err := pure.Init(pure.Version2_0/*, "special_path1/openclLib.dll", "special_path1/openclLib.so" */) 
	if err != nil {
		log.Println(err)
		return
	}
	numPlatforms := uint32(0)
	st := pure.GetPlatformIDs(0, nil, &numPlatforms)
	if st != constants.CL_SUCCESS {
		log.Println(errors.New("oops platform error"))
		return
	}

	platformIDs := make([]pure.Platform, numPlatforms)
	st = pure.GetPlatformIDs(numPlatforms, platformIDs, nil)
	if st != constants.CL_SUCCESS {
		log.Println(errors.New("oops none ...."))
		return
	}
	// ....
}    

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%