Git Product home page Git Product logo

go-opencl's Introduction

OpenCL bindings for Go

Documentation at http://godoc.org/github.com/jgillich/go-opencl/cl.

See the test for usage examples.

By default, the OpenCL 1.2 API is exported. To get OpenCL 1.0, set the build tag cl10.

Forked Additions

  • Compatible with held ptrs to OpenCL pointers and contexts including clKernel, clQueue, clContext, clProgram, clDevice
  • Adds in the OpenCL GL Memory bindings for binding to allocated OpenGL buffers and sharing memory contexts with OpenGL

Usage

OpenCL bindings and wrapper functions map nearly one to one with the OpenCL core library calls in version 1.2. If your machine or OpenCl is not compatible with 1.2 please use the build tag cl10. This forked library mostly tests holding OpenCL state outside of scopes where the pointers are initially returned.

In order to retain your OpenCL states into higher scopes you must return each wrapper object individually. The file cl_pointer_test.go creates its own wrapper functions for creating the underlying objects in the test file and serves as an example wrapper API for the go-opencl module.

init, _ := NewInit(data)
mContext := &Context{}
mQueue := &CommandQueue{}
mProgram := &Program{}
mKernel := &Kernel{}
mDevice := &Device{}
mDevices := make([]*Device, 10)
mInput := &MemObject{}
mOutput := &MemObject{}
mContext, mDevice, mDevices = init.CreateContext()
init.context = mContext
init.device = mDevice
init.devices = mDevices
mQueue = init.CreateQueue()
init.queue = mQueue
mProgram = init.CreateProgram()
init.program = mProgram
mKernel = init.CreateKernel()
init.kernel = mKernel
mInput, mOutput = init.CreateBuffers()
init.input = mInput
init.output = mOutput
init.Run()

Note that in order to reduce dependencies the OpenGL binding calls are not tested in this library. For MacOSX however the clCreateFromGLTexture2D and clCreateFromGLTexture3D calls have been deprecated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.