• Stars
    star
    849
  • Rank 53,688 (Top 2 %)
  • Language
    C++
  • License
    Mozilla Public Li...
  • Created almost 10 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OpenCL library to train deep convolutional neural networks

DeepCL

DeepCL

OpenCL library to train deep convolutional networks

  • C++
  • OpenCL
  • Deep convolutional
  • Python wrappers
  • Lua wrappers
  • Q-learning

APIs:

Layer types:

  • convolutional
  • max-pooling
  • normalization
  • activation
  • dropout
  • random translations
  • random patches
  • loss

Loss layer types:

  • softmax
  • cross-entropy (synonymous with multinomial logistic, etc)
  • square loss

Trainers:

  • SGD
  • Anneal
  • Nesterov
  • Adagrad
  • Rmsprop
  • Adadelta

Activations:

  • tanh
  • scaled tanh (1.7519 * tanh(2/3x) )
  • linear
  • sigmoid
  • relu
  • elu (new!)

Loader formats:

  • jpegs
  • mnist
  • kgsv2
  • norb

Weight initializers:

  • original
  • uniform
  • more possible...

Multicolumn net also possible, as in McDnn

Example usages

  • obtained 37.2% test accuracy, on next move prediction task, using 33.6 million training examples from kgsgo v2 dataset
    • commandline used ./deepcl_train dataset=kgsgoall netdef=12*(32c5z-relu)-500n-tanh-361n numepochs=15 learningrate=0.0001
    • 2 epochs, 2 days per epoch, on an Amazon GPU instance, comprising half an NVidia GRID K520 GPU (about half as powerful as a GTX780)
  • obtained 99.5% test accuracy on MNIST, using netdef=rt2-8c5z-relu-mp2-16c5z-relu-mp3-150n-tanh-10n numepochs=20 multinet=6 learningrate=0.002
    • epoch time 99.8 seconds, using an Amazon GPU instance, ie half an NVidia GRID K520 GPU (since we are learning 6 nets in parallel, so 16.6seconds per epoch per net)

Installation

Native library installation

This section installs the native libraries, and the command-line tools. You always need to do this part, even if you will use the Python wrappers.

Windows

Pre-requisites:

  • OpenCL-enabled GPU or APU, along with appropriate OpenCL driver installed
  • Tested using Windows 2012 RC2, and (New!) Visual Studio 2015, this is how the CI builds run

Procedure:

  • Download latest binary zip file from http://deepcl.hughperkins.com/Downloads/ (eg from v8.0.0rc8)
  • unzip it, which creates the dist folder
  • To test it:
    • open a cmd
    • run call dist\bin\activate.bat (adjusting the path appropriately for wherever you downloaded deepcl binaries to)
    • now, eg try deepcl_unittests
    • (New!), you can choose which gpu to run tests on now, eg: deepcl_unittests gpuindex=1

Note that you need to "activate" the installation each time you open a new cmd prompt (or you could add appropriate environment variables permanently, using Control Panel | System | Advanced System Settings | Environment Variables)

Linux

Pre-requisites:

  • OpenCL-enabled GPU or APU, along with appropriate OpenCL driver installed (can check by running clinfo, which should show your desired GPU device)
  • Tested using Ubuntu 14.04 32-bit/64-bit

Procedure:

  • Download latest tar file from http://deepcl.hughperkins.com/Downloads/ (eg from v8.0.0rc8)
  • untar it, which creates the dist sub-folder
  • in a bash prompt, run source dist/bin/activate.sh (adjust the path appropriate for wherever you untarred the binaries tar file to)
  • test by doing, from the same bash prompt, eg deepcl_unittests
    • (New!), you can choose which gpu to run tests on now, eg: deepcl_unittests gpuindex=1

Note that you need to "activate" the installation each time you open a new bash prompt (or you can call activate.sh from your .bashrc file)

Python wrappers

  • make sure you already installed the native library, and "activate"d it, by doing call dist\bin\activate.bat, or source dist/bin/activate.sh
  • run pip install --pre DeepCL
  • test by doing python -c "import PyDeepCL; cl = PyDeepCL.DeepCL()"

To build from source

Building from source is only needed if installing from binaries doesn't work for your configuration, or if you want to modify DeepCL.

See Build.md

