Code Monkey home page Code Monkey logo

gegl-opencl's Introduction

GEGL-OpenCL

First official OPP (OpenCL Porting Project) of OpenCL.org

GEGL (Generic Graphics Library) is a graph based image processing framework.

With GEGL you chain together image processing operations represented by nodes into a graph. GEGL provides such operations for loading and storing images, adjusting colors, filtering in different ways, transforming and compositing images.

GEGL also depends on BABL to translate pixel formats. BABL allows converting between different methods of storing pixels known as pixel formats that have with different bitdepths and other data representations, color models and component permutations. A vocabulary to formulate new pixel formats from existing primitives is provided as well as the framework to add new color models and data types.

For a brief explanation on how GEGL works, read this document

Index

  1. Installing
  2. Development
  3. Contributing
  4. How to Port an Operation
  5. How to Test Output
  6. How to Benchmark Performance

Installing

Read the document above for more information, or refer to the links below for the respective platforms

On Windows

On Linux Platforms

Ensure that BABL is installed first before GEGL.

Development

The code for GEGL-OpenCL can be found at GEGL-OpenCL Github.

There already exists OpenCL integration into GEGL and some operations have already been ported to run on OpenCL. However, there is still a lot of operations that need porting as listed in the Google Sheet below.

Task List for GEGL-OpenCL (Excel)

Task List for GEGL-OpenCL (Github)

Likewise, we have a slack channel for discussions pertaining to development and issues here, GEGL-OpenCL Slack

Contributing

It is recommended that you fork this repository and create your branches there. After every discussion, if your kernel has the fastest speed for the vendor, you can create a pull request to have your changes merged. Please include the test results (correctness and timing), and name the pull request according to the operation you're working on and the vendor you're optimizing for, eg. box-blur_kernel_nv

Please ensure that make clean is executed before requesting a pull request

How to Port an Operation
  • Find an operation you'd like to work on under /operations/, eg. box-blur which can be found under /operations/common/
  • In box-blur.c, add the following line in the gegl_op_class_init function:
static void
gegl_op_class_init (GeglOpClass *klass)
{
  GeglOperationClass       *operation_class;
  GeglOperationFilterClass *filter_class;

  operation_class = GEGL_OPERATION_CLASS (klass);
  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);

  filter_class->process    = process;
  operation_class->prepare = prepare;
  
  // insert this line below
  operation_class->opencl_support = TRUE;
  
  gegl_operation_class_set_keys (operation_class,
      "name",        "gegl:box-blur",
      "title",       _("Box Blur"),
      "categories",  "blur",
      "description", _("Blur resulting from averaging the colors of a square neighbourhood."),
      NULL);
}
  • Create a cl_process function (which contains the host-code implementation) with the following parameters in the same file
static gboolean
cl_process (GeglOperation       *operation,
            GeglBuffer          *input,
            GeglBuffer          *output,
            const GeglRectangle *result)
  • Add a function call in the main process function before the cpu implementation
if (gegl_operation_use_opencl (operation))
    if (cl_process (operation, input, output, result))
      return TRUE;
  • Both kernel and kernel header file (.cl and .cl.h) should be stored in the /opencl/ folder.
  • Include both files, and any other necessary gegl-cl header in the operation's source code (eg. box-blur.c)
#include "opencl/gegl-cl.h"
#include "buffer/gegl-buffer-cl-iterator.h"
#include "opencl/box-blur.cl.h"
How to Test Output
  • create an xml file (eg. box-blur.xml) containing the following code
<?xml version='1.0' encoding='UTF-8'?>
<gegl>
  <node operation='gegl:box-blur'>
    <params>
      <param name='radius'>25</param>
    </params>
  </node>
  <node operation='gegl:load'>
    <params>
      <param name='path'>../compositions/data/car-stack.png</param>
    </params>
  </node>
</gegl>
  • run the following shell command to generate an output
$ gegl box-blur.xml -o test.jpg GEGL_USE_OPENCL=yes
  • to check correctness of the image generated, run a command with OpenCL disabled first
$ gegl box-blur.xml -o test2.jpg GEGL_USE_OPENCL=no
  • and run the below to get a measure of correctness
$ gegl-imgcmp test2.jpg test.jpg
  • there is also a script in /tests/compositions that can be used to verify that the OpenCL operation works
$ cd tests/compositions
$ python run-compositions.py alien-map.xml
$ python run-compositions.py alien-map.xml --without-opencl
How to Benchmark Performance
  • create an xml file similar to the above in /tests/opencl
  • before running the shell script ensure that the perl module below is installed
$ cpan
cpan[1]> install "XML::Twig";
  • to run the benchmark script
$ cd tests/opencl
$ perl benchmark.pl box-blur.xml no 1
$ perl benchmark.pl box-blur.xml gpu 1
$ perl benchmark.pl box-blur.xml cpu 1
  • note that 'gpu'/'cpu' denotes that OpenCL is enabled, while 'no' denotes that OpenCL is disabled
  • the number at the end denotes the number of iterations to run, after which the average time for the operation is returned

gegl-opencl's People

Contributors

alexiade avatar danielsabo avatar debarshiray avatar dmtrs32 avatar dmustieles avatar drawoc avatar ell-gh avatar erraticmaker avatar filmsi avatar hfiguiere avatar hodefoting avatar jdshu avatar jonnor avatar lightningismyname avatar michaelmure avatar mitchfoo avatar muks avatar nphilipp avatar nrobidoux avatar piotrdrag avatar prokoudine avatar rubenv avatar sasurobert avatar schumaml avatar simon-budig avatar t-chaik avatar victoroliv2 avatar villesokk avatar yolandaalvarez avatar yosh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gegl-opencl's Issues

[Port to OpenCL] Cubism

Port the GEGL Operation Cubism to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Color Rotate

Port the GEGL Operation Color Rotate to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Tile

Port the GEGL Operation Tile to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Sepia

Port the GEGL Operation Sepia to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Lens Distortion

Port the GEGL Operation Lens Distortion to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Tile Glass

Port the GEGL Operation Tile Glass to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Displace

Port the GEGL Operation Displace to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Antialias

Port the GEGL Operation Antialias to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Noise Solid

Port the GEGL Operation Noise Solid to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Ripple

Port the GEGL Operation Ripple to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Softglow

Port the GEGL Operation Softglow to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Plasma

Port the GEGL Operation Plasma to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

benchmark.pl outputs always 0 seconds and gpu / cpu are useless

on ubuntu 15.10, compiling master branch (of 20161405):

  • tests/opencl/benchmark.pl outputs always 0 seconds in becnhmarks even if the test performs in several seconds
  • tests/opencl/benchmark.pl do the same with no, gpu or cpu parameter. I think it doesn't work

[Port to OpenCL] Deinterlace

Port the GEGL Operation Deinterlace to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Noise HSV

Port the GEGL Operation Noise HSV to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Image Compare

Port the GEGL Operation Image Compare to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Engrave

Port the GEGL Operation Engrave to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Invert Gamma

Port the GEGL Operation Invert Gamma to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Sinus

Port the GEGL Operation Sinus to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Lens Flare

Port the GEGL Operation Lens Flare to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Illusion

Port the GEGL Operation Illusion to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Fattal02

Port the GEGL Operation Fattal02 to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Maze

Port the GEGL Operation Maze to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Stress

Port the GEGL Operation Stress to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Noise CIE LCH

Port the GEGL Operation Noise CIE LCH to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Tile Paper

Port the GEGL Operation Tile Paper to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Mantiuk06

Port the GEGL Operation Mantiuk06 to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Photocopy

Port the GEGL Operation Photocopy to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Noise Slur

Port the GEGL Operation Noise Slur to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Noise Pick

Port the GEGL Operation Noise Pick to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Color Enhance

Port the GEGL Operation Color Enhance to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Shift

Port the GEGL Operation Shift to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Channel Mixer

Port the GEGL Operation Channel Mixer to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Noise Spread

Port the GEGL Operation Noise Spread to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Mosaic

Port the GEGL Operation Mosaic to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Sparkle

Port the GEGL Operation Sparkle to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Edge

Port the GEGL Operation Edge to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Cartoon

Port the GEGL Operation Cartoon to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Apply Lens

Port the GEGL Operation Apply Lens to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Reinhard05

Port the GEGL Operation Reinhard05 to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Supernova

Port the GEGL Operation Supernova to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Bump map

Port the GEGL Operation Bump map to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Motion Blur Zoom

Port the GEGL Operation Motion Blur Zoom to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Emboss

Port the GEGL Operation Emboss to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

[Port to OpenCL] Noise RGB

Port the GEGL Operation Noise RGB to OpenCL, with optimizations targeting the following:-

  • Nvidia GPU
  • AMD GPU
  • Intel GPU
  • CPU

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.