58
이예하 VUNO INC. IMPLEMENTING DEEP LEARNING USING CUDNN

IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

이예하 VUNO INC.

IMPLEMENTING DEEP LEARNING USING CUDNN

Page 2: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONTENTS Deep Learning Review

Implementation on GPU using cuDNN

Optimization Issues

Introduction to VUNO-Net

Page 3: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

DEEP LEARNING REVIEW

Page 4: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

1960 1970 1980 1990 2000

Golden Age Dark Age (“AI Winter”)

1940

Electronic Brain

1943

S. McCulloch - W. Pitts

• Adjustable Weights

• Weights are not Learned

1969

XOR Problem

M. Minsky - S. Papert

• XOR Problem

Multi-layered

Perceptron

(Backpropagation)

1986

D. Rumelhart - G. Hinton - R. Wiliams

• Solution to nonlinearly separable problems

• Big computation, local optima and overfitting

V. Vapnik - C. Cortes

1995

SVM

• Limitations of learning prior knowledge

• Kernel function: Human Intervention

2006

Deep Neural Network

(Pretraining)

G. Hinton - S. Ruslan

• Hierarchical feature Learning

2010 1950

Perceptron

1957

F. Rosenblatt

• Learnable Weights and Threshold

ADALINE

1960

B. Widrow - M. Hoff

BRIEF HISTORY OF NEURAL NETWORK

Page 5: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

MACHINE/DEEP LEARNING IS EATING THE WORLD!

Page 6: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

BUILDING BLOCKS Restricted Boltzmann machine

Auto-encoder

Deep belief Network

Deep Boltzmann machine

Generative stochastic networks

Recurrent neural networks

Convolutional neural netwoks

Page 7: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTIONAL NEURAL NETWORKS LeNet-5 (Yann LeCun, 1998)

Page 8: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTIONAL NEURAL NETWORKS Alex Net (Alex Krizhevsky et. al., 2012)

GoogleNet (Szegedy et. Al., 2015)

Page 9: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTIONAL NEURAL NETWORKS Network

Softmax Layer (Output)

Fully Connected Layer

Pooling Layer

Convoluti on Layer

Layer

Input / Output

Weights

Neuron activation

Forward Pass

Backw

ard

Pass

Forw

ard

Pass

Page 10: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

FULLY CONNECTED LAYER - FORWARD

Matrix calculation is very fast on GPU

cuBLAS library

Page 11: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

FULLY CONNECTED LAYER - BACKWARD

Matrix calculation is very fast on GPU

Element-wise multiplication can be done efficiently using GPU thread

Page 12: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER - FORWARD

x1 x4 x7

x2 x5 x8

x3 x6 x9

w1 w3

w2 w4

y1 y3

y2 y4

w1

w2

w4

w3

w1

w2

w4

w3

w1

w2

w4

w3

w1

w2

w4

w3

Page 13: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER - BACKWARD

x1 x4 x7

x2 x5 x8

x3 x6 x9

w1 w3

w2 w4

y1 y3

y2 y4

w1

w2

w4

w3

w1

w2

w4

w3

w1

w2

w4

w3

w1

w2

w4

w3

Page 14: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER - BACKWARD

x1 x4 x7

x2 x5 x8

x3 x6 x9

𝜕𝐿

𝜕𝑤1

𝜕𝐿

𝜕𝑤3

𝜕𝐿

𝜕𝑤2

𝜕𝐿

𝜕𝑤4

Error

Gradient

Page 15: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

HOW TO EVALUATE THE CONVOLUTION LAYER EFFICIENTLY?

Both Forward and Backward passes can be computed with convolution scheme

Lower the convolutions into a matrix multiplication (cuDNN)

There are several ways to implement convolutions efficiently

Fast Fourier Transform to compute the convolution (cuDNN_v3)

Computing the convolutions directly (cuda-convnet)

Page 16: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

IMPLEMENTATION ON GPU USING CUDNN

Page 17: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

INTRODUCTION TO CUDNN cuDNN is a GPU-accelerated library of primitives for deep neural networks

Convolution forward and backward

Pooling forward and backward

Softmax forward and backward

Neuron activations forward and backward:

Rectified linear (ReLU)

Sigmoid

Hyperbolic tangent (TANH)

Tensor transformation functions

Page 18: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

INTRODUCTION TO CUDNN (VERSION 2) cuDNN's convolution routines aim for performance competitive with the fastest GEMM

Lowering the convolutions into a matrix multiplication

(Sharan Chetlur et. al., 2015)

Page 19: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

INTRODUCTION TO CUDNN Benchmarks

https://github.com/soumith/convnet-benchmarks https://developer.nvidia.com/cudnn

Page 20: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

LEARNING VGG MODEL USING CUDNN Data Layer

Convolution Layer

Pooling Layer

Fully Connected Layer

Softmax Layer

Page 21: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

COMMON DATA STRUCTURE FOR LAYER Device memory & tensor description for input/output data & error

Tensor Description defines dimensions of data

float *d_input, *d_output, *d_inputDelta, *d_outputDelta

cudnnTensorDescriptor_t inputDesc;

cudnnTensorDescriptor_t outputDesc;

Page 22: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

DATA LAYER

Page 23: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER Initailization

Page 24: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER

Page 25: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER

Page 26: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER

Page 27: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER

Page 28: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER

Page 29: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER

Page 30: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER

Page 31: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER

Page 32: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER

Page 33: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER

Page 34: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

CONVOLUTION LAYER

Page 35: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

POOLING LAYER / SOFTMAX LAYER

Page 36: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

OPTIMIZATION ISSUES

Page 37: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

OPTIMIZATION

Page 38: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

OPTIMIZATION

Page 39: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

OPTIMIZATION

Page 40: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

OPTIMIZATION

Page 41: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

SPEED

Page 42: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

SPEED

Page 43: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

PARALLELISM

Page 44: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

PARALLELISM

Page 45: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

PARALLELISM

Page 46: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

INTRODUCING VUNO-NET

Page 47: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

THE TEAM

Page 48: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

VUNO-NET

Page 49: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

VUNO-NET

Page 50: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

PERFORMANCE

Page 51: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

APPLICATION

Page 52: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

APPLICATION

Page 53: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

APPLICATION

Page 54: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

VISUALIZATION

Page 55: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

VISUALIZATION

Page 56: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

VISUALIZATION

Page 57: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights
Page 58: IMPLEMENTING DEEP LEARNING USING CUDNN · 1960 1970 1980 1990 2000 Golden Age Dark Age (“AI Winter”) 1940 Electronic Brain 1943 1969 S. McCulloch - W. Pitts •Adjustable Weights

THANK YOU