What if it doesn't run?

  • Check if you have an OpenCL-enabled device on your system
    • ideally a GPU, or accelerator, since there is no attempt to optimize DeepCL for CPUs (at least, not currently, could change, feel free to submit a pull request :-) )
  • Try running gpuinfo (from EasyCL, but built as part of this project too, for ease of use )
    • it should output at least one OpenCL-enabled device
    • if it doesn't, then you need to make sure you have an OpenCL-enabled device, and that appropriate drivers are installed, and that the ICD is configured appropriately (registry in Windows, and /etc/OpenCL/vendors in linux)

What if I need a new feature?

Please raise an issue, let me know you're interested.

  • If it's on my list of things I was going to do sooner or later anyway (see below), I might do it sooner rather than later.
  • If it's to do with usability, I will try to make that a priority

What if I want to contribute myself?

  • please feel free to fork this repository, tweak things, send a pull request. Or get in contact. Or both :-)

Third-party libraries

Hardware/driver specific issues

Related projects

License

Mozilla Public License 2.0

Recent changes

  • 2017 May 2nd:
    • branch update-easycl-mac updated to latest EasyCL, and unit-tests tested on Mac Sierra against:
      • Intel HD Graphics 530 GPU
      • Radeon Pro 450 GPU
    • This latest EasyCL lets you use environment variable CL_GPUOFFSET to select gpus, eg set to 1 for second GPU, or 2 for third
    • Thank you to my employer ASAPP for providing me use of said Mac Sierra :-)
  • 7th August 2016:
    • "standard" version of windows compiler changed from msvc2010 to msvc2015 update 3 (no change to linux/mac)
    • "standard" version of python 3.x on windows changed from 3.4 to 3.5 (no change to linux/mac)
    • (note: python2.7 continues to work as before on all of Windows 32/64, linux, Mac)
    • standard c++ version on linux/mac changed from c++0x to c++11
  • 29th July 2016:
    • python fixes:
      • CHANGE: must use numpy tensors now, array.array no longer accepted
      • New feature: can provide numpy tensors as 4d tensors now, no longer have to be 1d tensors
      • Bug fix: q-learning working again now (hopefully)
  • 26th July 2016:
    • fixed some bugs in manifest loader
    • no longer need to specify the number of images in the first line of the manifest file
    • added gpuindex= option to deepcl_unittests (quite beta for now...)
  • 4th January 2016:
    • fixed a number of build warnings on Mac, both in OpenCL build, and C++ build
  • 3rd January 2016:
  • 27th November:
  • Week of 26th October:
    • created branch clblas-2.8.0, which works with Visual Studio 2015. It uses the latest 2.8.x release of clBLAS. Thank you to jakakonda for helping to test this and get it working.
  • Aug 28th:
    • merged 8.x branch to master, will release first version of 8.x shortly
    • installation of 8.x from binaries on Windows works now, by doing, eg on 32-bit Windows 7, and assuming you already activated an appropriate python environment (assumes 7-zip is installed, in default location, otherwise do the unzip by hand):
powershell Set-ExecutionPolicy unrestricted
rem following command is like `wget` in linux:
powershell.exe -Command (new-object System.Net.WebClient).DownloadFile('http://deepcl.hughperkins.com/Downloads/deepcl-win32-v8.0.0rc8.zip', 'deepcl-win32-v8.0.0rc8.zip')
rem following command is like `tar -xf` in linux:
"c:\program files\7-Zip\7z.exe" x deepcl-win32-v8.0.0rc8.zip
call dist\bin\activate.bat
pip install --pre DeepCL
python -c "import PyDeepCL; cl = PyDeepCL.DeepCL()"
# (last line is just to check works ok)
  • Aug 26th: installation of 8.x from binaries on linux works now, by doing, eg on 64-bit Ubuntu 14.04:
mkdir 8.0.0rc4
cd 8.0.0rc4
wget http://deepcl.hughperkins.com/Downloads/deepcl-linux64-v8.0.0rc4.tar.bz2
tar -xf deepcl-linux64-v8.0.0rc4.tar.bz2
virtualenv env
source env/bin/activate
source dist/bin/activate.sh
pip install --pre DeepCL
python -c "import PyDeepCL; cl = PyDeepCL.DeepCL()"

