Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Work Product Submission

Name: Omar Wagih
Organization: NumFOCUS
Sub-Organization: Colour Science
Mentors: Thomas Mansencal, Michael Mauderer

The Need for Speed

My project for this Google Summer of Code was to set up a benchmarking repository for the main colour-science repository and investigate various methods to improve Colour processing speed with images.

What Was Done

During this summer we created a new benchmarking repository with almost 100% coverage of Colour. I also modified various functions to improve their speed on the CPU path. After discussions and investigations, a GPU backend because of its highly parallel computational ability was deemed to be the path of least resistance to improve Colour's speed. Consequently, I started to implement support for a new ndimensional array backend that leverages CuPy although this work is not merged yet.

List of Commits

colour-benchmarks Repository

  • a385cf4 Changing configuration to virtualenv
  • a7b9614 Updating requirements
  • 7f3a7b7 Adding conda environment to the github actions file
  • 7bdf2bc Changing default config to virtualenv
  • e04cdb9 Rename various factories and base classes.
  • 6614340 Add "shebang" to "init" files.
  • 340fade Code formatting.
  • a617910 Rename "LongBenchmarks" directory to "long_benchmarks".
  • ab251b8 Add "invoke" tasks.
  • 07ecebc Update ".gitignore" file.
  • 43b56e4 Update interpolation.py
  • fca1b20 Renaming, notation
  • bc9c9e4 Appearance, volume, colorimetry, characterisation
  • 2cff773 Temprature, recovery and difference benchmarks
  • 1ef26c8 Misc benchmarks
  • ed8c80b Transfer functions
  • dae8aa9 CAM02 benchmarks
  • c65fcc6 Models benchmarks
  • 52d7aa8 Separating into folders
  • c8625b5 RGB module
  • 06e9fe6 Updating RGB Benchmarks
  • 212d424 Implement initial factory support.
  • 7598a0c Adding benchmarks for models
  • 942832f Setting up repository

colour "develop" Branch

  • dafcb8e Micro-optimizations for the "colour.models" sub-package.
  • ce40973 Temperature microoptimizations
  • df3e059 Optimizations for the temparature module. This gives a 10-50% boost in performance in functions used in optimizers.

colour "CuPy Based GPU Backend" Pull Request

  • 249e8c95 Redefined the as_float function for cupy, made the as_float code for several functions more compact
  • 21687f97 Rebasing to current develop branch
  • 7d1a75ca Fixes for the munsell code, still have one test to pass
  • b98c24ef Fixed the switches between cupy and numpy, turned jakob2019 to ndarray instead of numpy, redefined the as_float for numpy to avoid the zero division error, currently all tests work on numpy and some of them do not work on cupy as shared in the document
  • a6a4737c Tests for models, appearance and algebra
  • bb3d5389 Fixes for appearance, quality and phenomenal
  • 104bb583 Fixes for appearance, quality and phenomenal
  • 9ded3886 Fixes for models/rgb/derivation
  • 35fa8d31 Fixes for the temperature module
  • 784e17e5 Fixes for the temperature module
  • 43f64c87 Fixes for tests of all submodules, all submodules now work except these functions, continous/signal-Multisignal, rgb/derivation, temperature CCT_to_xy, XYZto_sd_Meng2015, notation/munsell and primitive_grid/cube
  • 5440c56e Fixes for the volume, luts, colorimetry, blindness and characterisation module
  • 9d2a1b9e Fixes for algebra, colorimetry, luts, notation, phenomena and quality sub modules
  • 77f86b39 Testing cupy support for models, adaptation, transfer_functions, rgb, coordinates, temperature, difference, biochemistry, colorimetry and algebra. Currently parts of the last two modules do not work.
  • 671f6767 Adding Cupy computational backend with supporting utility function to change backends

Articles

Throughout GSOC multiple articles were written to explain the work being done while detailing the pros and cons of the decisions made.

You can find them on Medium.

Future Work

The code for the CuPy backend is still not ready to integrate with the main colour-science repository as it needs some cleanup, there are also about 4 functions that are still unimplemented in CuPy so these need to be addressed as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment