Go OpenCL (GOCL) Binding

Related tags

Images tools gocl
Overview

gocl

Go OpenCL (GOCL) Binding (http://www.gocl.org)

Library documentation:

http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/

http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/

http://www.khronos.org/registry/cl/sdk/2.0/docs/man/xhtml/

In order to build this, make sure you have the required drivers and SDK installed for your graphics card. You will need at least opencl.lib from Intel/AMD/NVIDIA:

http://software.intel.com/en-us/intel-opencl

http://developer.amd.com/tools-and-sdks/opencl-zone/

https://developer.nvidia.com/opencl

The locations of the library and include file can be supplied by way of environment variables, for example:

export CGO_LDFLAGS=-L$OPENCLSDKROOT/lib/x86 (or null for NVIDIA and Mac OSX)

export CGO_CFLAGS=-I$GOPATH/src/gocl/android/include (gocl/android/include/CL have the latest OpenCL 2.0 include files from https://www.khronos.org/registry/cl/)

===============================================

To build OpenCL 1.1/1.2/2.0 compliance C-style binding (replacing "clxx" with "cl11"/"cl12"/"cl20"):

go build -tags="clxx" gocl/cl

go test -v -tags="clxx" gocl/cl_test

go install -tags="cl11" gocl/cl_demo/opencl11/ch(x) (Examples in "OpenCL in Action")

go install -tags="cl12" gocl/cl_demo/opencl12/chapter(x) (Examples in "Heterogeneous Computing with OpenCL, 2nd Edition")

go install -tags="cl20" gocl/cl_demo/opencl20/x (Examples in "AMDAPPSDK and INTELOCLSDK")

===============================================

To build OpenCL 1.1/1.2/2.0 compliance OO-style binding (replacing "clxx" with "cl11"/"cl12"/"cl20"):

go build -tags="clxx" gocl/ocl

go test -v -tags="clxx" gocl/ocl_test

Issues
  • build error

    build error

    Hi, I have this errors trying to compile golc

    $go build -tags="cl12" gocl/ocl
    
    gocl/cl/kernel1x.go: In function ‘_cgo_3df5c9c5fde2_Cfunc_clEnqueueTask’:
    gocl/cl/kernel1x.go:53:2: warning: ‘clEnqueueTask’ is deprecated (declared at /usr/include/CL/cl.h:1367) [-Wdeprecated-declarations]
      if event != nil {
      ^
    

    I'm using intel_sdk_for_ocl_applications_2014_4.6.0.92_x64 and my environment is

    export intelappsdkroot=/opt/intel/opencl-1.2-sdk-4.6.0.92 export CGO_LDFLAGS=-L$intelappsdkroot/lib64 export CGO_CFLAGS=-l$intelappsdkroot/include

    maybe you can help me Thank you

    opened by eddytrex 5
  • heavy memory leak when run in a loop

    heavy memory leak when run in a loop

    We noticed that our gominer project that uses your library leaks memory in proportion to how fast the main loop is running on the device.

    I was able to reproduce the issue by forcing one of the demos to run in a loop:

    https://github.com/rainliu/gocl/compare/master...jolan:jolan_memleak

    It leaks about 1MB/s on my machine. Looking through the source code there's only a few files that are freeing any memory. Unfortunately, I'm not very well versed in C/cgo memory management but will start digging to see if I can help fix this.

    opened by jolan 3
  • build error

    build error

    I encountered the following error:

    $ go build -tags="cl20" github.com/rainliu/gocl/cl

    github.com/rainliu/gocl/cl

    go/src/github.com/rainliu/gocl/cl/image12.go:47: c_image_desc.buffer undefined (type C.struct__cl_image_desc has no field or method buffer) go/src/github.com/rainliu/gocl/cl/queue20.go:39: cannot use c_properties_ptr (type *C.cl_command_queue_properties) as type *C.cl_queue_properties in argument to _Cfunc_clCreateCommandQueueWithProperties

    I'm using AMD-APP-SDK-v3.0.124.132-GA-linux64.sh and fglrx-14.502.1040 on a FirePro W7100. My environment looks like this: $ cat /etc/profile.d/AMDAPPSDK.sh export AMDAPPSDKROOT=/opt/AMDAPPSDK-3.0 export AMDAPPSDKROOT=/opt/AMDAPPSDK-3.0 export LD_LIBRARY_PATH="/opt/AMDAPPSDK-3.0/lib/x86_64/" export CGO_CFLAGS=-I$AMDAPPSDKROOT/include export CGO_LDFLAGS=-L$AMDAPPSDKROOT/lib/x86_64

    Any help would be greatly appreciated!

    opened by awillis 2
  • Constants not available in OpenCL 1.1

    Constants not available in OpenCL 1.1

    Hi, im trying to get gocl working in windows with Nvidia. cl.go seems to be defining a lot of constants that are only defined in OpenCL 1.2 and thus breaking compilation as they are not defined in cl.h

    Just a few: 37: error: 'CL_KERNEL_ARG_TYPE_QUALIFIER' undeclared (first use in this function) 37: error: 'CL_DEVICE_PARTITION_TYPE' undeclared (first use in this function) 38: error: 'CL_BLOCKING' undeclared (first use in this function) 38: error: 'CL_KERNEL_ARG_NAME' undeclared (first use in this function) 38: error: 'CL_UNORM_INT24' undeclared (first use in this function) 38: error: 'CL_IMAGE_ARRAY_SIZE' undeclared (first use in this function) 38: error: 'CL_DEVICE_PARTITION_BY_COUNTS_LIST_END' undeclared (first use in this function) 38: error: 'CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE' undeclared (first use in this function) 38: error: 'CL_DEVICE_BUILT_IN_KERNELS' undeclared (first use in this function) 38: error: 'CL_DEVICE_IMAGE_PITCH_ALIGNMENT' undeclared (first use in this function) 38: error: 'CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT' undeclared (first use in this function) 38: error: 'CL_COMMAND_FILL_IMAGE' undeclared (first use in this function) 38: error: 'CL_KERNEL_ARG_INFO_NOT_AVAILABLE' undeclared (first use in this function) 38: error: 'CL_KERNEL_ARG_ACCESS_QUALIFIER' undeclared (first use in this function) 38: error: 'CL_KERNEL_ARG_ACCESS_WRITE_ONLY' undeclared (first use in this function) 38: error: 'CL_KERNEL_ARG_ADDRESS_CONSTANT' undeclared (first use in this function) 38: error: 'CL_INVALID_COMPILER_OPTIONS' undeclared (first use in this function) 38: error: 'CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE' undeclared (first use in this function) 38: error: 'CL_DEPTH_STENCIL' undeclared (first use in this function) 38: error: 'CL_NON_BLOCKING' undeclared (first use in this function) 38: error: 'CL_DEVICE_TYPE_CUSTOM' undeclared (first use in this function) 38: error: 'CL_PROGRAM_BINARY_TYPE_LIBRARY' undeclared (first use in this function) 39: error: 'CL_IMAGE_BUFFER' undeclared (first use in this function) 39: error: 'CL_IMAGE_NUM_MIP_LEVELS' undeclared (first use in this function) 39: error: 'CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN' undeclared (first use in this function)

    Error on my part or missing tags in gocl?

    opened by p4fg 2
  • question

    question

    Hi I am student who is interasting to openCL, can I try in summer create golang projekt on this projekt? with https://github.com/krrishnarraj/libopencl-stub

    opened by MatejMagat305 1
  • Android Arm64 support

    Android Arm64 support

    Seems that the LibOpenCL (https://github.com/rainliu/gocl/blob/master/android/lib/libOpenCL.so) doesn't support Arm64. There's any compatible libOpenCL.so? How did you get the libOpenCL.so and libllvm-arm.so (it's using the adb pull)?

    opened by inkeliz 0
  • Build error with -tags=

    Build error with -tags="cl12" or -tags="cl20" on NVidia

    It's OK when I do go build -tags="cl11" gocl/cl

    But with -tags="cl12", I encountered the following error:

    gocl/cl/image12.go:47: c_image_desc.buffer undefined (type C.struct__cl_image_desc has no field or method buffer)

    and with tags="cl20" this

    gocl/cl/image12.go:47: c_image_desc.buffer undefined (type C.struct__cl_image_desc has no field or method buffer) gocl/cl/queue20.go:39: cannot use c_properties_ptr (type *C.cl_command_queue_properties) as type *C.cl_queue_properties in argument to func literal

    I'm using Nvidia GT 1030 GPU card on Ubuntu 16.04 With tags="cl11", goclinfo give me this informations

    Number of platforms: 	1
    	CL_PLATFORM_PROFILE     : FULL_PROFILE
    	CL_PLATFORM_VERSION     : OpenCL 1.2 CUDA 9.0.194
    	CL_PLATFORM_VENDOR      : NVIDIA Corporation
    	CL_PLATFORM_EXTENSIONS  : cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_nv_create_buffer
    
    	Number of devices: 	1
    		CL_DEVICE_TYPE      : CL_DEVICE_TYPE_GPU
    		CL_DEVICE_NAME      : GeForce GT 1030
    		CL_DEVICE_VENDOR    : NVIDIA Corporation
    		CL_DEVICE_PROFILE   : FULL_PROFILE
    

    I set export CGO_CFLAGS=-I$GOPATH/src/gocl/android/include My Go environment looks like this:

    [email protected]:~/go/src$ go env
    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/home/dev/go"
    GORACE=""
    GOROOT="/usr/local/go"
    GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
    GCCGO="gccgo"
    CC="gcc"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build006095219=/tmp/go-build -gno-record-gcc-switches"
    CXX="g++"
    CGO_ENABLED="1"
    CGO_CFLAGS="-I/src/gocl/android/include"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    PKG_CONFIG="pkg-config"
    
    opened by LeMoussel 0
Owner
Rain Liu
Rustacean/Gopher, VoIP/RTC, Audio/Video Systems
Rain Liu
OpenGL binding generator for Go

GoGL GoGL is an OpenGL binding generator for Go. No external dependencies like GLEW are needed. Install the OpenGL bindings For example, OpenGL 2.1 bi

Christoph Schunk 139 Apr 26, 2022
Go binding to ImageMagick's MagickWand C API

Go Imagick Go Imagick is a Go bind to ImageMagick's MagickWand C API. We support two compatibility branches: master (tag v2.x.x): 6.9.1-7 <= ImageMagi

Go Graphics community 1.5k Jun 29, 2022
A Go skia binding based on skia C library through cgo

go-skia is a Go skia binding based on skia C library through cgo. Note: the project is still in early stage, and it only supports Linux-amd64 now. The

Go101 19 Mar 9, 2022
Shows how to use OpenCL with Go bindings.

Golang OpenCL example This is a tiny "hello world"-like application that shows how to use the github.com/jgillich/go-opencl OpenCL bindings for Go. Se

ErikL 3 Apr 1, 2022
A utility library to make use of the X Go Binding easier. (Implements EWMH and ICCCM specs, key binding support, etc.)

xgbutil is a utility library designed to work with the X Go Binding. This project's main goal is to make various X related tasks easier. For example,

Andrew Gallant 179 May 26, 2022
A utility library to make use of the X Go Binding easier. (Implements EWMH and ICCCM specs, key binding support, etc.)

xgbutil is a utility library designed to work with the X Go Binding. This project's main goal is to make various X related tasks easier. For example,

Andrew Gallant 179 May 26, 2022
mass-binding-target is a command line tool for generating binding target list by search plot files from disk.

mass-binding-target mass-binding-target is a command line tool for generating binding target list by search plot files from disk. Build Go 1.13 or new

null 0 Nov 5, 2021
A Go language binding for encodeing and decoding data in the bencode format that is used by the BitTorrent peer-to-peer file sharing protocol.

bencode-go A Go language binding for encoding and decoding data in the bencode format that is used by the BitTorrent peer-to-peer file sharing protoco

Jack Palevich 184 Jun 26, 2022
SDL2 binding for Go

SDL2 binding for Go go-sdl2 is SDL2 wrapped for Go users. It enables interoperability between Go and the SDL2 library which is written in C. That mean

Ve & Co. 1.8k Jul 3, 2022
Reflectionless data binding for Go's net/http (not actively maintained)

binding Reflectionless data binding for Go's net/http Features HTTP request data binding Data validation (custom and built-in) Error handling Benefits

Matt Holt 791 Jun 15, 2022
Go binding for the cairo graphics library

go-cairo Go binding for the cairo graphics library Based on Dethe Elza's version https://bitbucket.org/dethe/gocairo but significantly extended and up

Erik Unger 118 Apr 18, 2022
OpenGL binding generator for Go

GoGL GoGL is an OpenGL binding generator for Go. No external dependencies like GLEW are needed. Install the OpenGL bindings For example, OpenGL 2.1 bi

Christoph Schunk 139 Apr 26, 2022
Go binding for GTK

go-gtk WHATS Go bindings for GTK SCREENSHOT INSTALL You can experiment with go-gtk by running the various example programs: git clone https://github.c

mattn 1.9k Jun 28, 2022
The X Go Binding is a low-level API to communicate with the X server. It is modeled on XCB and supports many X extensions.

Note that this project is largely unmaintained as I don't have the time to do or support more development. Please consider using this fork instead: ht

Andrew Gallant 444 Jun 18, 2022
Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly

Introduction Qt is a free and open-source widget toolkit for creating graphical user interfaces as well as cross-platform applications that run on var

null 9.3k Jun 27, 2022
Go binding to ImageMagick's MagickWand C API

Go Imagick Go Imagick is a Go bind to ImageMagick's MagickWand C API. We support two compatibility branches: master (tag v2.x.x): 6.9.1-7 <= ImageMagi

Go Graphics community 1.5k Jun 29, 2022
gin auto binding,grpc, and annotated route,gin 注解路由, grpc,自动参数绑定工具

中文文档 Automatic parameter binding base on go-gin doc Golang gin automatic parameter binding Support for RPC automatic mapping Support object registrati

xxj 226 Jun 30, 2022
Go binding for gammu

gogammu is binding for SMS related functions of libGammu (documentation). gogammu/smsd is simple, MySQL based, SMS daemon, written entirely in Go (it

Michał Derkacz 14 Dec 24, 2020
Iris Go binding

Iris Go binding This is the official Go language binding for the Iris cloud messaging framework. Version v1 of the binding is compatible with Iris v0.

Project Iris 134 Apr 22, 2022
Openldap (LDAP) binding for Golang (go) ; no more support ; you may have a look at https://github.com/go-ldap/ldap

OpenLDAP this is Openldap binding in GO language. I don't work any more with golang, so, please fork this project. Installation : Installation is easy

Marc Quinton 45 Mar 4, 2021
Cgo binding for icu4c library

About Cgo binding for icu4c C library detection and conversion functions. Guaranteed compatibility with version 50.1. Installation Installation consis

Dmitry Bondarenko 20 Jan 23, 2022
Cgo binding for Snowball C library

Description Snowball stemmer port (cgo wrapper) for Go. Provides word stem extraction functionality. For more detailed info see http://snowball.tartar

Dmitry Bondarenko 31 Feb 13, 2022
Go binding to libserialport for serial port functionality.

Go Serial Package serial provides a binding to libserialport for serial port functionality. Serial ports are commonly used with embedded systems, such

Jacob Michael Lee 51 Jun 15, 2022
Go binding for libuuid

Pure Go UUID implementation This package provides immutable UUID structs and the functions NewV3, NewV4, NewV5 and Parse() for generating versions 3,

Kris Kovalik 414 Jun 8, 2022
Go binding for libshout 2.x

go-libshout (Incomplete but working) Go binding for libshout 2.x Example package main import ( "flag" "github.com/systemfreund/go-libshout" "os"

null 12 Dec 8, 2021
v8 javascript engine binding for golang

Go-V8 V8 JavaScript engine bindings for Go. Features Thread safe Thorough and careful testing Boolean, Number, String, Object, Array, Regexp, Function

Hoping White 200 Jun 9, 2022
golang curl(libcurl) binding.

go-curl my golang libcurl(curl) binding. See more examples in ./examples/ directory~! LICENSE go-curl is licensed under the Apache License, Version 2.

Andelf 428 Jun 18, 2022
Go binding for TensorFlow Lite

go-tflite Go binding for TensorFlow Lite Usage model := tflite.NewModelFromFile("sin_model.tflite") if model == nil { log.Fatal("cannot load model")

mattn 238 Jun 6, 2022
Simple QML binding for Go

Qamel Qamel is a simple QML binding for Go, heavily inspired by therecipe/qt. This package only binds Qt's classes that used for creating a simple QML

null 163 May 27, 2022