(last line is just to check works ok)

  • Aug 21st-24th:
    • 8.x finally builds again on all CI tested configurations!
      • ubuntu 14.04 32-bit Python 2.7
      • ubuntu 14.04 32-bit Python 3.4
      • ubuntu 14.04 64-bit Python 2.7
      • ubuntu 14.04 64-bit Python 3.4
      • visual studio 2010 32-bit python 2.7
      • visual studio 2010 32-bit python 3.4
      • visual studio 2010 64-bit python 2.7
      • visual studio 2010 64-bit python 3.4
  • Aug 19th-20th:
    • Python wrappers now built using a very thin setup.py layer, on top of the standard native DeepCL build
  • Aug 18th:
    • added BackwardIm2Col layer, which uses im2col for backward propagation
    • added BackpropWeightsIm2Col layer, which uses im2col for weight update
    • added BackwardAuto layer, which automatically selects fastest Backward layer
    • added BackpropWeightsAuto layer, which automatically selects faster weight update layer
    • under the covers:
      • created ClBlasHelper, to handle Gemm and Gemv
      • factorized im2col into Im2Col class
  • week up to Aug 17th:
    • added forward and backward im2col layer
    • forward im2col automatically used during forward propagation, where appropriate
    • backwards has yet to be integrated
    • under the covers:
      • added clBLAS
      • migrated the Python build process to use cmake, rather than setup.py (whether this turns out to be good or bad is a bit up in the air for now)
  • June 22nd:
    • removed lua wrappers
    • if you want to use lua with OpenCL, please consider using cltorch and clnn

To get in contact

Just create an issues, in github, in the top right of this page. Don't worry about whether you think the issue sounds silly or anything. The more feedback the better!

Note that I'm currently focused 100.000% on cuda-on-cl, so please be patient during this period.

More Repositories

1

coriander

Build NVIDIA® CUDA™ code for OpenCL™ 1.2 devices
LLVM
842
star
2

VeriGPU

OpenSource GPU, in Verilog, loosely based on RISC-V ISA
SystemVerilog
792
star
3

tf-coriander

OpenCL 1.2 implementation for Tensorflow
C++
792
star
4

pytorch

Python wrappers for torch and lua
Python
431
star
5

cltorch

An OpenCL backend for torch.
C++
287
star
6

EasyCL

Easy to run kernels using OpenCL
C++
177
star
7

Jinja2CppLight

(very) lightweight version of Jinja2 for C++
C++
140
star
8

clnn

OpenCL backend for Torch nn neural networks library
Lua
123
star
9

howto-jenkins-ssl

quick how to on activating ssl on jenkins, so I can find it easily
109
star
10

jeigen

Java wrapper for Eigen C++ fast matrix library
C++
104
star
11

kgsgo-dataset-preprocessor

Dataset preprocessor for the KGS go dataset, eg according to Clark and Storkey input planes
Python
70
star
12

peaceful-pie

Control Unity from Python! Use for reinforcement learning.
C#
28
star
13

cpu-tutorial

Tutorial on building your own CPU, in Verilog
28
star
14

coriander-dnn

Partial implementation of NVIDIA® cuDNN API for Coriander, OpenCL 1.2
C++
22
star
15

rnn-notes

Notes on how element-research rnn works
17
star
16

luacpptemplater

Write Jinja2-style templates in C++. Uses lua as a scripting language (very lightweight)
C++
16
star
17

jfastparser

Very fast parsing of doubles and ints from a string
Java
15
star
18

UnityFluidSim-pub

UnityFluidSim-pub
C#
14
star
19

pytorch-coriander

OpenCL build of pytorch - (in-progress, not useable)
Python
14
star
20

pub-prototyping

prototyping stuff
C++
13
star
21

securewebcmd

Execute commands on a linux server through a webpage. Secured using md5 hashing
JavaScript
12
star
22

neonCl-underconstruction

experimental port of nervana neon kernels in OpenCL
Python
11
star
23

selfstudy-IBP

Self-study notes for Indian Buffet Process, from reading through "The Indian Buffet Process: An Introduction and Review", Griffiths, Ghahramani, 2011
Jupyter Notebook
11
star
24

torch-modder-notes

Notes for torch maintainers/modders
10
star
25

pycudatorch

poc for using cuda torch from python :-)
Python
7
star
26

nimbix-admin

utility scripts for start/stop/ssh to nimbix instances
Python
7
star
27

coriander-CLBlast

BLAS implementation for Coriander, using CLBlast
C++
6
star
28

ArgParseCpp

C++ version of Python's ArgParse
C++
5
star
29

passwordbookmarklet

bookmarklet to generate unique secure passwords for each website from a single master password
JavaScript
5
star
30

torchunit

torchunit
Shell
4
star
31

tinisles-googleauthenticator

Fork of the code at http://blog.tinisles.com/2011/10/google-authenticator-one-time-password-algorithm-in-javascript/
HTML
3
star
32

springgrid

Runs spring matches on a grid of botrunners
Python
3
star
33

osmp-cs

OSMP C# - Opensource Secondlife clone, from around 2005
C#
3
star
34

ailadder

code to create an ailadder webserver
Python
3
star
35

pycltorch

POC for Python wrappers for cltorch/clnn
Python
3
star
36

yet-another-measure-theoretic-probability-tutorial

Yet another measure theoretic probability tutorial
Jupyter Notebook
3
star
37

HughAI

HughAI Java AI for Spring
Java
3
star
38

selfstudy-LARS

least angle regression, reproducing for self-study
Jupyter Notebook
2
star
39

verigpu-cuda-frontend

Front-end for VeriGPU, providing NVIDIA® CUDA™ compatibility, for compatibility purposes
2
star
40

selfstudy-LIME

LIME
Jupyter Notebook
2
star
41

blameful-indenter

reindent code, whilst preserving git blame
Python
2
star
42

SpringRTS-CSharpAI

AI For Spring RTS game, in C#, from around 2006
C#
2
star
43

neon-benchmarks

benchmarks for neon, both cuda and OpenCL version
Python
2
star
44

FractalSpline-cpp

Provides SecondLife-like primitives , in C++/OpenGL. From around 2005
C++
2
star
45

relooper

Reloop llvm IR output, to have `for`s, `if`s, `while`s. From https://reviews.llvm.org/D12744
C++
2
star
46

osmp-cpp

OSMP C++ - opensource SecondLife clone, from around 2004
C++
2
star
47

python-graphics-numpy

Scripts for youtube video on creating graphics in python using numpy
Python
2
star
48

chat-ai-npcs-video-resources

chat-ai-npcs-video-resources
C#
2
star
49

github-stars

get an email whenever someone stars your github repo :-)
Python
2
star
50

project-ideas

Ideas for projects
2
star
51

scalable-gpt-developer

scalable-gpt-developer
Python
2
star
52

gpu-experiments

Informal experiments on various gpu kernel questions
Python
1
star
53

blender-tips

blender-tips
Python
1
star
54

peaceful-pie-video-resources

Resources for watching Peaceful Pie videos
Python
1
star
55

dockerfiles

dockerfiles
1
star
56

virtualenv-move

Moves a python virtualenv
Shell
1
star
57

privacy-policies

privacy-policies
HTML
1
star
58

openpw

Password hash generator, including console, bookmarklet, chrome extension
JavaScript
1
star
59

headlessopenglstubs

stubs for opengl, glew, sdl, whatever it takes ;-), to get spring to run without an X session
1
star
60

python-threadingx

Erlang-like threading functionality for Python
Python
1
star
61

youtube-likes

Receive a notification/email when someone 'like's one of your videos.
Python
1
star
62

youtube-rl-demos

Scripts, code used in youtube demos
Python
1
star
63

SpringMapDesigner

3d MapDesigner for Spring
1
star
64

chinese-transcriptions

Transcriptions of Chinese language videos
1
star
65

ndplot

high-dimensional viewer, by projecting onto a 3d hypercube. Use the mouse to rotate the 3d projection.
Python
1
star
66

pytorch-prettify

Prettifies exceptions coming out of pytorch
Jupyter Notebook
1
star
67

tf_cached_build

Cache tensorflow build dependencies, to accelerate repeated tf configures, or run on a plane
Python
1
star
68

cppsimpleargsparser

Simple C++ args parser. Easy to use. Automatically provides checking and usage printout.
C++
1
star
69

PortableTensor.Net

Cross-platform Tensor with transpose, slice as views over underlying data
C#
1
star