Performance Modelling of Deep Learning on Intel …three different convolutional neural network...

8
Performance Modelling of Deep Learning on Intel Many Integrated Core Architectures (Preprint, HPCS, ©2019 IEEE) Andre Viebke Linnaeus University axj¨ o, Sweden [email protected] Sabri Pllana Linnaeus University axj¨ o, Sweden [email protected] Suejb Memeti Link¨ oping University Link¨ oping, Sweden [email protected] Joanna Kolodziej Cracow University of Technology Cracow, Poland [email protected] Abstract—Many complex problems, such as natural language processing or visual object detection, are solved using deep learn- ing. However, efficient training of complex deep convolutional neural networks for large data sets is computationally demanding and requires parallel computing resources. In this paper, we present two parameterized performance models for estimation of execution time of training convolutional neural networks on the Intel many integrated core architecture. While for the first performance model we minimally use measurement techniques for parameter value estimation, in the second model we estimate more parameters based on measurements. We evaluate the pre- diction accuracy of performance models in the context of training three different convolutional neural network architectures on the Intel Xeon Phi. The achieved average performance prediction accuracy is about 15% for the first model and 11% for second model. Index Terms—Deep Learning, Convolutional Neural Network (CNN), Performance Modelling, Intel Many Integrated Core (MIC) Architecture, Intel Xeon Phi I. I NTRODUCTION Deep learning [1] is modeled as artificial deep neural net- work that use many processing layers to learn complex func- tions with successful application in various domains including, self-driving cars [2], object recognition [3], natural language processing [4], speech recognition [5], language translation [6], optimization of the Cloud [7] and parallel computing systems [8]. Deep learning is becoming increasingly computational de- manding in accordance with the trend of increasing volumes of available data [9] and complexity of deep neural networks. Therefore, many-core parallel computing systems [10]–[14] are used to accelerate the learning process of deep neural networks [15], [16]. Many-core processors, such as NVIDIA GPU or the Intel Xeon Phi, provide high performance and may be used to accelerate the process of deep learning. Figure 1 depicts the performance of many-core processors compared to the fastest supercomputers in the world in the TOP500 list [17]. For instance, the peak performance of the Intel Xeon Phi Knights Corner (KNC) or the Tesla K40 is similar to the fastest supercomputer in the year 1997 that was ASCI Red with 1.45 Teraflop/s peak performance. This research has received funding from the Swedish Knowledge Founda- tion under Grant No. 20150088 Fig. 1. Performance of many-core processors and #1 in the TOP500 list [17] of most powerful supercomputers. The Intel Xeon Phi KNL in 2016 offered similar performance like the supercomputer ASCI RED that was #1 in June 2000. Related work has studied performance modeling of deep learning on distributed systems [18], performance prediction of asynchronous stochastic gradient descent [19], performance modelling of various distributed deep learning frameworks (such as, Caffe-MPI or TensorFlow) [20], analytical models for predicting the usage of optimal resources of a GPU for deep learning [21]. However, not much attention has been devoted to performance modeling of deep convolutional neural networks on the Intel many integrated core architecture. In this paper, we describe our approach for performance modeling of training convolutional neural networks on the Intel Xeon Phi many core processor. We develop two param- eterized performance models based on the theoretical analysis of a code [22] for training convolutional neural networks that we parallelized for the Intel Xeon Phi. Input variables of the performance models are the number of training or validation images, the number of test images, the number of network instances, the number of epochs, and the number of processing units. For the development of the first performance model, we minimally use measurements for estimating parameter values of the performance model; only memory contention is estimated using measurements. For the second performance model, we apply measurements for estimation of the sequential arXiv:1906.01992v1 [cs.DC] 4 Jun 2019

Transcript of Performance Modelling of Deep Learning on Intel …three different convolutional neural network...

Page 1: Performance Modelling of Deep Learning on Intel …three different convolutional neural network architectures on the Intel Xeon Phi. The achieved average performance prediction accuracy

Performance Modelling of Deep Learning on IntelMany Integrated Core Architectures

(Preprint, HPCS, ©2019 IEEE)

Andre ViebkeLinnaeus University

Vaxjo, [email protected]

Sabri PllanaLinnaeus University

Vaxjo, [email protected]

Suejb MemetiLinkoping UniversityLinkoping, [email protected]

Joanna KolodziejCracow University of Technology

Cracow, [email protected]

Abstract—Many complex problems, such as natural languageprocessing or visual object detection, are solved using deep learn-ing. However, efficient training of complex deep convolutionalneural networks for large data sets is computationally demandingand requires parallel computing resources. In this paper, wepresent two parameterized performance models for estimationof execution time of training convolutional neural networks onthe Intel many integrated core architecture. While for the firstperformance model we minimally use measurement techniquesfor parameter value estimation, in the second model we estimatemore parameters based on measurements. We evaluate the pre-diction accuracy of performance models in the context of trainingthree different convolutional neural network architectures on theIntel Xeon Phi. The achieved average performance predictionaccuracy is about 15% for the first model and 11% for secondmodel.

Index Terms—Deep Learning, Convolutional Neural Network(CNN), Performance Modelling, Intel Many Integrated Core(MIC) Architecture, Intel Xeon Phi

I. INTRODUCTION

Deep learning [1] is modeled as artificial deep neural net-work that use many processing layers to learn complex func-tions with successful application in various domains including,self-driving cars [2], object recognition [3], natural languageprocessing [4], speech recognition [5], language translation[6], optimization of the Cloud [7] and parallel computingsystems [8].

Deep learning is becoming increasingly computational de-manding in accordance with the trend of increasing volumesof available data [9] and complexity of deep neural networks.Therefore, many-core parallel computing systems [10]–[14]are used to accelerate the learning process of deep neuralnetworks [15], [16]. Many-core processors, such as NVIDIAGPU or the Intel Xeon Phi, provide high performance and maybe used to accelerate the process of deep learning. Figure 1depicts the performance of many-core processors compared tothe fastest supercomputers in the world in the TOP500 list[17]. For instance, the peak performance of the Intel XeonPhi Knights Corner (KNC) or the Tesla K40 is similar to thefastest supercomputer in the year 1997 that was ASCI Redwith 1.45 Teraflop/s peak performance.

This research has received funding from the Swedish Knowledge Founda-tion under Grant No. 20150088

Fig. 1. Performance of many-core processors and #1 in the TOP500 list [17]of most powerful supercomputers. The Intel Xeon Phi KNL in 2016 offeredsimilar performance like the supercomputer ASCI RED that was #1 in June2000.

Related work has studied performance modeling of deeplearning on distributed systems [18], performance predictionof asynchronous stochastic gradient descent [19], performancemodelling of various distributed deep learning frameworks(such as, Caffe-MPI or TensorFlow) [20], analytical models forpredicting the usage of optimal resources of a GPU for deeplearning [21]. However, not much attention has been devoted toperformance modeling of deep convolutional neural networkson the Intel many integrated core architecture.

In this paper, we describe our approach for performancemodeling of training convolutional neural networks on theIntel Xeon Phi many core processor. We develop two param-eterized performance models based on the theoretical analysisof a code [22] for training convolutional neural networks thatwe parallelized for the Intel Xeon Phi. Input variables of theperformance models are the number of training or validationimages, the number of test images, the number of networkinstances, the number of epochs, and the number of processingunits. For the development of the first performance model,we minimally use measurements for estimating parametervalues of the performance model; only memory contentionis estimated using measurements. For the second performancemodel, we apply measurements for estimation of the sequential

arX

iv:1

906.

0199

2v1

[cs

.DC

] 4

Jun

201

9

Page 2: Performance Modelling of Deep Learning on Intel …three different convolutional neural network architectures on the Intel Xeon Phi. The achieved average performance prediction accuracy

work, and the forward- and back-propagation. For evaluation,we use the MNIST [20] data-set of handwritten digits. Theaverage deviation of predicted from the measured performanceover all measured thread counts and various neural networkarchitectures is about 15% for the first model and 11% forsecond model. Major contributions of this paper include,

• development of two performance models for estimation ofexecution time of training convolutional neural networkson the Intel Xeon Phi,

• evaluation of prediction accuracy of performance modelsfor various execution contexts and neural network archi-tectures,

• model-driven performance evaluation for larger numberof threads than the number of hardware threads of theIntel Xeon Phi under study.

The rest of this paper is structured as follows. Section IIgives an overview of convolutional neural networks that areaddressed in this paper. We describe Intel many integratedcore architecture in Section III. Section IV describes ourperformance modelling approach. An empirical evaluation ofthe performance model is described in Section V. We discussthe related work in Section VI. Section VII concludes thispaper.

II. CONVOLUTIONAL NEURAL NETWORKS

An artificial deep neural network is the underlying modelused in deep learning [1]. A Convolutional Neural Network(CNN) is a variant of a Deep Neural Network (DNN), whichintroduces two additional layer types: convolutional layersand pooling layers. The mammal visual processing systemis hierarchical (deep) in nature. Higher level features areabstractions of lower level ones. For instance, to understandspeech, waveforms are translated through several layers untilreaching a linguistic level. A similar analogy can be drawn forimages, where edges and corners are lower level abstractionstranslated into more spatial patterns on higher levels.

The architecture of a DNN consists of multiple layers ofneurons. Neurons are connected to each other through edges(weights). The network can simply be thought of as a weightedgraph; a directed acyclic graph represents a feed-forwardnetwork. The depth and breadth of the network differs as maythe layer types. Regardless of the depth, a network has at leastone input and one output layer. A neuron has a set of incomingweights, which have corresponding outgoing edges attached toneurons in the previous layer. Also, a bias term is used at eachlayer as an intercept term. The goal of the learning processis to adjust the network weights and find a global minimumby reducing the overall error, i.e. the deviation between thepredicted and the desired outcome of all the samples. Theresulting weight parameters can thereafter be used to makepredictions of unseen inputs [23].

DNNs can make predictions by forward propagating aninput through the network. Forward propagation proceeds byperforming calculations at each layer until reaching the outputlayer, which contains a vector representing the prediction. Forexample, in image classification problems, the output layer

(a) Small CNN: the first convolutional layer has 5 maps, 3380neurons, uses a kernel size of 4x4, a map size of 26x26 and 85weights.

(b) Medium CNN: the first convolutional layer has 20 maps, 13,520neurons, uses a kernel size of 4x4, a map size of 26x26 and 340weights.

(c) Large CNN: the last convolutional layer has 100 maps, 3,600 neurons, a6x6 kernel, a map size of 6x6 and 216,100 weights.

Fig. 2. CNN architectures used for experimental evaluation in this study. Istands for input, C for convolutional, M for max-pooling, F for fully connectedand O for output. The input layer has 841 neurons in a 29x29 grid. The outputlayer has 10 neurons.

contains the prediction score that indicates the likelihood thatan image belongs to a category [23], [24].

The forward propagation starts from a given input layer,then at each layer the activation for a neuron is activated usingthe equation yli = σ(xli) + I li where yli is the output value ofneuron i at layer l, xli is the input value of the same neuron,and σ (sigmoid) is the activation function. I li is used for theinput layer when there is no previous layer. The goal of theactivation function is to return a normalized value (sigmoidreturn [0,1] and tanh is used in cases where the desired returnvalues are [-1,1]). The input xli can be calculated as xli =∑j(w

ljiy

l−1j ) where wlji denotes the weight between neuron i

in the current layer l, and j in the previous layer, and yl−1j the

output of the jth neuron at the previous layer. This process isrepeated until reaching the output layer. At the output layer, itis common to apply a soft max function, or similar, to squashthe output vector and hence derive the prediction.

Back-propagation is the process of propagating errors, i.e.the loss calculated as the deviation between the predicted andthe desired output, backward in the network, by adjusting theweights at each layer. The error and partial derivatives δli arecalculated at the output layer based on the predicted values

Page 3: Performance Modelling of Deep Learning on Intel …three different convolutional neural network architectures on the Intel Xeon Phi. The achieved average performance prediction accuracy

from forward propagation and the labeled value (the correctvalue). At each layer, the relative error of each neuron iscalculated and the weight parameters are updated based onhow much the neuron participated in the faulty prediction.The expression δE/δyli =

∑(wlijδE/δx

l+1j ) denotes that

the partial derivative of neuron i at the current layer l is thesum of the derivatives of connected neurons at the next layermultiplied with the weights, assuming wl denotes the weightsbetween the maps. Additionally, a decay is commonly used tocontrol the impact of the updates, which is omitted in the abovecalculations. More concretely, the algorithm can be thought ofas updating the layer's weights based on ”how much it wasresponsible for the errors in the output” [23], [24].

A CNN is a multi-layer model constructed to learn variouslevels of representations where higher level representations aredescribed based on the lower level ones [25]. It is a variantof deep neural network that introduces two new layer types:convolutional and pooling layers.

The convolutional layer consists of several feature mapswhere neurons in each map connect to a grid of neurons inmaps in the previous layer through overlapping kernels. Thekernels are tiled to cover the whole input space. The approachis inspired by the receptive fields of the mammal visual cortex.All neurons of a map extract the same features from a mapin the previous layer as they share the same set of weights.Pooling layers intervene convolutional layers and have shownto lead to faster convergence. Each neuron in a pooling layeroutputs the (maximum/average) value of a partition of neuronsin the previous layer, and hence only activates if the underlyinggrid contains the sought feature. Besides from lowering thecomputational load, it also enables position invariance anddown samples the input by a factor relative to the kernel size[26].

LeNet-5 is an example of a Convolutional Neural Network.Each layer of convolution and pooling (that is a specificmethod of sub-sampling used in LeNet) comprise severalfeature maps. Neurons in the feature map cover different sub-fields of the neurons from the previous layer. All neurons in amap share the same weight parameters, therefore they extractthe same features from different parts of the input from theprevious layers. CNNs are commonly constructed similarlyto the LeNet-5, beginning with an input layer, followed byseveral convolutional/pooling combinations, ending with afully connected layer and an output layer [26].

In this study, the MNIST [27] dataset of handwritten digitsis used. In total the MNIST data-set comprises 70000 images,60000 of which are used for training/validation and the restfor testing. Figure 2 depicts three different CNN architecturesthat we use for evaluation: small, medium and large. There arevarious CNN implementations, such as, EbLearn at New YorkUniversity and Caffe at Berkeley. As a basis for our work weselected a project developed by Ciresan [22], which targets theMNIST dataset of handwritten digits and has the possibility todynamically configure the definition of layers, the activationfunction, and the connection types using a configuration file.

T1 T2

T3 T4

L1/L2 cache

Core 15

T1 T2

T3 T4

L1/L2 cache

Core 1T1 T2

T3 T4

L1/L2 cache

Core ...

T1 T2

T3 T4

L1/L2 cache

Core ...

GDDR MC

GDDR MC

GDDR MC

GDDR MC

PCIe

Client

Logic

T1 T2

T3 T4

L1/L2 cache

Core 30

...

...

Device

T1 T2

T3 T4

L1/L2 cache

Core 61

TD

TD

TD

TD

TD

TD

TD

TD

Fig. 3. An example of the Intel Many Integrated Core Architecture: IntelXeon Phi.

III. INTEL MANY INTEGRATED CORE ARCHITECTURE

Figure 3 depicts an overview of the Intel Xeon Phi (co-denamed Knights Corner) architecture, which is an exampleof the Intel Many Integrated Core (MIC) Architecture. It is amany-core shared-memory Intel Xeon Phi processor, whichruns a lightweight Linux operating system that offers thepossibility to communicate with it over ssh. The Intel XeonPhi processor used in our study runs a µOS of version 2.6.38.8and a software stack MPSS version 3.1.1.

The Intel Xeon Phi used in this study is of model 7120p, andfacilitates 61 cores, each with a clock frequency of 1.2 GHz[28]. Each core can switch between four hardware threadsin a round-robin manner, which amounts to a total of 244threads per processor. Theoretically, the processor can deliverup to one teraFLOP/s of double precision performance, or twoteraFLOP/s of single precision performance. Each core hasits own L1 (32KB) and L2 (512KB) cache. The L2 cacheis kept fully coherent by a global distributed tag-directory(TD). The cores are connected through a bidirectional ringbus interconnect, which forms a unified shared L2 cacheof 30.5MB. In addition to the cores, there are 16 memorychannels that in theory offer a maximum memory bandwidthof 352GB/s.

Efficient usage of the available vector processing units of theIntel Xeon Phi is essential to fully utilize the performance ofthe processor [29]. Through the 512-bit wide SIMD registersit can perform 16 (16 wide × 32 bit) single-precision or 8(8 wide × 64 bit) double-precision operations per cycle. TheXeon Phi offers two programming models:

1) offload - parts of the applications running on the hostare offloaded to the Intel Xeon Phi processor

Page 4: Performance Modelling of Deep Learning on Intel …three different convolutional neural network architectures on the Intel Xeon Phi. The achieved average performance prediction accuracy

Fig. 4. An overview of our parallel deep leaning algorithm for Intel XeonPhi. i is the number of training or validation images, it is the number of testimages, ns is the number of network instances, ep is the number of epochs,p is the number of processing units. w’, b’, c’, f’, g’, h’ indicate the work atvarious algorithmic steps.

2) native - the code is compiled specifically for runningnatively on the Intel Xeon Phi processor. The code andall the required libraries should be transferred on thedevice. In this study, we use the native mode.

In this study, we use OpenMP [30] for code implementationthat exploits thread- and SIMD-parallelism available on theIntel Xeon Phi. The Intel Compiler 15.0.0 was used for nativecompilation of the application for the processor, whereas theO3 level was used for optimization.

IV. PERFORMANCE MODELLING

A performance model [31], [32] enables us to reasonabout the behavior of an implementation in future executioncontexts. Our performance model can predict the performancefor numbers of threads that go beyond the number of hardwarethreads supported in the Intel Xeon Phi model that we usedfor evaluation. Additionally, it can predict the performance ofdifferent CNN architectures with various number of imagesand epochs.

The input variables of our performance modelT (i, it, ep, p, s) are: the number of training or validationimages (i), the number of test images (it), the number ofnetwork instances (ns), the number of epochs (ep), and thenumber of processing units (p).

Figure 4 depicts an overview of our parallel deep leaningalgorithm for Intel Xeon Phi using call outs to denote thetime complexity for different operations. Dashed lines denotethe critical path through the algorithm. As each processingunit carries out equal amount of work, doing so in parallelreduces the overall computations required per worker, theshortest execution time depends on the slowest worker. Here,the creation of network instances is not parallelized. The span

TABLE IVARIABLES USED IN THE PERFORMANCE MODEL.

Variable Explanation

Parameters

p Number of processing unitsi Number of training/validation imagesit Number of test imagesep Number of epochs

Constants - hardware dependent

CPI Best theoretical CPI/threads Speed of processing unitOperationFactor Operation factor

Measured - hardware dependent

MemoryContention Memory contentionTFprop+ Forward propagation / image (ms)TBprop+ Back-propagation / image (ms)TPrep+ Time for preparations

Calculated - hardware independent

FProp* # FProp Operations / imageBProp* # BProp Operations / imagePrep* # Operations carried out for preparations

* The parameter is only used in prediction strategy (a)+ The parameter is only used in prediction strategy (b)

TABLE IIHARDWARE INDEPENDENT PARAMETERS USED IN THE PERFORMANCE

MODEL.

Term Value

Epochs (ep) 70 (small, medium), 15 (large)Images (i) 60,000Images (it) 10,000Processing units/threads (p) 1 - 3,840

FProp See table VIIBProp See table VIII

PrepSmall: 109

Medium: 1010

Large: 1011

can be thought of as the sequential amount of work required toinitialize images and labels, and other variables necessary, plusthe maximum time for each network instances to carry out itsintended amount of work in training, validation, and testing.If applying infinite number of processing units, what remainsare the initial amount of work and the maximum time spentby each processing unit to process its chunk of the images.

The total execution time depends on several factors in-cluding: speed, number of processing units, communicationcosts (such as network latency), and memory contention.Of particular interest are contentions causing waiting times,including memory latencies and synchronization overhead. Atime penalty referred to as Tmem is added to the model toreflect memory and synchronization overhead. The contentionis measured through an experimental approach by executing asmall script on the Intel Xeon Phi processor for different threadcounts, CNN weights and layers. The full set of variables isshown in Table I.

Page 5: Performance Modelling of Deep Learning on Intel …three different convolutional neural network architectures on the Intel Xeon Phi. The achieved average performance prediction accuracy

TABLE IIIHARDWARE SPECIFIC PARAMETERS USED IN THE PERFORMANCE MODEL.

Parameter Intel Xeon Phi

s 1.238 GHzMax processing units (p) 244 (240 used for prediction)

TFprop(ms)Small: 1.45Medium: 12.55Large: 148.88

TBprop(ms)Small: 5.3Medium: 69.73Large: 859.19

TPrep(s)Small: 12.56Medium: 12.7Large: 13.5

CPI 1-2 threads: 1; 3 threads: 1.5; 4 threads: 2MemoryContention Table IV

OperationFactorSmall: 15Medium: 15Large: 15

TABLE IVMEASURED AND PREDICTED MEMORY CONTENTION IN SECONDS [S] FOR

THE INTEL XEON PHI.

# Threads Small CNN Medium CNN Large CNN

1 7.10 ∗ 10−6 1.56 ∗ 10−4 8.83 ∗ 10−4

15 6.40 ∗ 10−4 2.00 ∗ 10−3 8.75 ∗ 10−3

30 1.36 ∗ 10−3 3.97 ∗ 10−3 1.67 ∗ 10−2

60 3.07 ∗ 10−3 8.03 ∗ 10−3 3.22 ∗ 10−2

120 6.76 ∗ 10−3 1.65 ∗ 10−2 6.74 ∗ 10−2

180 9.95 ∗ 10−3 2.50 ∗ 10−2 1.00 ∗ 10−1

240 1.40 ∗ 10−2 3.83 ∗ 10−2 1.38 ∗ 10−1

480* 2.78 ∗ 10−2 7.31 ∗ 10−2 2.73 ∗ 10−1

960* 5.60 ∗ 10−2 1.47 ∗ 10−1 5.46 ∗ 10−1

1,920* 1.12 ∗ 10−1 2.95 ∗ 10−1 1.093,840* 2.25 ∗ 10−1 5.91 ∗ 10−1 2.19

* Predicted memory contention

We define memory overhead as, Tmem(ep, i, p) =(MemoryContention∗ep∗i)/p where MemoryContentionis the measured memory contention when p threads are com-peting for I/O concurrently. The measured and predicted valuesfor memory contention are depicted in Table IV. In Table Iparameters used in the performance model are depicted; someparameters are hardware dependent and others independent ofthe underlying hardware. Each parameter is either measuredor calculated. Table II shows parameters that are independentof the hardware, and Table III shows the parameters that arespecific for the Intel Xeon Phi.

We follow two strategies for performance modelling:• Strategy (a) minimizes the use of measurements for esti-

mating parameter values of the performance model. Onlymemory contention is estimated using measurements. Theperformance model for strategy (a) is depicted in Table V.

• Strategy (b) applies the measurements to estimation ofthe sequential work, the forward- and back-propagation.The performance model for strategy (b) is depicted inTable VI.

TABLE VPERFORMANCE MODEL FOR STRATEGY (A).

T (i, it, ep, p, s)= Tcomp(i, it, ep, p, s) + Tmem(ep, i, p)

preparation work =

(Prep + 4 ∗ i + 2 ∗ it + 10 ∗ ep

s

training +

(((FProp + BProp

s

)∗

i

pi∗ ep

)validation +

((FProp

s

)∗

i

pi∗ ep

)testing +

((FProp

s

)∗

it

pit∗ ep

))

calculation penalty ∗CPI

)∗OperationFactor

memory overhead +MemoryContention ∗ i ∗ ep

p

Please note that the constants are approximations, they arerelative to each other, and yet far from precise. Prep isdifferent for each CNN architecture (109, 1010 and 1011 forsmall, medium and large architecture respectively) and denotesthe number of operations required to create network instances,prepare weights, etc. The OperationFactor is adjusted toclosely match the measured value for 15 threads, and mitigatethe approximations done for instructions in the first place, atthe same time account for vectorization.

TABLE VIPERFORMANCE MODEL FOR STRATEGY (B).

T (i, it, ep, p)= Tcomp(i, it, ep, p) + Tmem(ep, i, p)

preparation work = Tprep

training +

(((TFProp + TBprop

)∗

i

pi∗ ep

)validation +

(TFProp ∗

i

pi∗ ep

)testing +

(TFProp ∗

it

pit∗ ep

))calculation penalty ∗CPI

memory overhead +MemoryContention ∗ i ∗ ep

p

Tprep is the measured time it takes to prepare the training(small 12.56 seconds, medium 12.7 seconds, and large 13.5seconds); TFProp and TBProp indicate the required time toforward- and back-propagate one image through the network.When one hardware thread is available per core, then oneinstruction per cycle can be assumed. For four threads percore, only 0.5 instructions per cycle can be assumed per thread;each thread gets to execute two instructions every fourth cycle(CPI of 2). The speed s is defined in Table III. FProp andBProp are placeholders for the actual number of operationsshown in Table VII and Table VIII respectively.

V. EVALUATION OF PERFORMANCE MODEL

In this section, we compare the predicted and measuredexecution times for various numbers of threads and CNNarchitectures. The execution time is the total time the program

Page 6: Performance Modelling of Deep Learning on Intel …three different convolutional neural network architectures on the Intel Xeon Phi. The achieved average performance prediction accuracy

TABLE VIIFProp: NUMBER OF OPERATIONS WHEN FORWARD PROPAGATING ONE

IMAGE FOR SMALL, MEDIUM AND LARGE CNN ARCHITECTURES.

Max Pool. Fully Con. Convolution Total Ratio

Small 7k 5k 46k 58k -Medium 29k 56k 474k 559k 9.64Large 99k 137k 5,113k 5,349k 9.57

TABLE VIIIBProp: NUMBER OF OPERATIONS WHEN BACK PROPAGATING ONE IMAGE

FOR SMALL, MEDIUM AND LARGE CNN ARCHITECTURES.

Max Pool. Fully Con. Convolution Total Ratio

Small 2k 10k 512k 524k -Medium 4k 112k 6,003k 6,119k 11.68Large 8k 274k 72,896k 73,178k 11.96

runs, excluding the time required to initialize the networkinstances and images. To evaluate our approach we use an IntelXeon Phi 7120P accelerator that comprises 61 cores that runat 1.2 GHz. We use 1, 15, 30, 60, 120, 180, and 240 threadsof the Intel Xeon Phi processor. Each thread is responsiblefor one network instance. In the figures, we use the followingnotations: Par refers to the parallel version, and T denotesthreads, for instance, Phi Par. 120 T is the parallel versionthat is executed by 120 threads on the Intel Xeon Phi.

Result 1: The predicted execution times obtained from theperformance model match well the measured execution times.

Figures 5, 6, and 7 depict the predicted and measured ex-ecution times for small, medium and large CNN architecture.For the small network (Figure 5), the predictions are close tothe measured values with a slight deviation at the end. Theprediction model seems to over-estimate the execution timewith a small factor.

For the medium architecture (Figure 6) the prediction followthe measured values closely, although it underestimates theexecution time slightly. At 120 threads, the measured andpredicted values start to deviate, which are recovered at 240threads.

The large CNN architecture (Figure 7) yields similar per-formance results as the medium CNN architecture. We may

Fig. 5. Comparing predicted execution times with measured execution timeson Intel Xeon Phi for the small CNN architecture.

Fig. 6. Comparing predicted execution times with measured execution timeson Intel Xeon Phi for the medium CNN architecture.

Fig. 7. Comparing predicted execution times with measured execution timeson Intel Xeon Phi for the large CNN architecture.

observe that the measured values are slightly higher thanthe predictions, however, the predictions follow the measuredvalues. For 120 threads there is a deviation between themeasured and predicted value, which is then improved for 240threads. While the predicted execution time increases between120 and 240 threads, the measured execution time decreases.This is most probably due to the CPI factor that is added when3 or more threads are present on the same core.

We use the expression ∆ = (∣∣Tµ − Tψ

∣∣ /Tψ)100% tocalculate the prediction accuracy of our performance model,where Tµ is the measured and Tψ is the predicted value.The average prediction accuracy for strategies (a) and (b) andvarious CNN architectures is shown in Table IX. We mayobserve, that model (a) is more accurate for the small CNN,whereas the model (b) is better for medium and large CNNs.

Result 2: The performance model results indicate that CNNtraining on Intel Xeon Phi scales well up to several thousandsof threads.

We used the prediction model to predict the executiontimes for 480, 960, 1920, and 3840 threads for different CNN

TABLE IXAVERAGE ACCURACY ∆ OF PERFORMANCE MODEL FOR PREDICTION

STRATEGIES (A) AND (B) AND ALL CONSIDERED CNN ARCHITECTURES.

Small CNN Medium CNN Large CNNa b a b a b

14.57% 16.35% 14.76% 7.48% 15.36% 10.22%

Page 7: Performance Modelling of Deep Learning on Intel …three different convolutional neural network architectures on the Intel Xeon Phi. The achieved average performance prediction accuracy

TABLE XPREDICTED EXECUTION TIMES IN MINUTES FOR 480, 960, 1,920 AND

3,840 IMAGES USING THE PERFORMANCE MODELS (A) AND (B).

Small Medium Largea b a b a b

480 6.6 6.7 36.8 39.1 92.9 82.6960 5.4 5.5 23.9 25.1 60.8 45.7

1,920 4.9 4.9 17.4 18.0 44.8 27.23,840 4.6 4.6 14.2 14.5 36.8 18.0

TABLE XITHE EXECUTION TIMES IN MINUTES WHEN SCALING EPOCHS AND IMAGES

FOR 240 AND 480 THREADS USING THE PERFORMANCE MODEL (A) ONTHE SMALL CNN ARCHITECTURE.

240 Threads 480 Threads

Images Epochs Epochsi1 it2 70 140 280 70 140 280

60k 10k 8.9 17.6 35.0 6.6 12.9 25.6120k 20k 17.6 35.0 69.7 12.9 25.6 51.1240k 40k 35.0 69.7 139.3 25.6 51.1 101.9

1 Number of images in the training/validation set2 Number of images in the test set

architectures, using the same parameters. The results in TableX show that if 3,840 threads were available, the small networkshould take about 4.6 minutes to train, the medium 14.5minutes and the large 36.8 minutes. The predictions for thelarge CNN architecture are not as well aligned when increasingto larger thread counts as for small and medium.

Additionally, we evaluated the execution time for varyingimage counts, and epochs, for 240 and 480 threads for thesmall CNN architecture. As can be seen in Table XI doublingthe number of images or epochs, approximately doubles theexecution time. However, doubling the number of threads doesnot reduce the execution time in half.

VI. RELATED WORK

In this section, we discuss related work with respect toperformance modeling of deep learning.

Yan et al. [18] focus on performance modeling and opti-mization of deep learning on distributed systems. The authorsuse analytical performance modeling techniques to explore theconfiguration space and find optimal system configurations tominimize the iteration time over the training data. According tothe authors, the error rates of under 25% allow them to identifyand distinguish good combination of system parameters fromthe not so good ones.

Oyama et al. [19] propose a performance prediction modelfor an asynchronous stochastic gradient descent deep learn-ing system. The proposed approach considers the probabilitydistribution of mini-batch sizes and staleness (that is, thenumber of updates done within one gradient computation). Theauthors report model accuracy of 81-95% for various mini-batch sizes. Similar to our work, the authors use the predictionmodel to evaluate the scalability of deep learning for upcominghardware architectures.

Paleo, a performance model proposed by Qi et al. [33], canefficiently predict a combination of the network architecture,hardware and software choices, parallelization strategies, andcommunication schemes to model the expected performanceand scalability of training deep neural networks.

Song et al. [21], in contrast, focus on the different require-ments that the end-users need to perform various predictiontasks. They propose an approach that combines offline compi-lation (to select optimal batch-sizes) and run-time management(to identify and schedule the fastest kernels, and partition theavailable resources accordingly). The authors use analyticalmodels to predict the optimal resources of a GPU (such asstreaming multiprocessors) to use in each layer, and predictthe processing time of a given layer.

Shi et al. [20] use performance modelling to evaluate variousdistributed deep learning frameworks (such as, Caffe-MPI orTensorFlow) on GPU accelerated computing systems. Authorsobserve performance gaps between deep learning implemen-tations under study and identify methods that require furtheroptimization.

Yufei et al. [34] propose a performance model for predictionof throughput on FPGAs, which is used to identify and exploreoptimal design choices during the design phase. The authorsfocus on modeling the DRAM access, latency, and on-chipbuffer access. The validation results show that estimationsderived from the model closely match (within 3%) the actualtest results executed on Arria 10 and Stratix 10 FPGAs.

In contrast to the related work, we focus on performancemodeling of training deep convolutional neural networks onthe Intel Xeon Phi many-core processor. In our previous work[35] we used machine learning for performance prediction ofDNA sequence analysis [36], [37] on Intel Xeon Phi .

VII. SUMMARY

Deep learning is essential for solving complex problems inmany domains including, self-driving cars, object recognition,natural language processing, speech recognition, and languagetranslation. In this paper, we have described an approachfor performance modeling of training convolutional neuralnetworks on the Intel Xeon Phi many core processor. Wedeveloped two parameterized performance models based onthe theoretical code analysis. For the development of thefirst performance model, we minimally used measurementsfor estimating parameter values of the performance model;only memory contention was estimated using measurements.For the second performance model, we used measurementsfor estimation of the sequential work, and the forward- andback-propagation. We used three different convolutional neuralnetwork architectures for evaluation of performance predictionaccuracy of the developed models. The average deviation ofpredicted from the measured performance over all measuredthread counts and various neural network architectures wasabout 15% for the first model and 11% for second model.

Future work will develop performance models of deep learn-ing on large-scale parallel computing systems that comprisemultiple nodes with many-core processors.

Page 8: Performance Modelling of Deep Learning on Intel …three different convolutional neural network architectures on the Intel Xeon Phi. The achieved average performance prediction accuracy

REFERENCES

[1] Y. LeCun, Y. Bengio, and G. Hinton, “Deep learning,”Nature, vol. 521, pp. 436 – 444, 2015. [Online]. Available:https://doi.org/10.1038/nature14539

[2] M. Bojarski, D. D. Testa, D. Dworakowski, B. Firner, B. Flepp,P. Goyal, L. D. Jackel, M. Monfort, U. Muller, J. Zhang,X. Zhang, J. Zhao, and K. Zieba, “End to end learning for self-driving cars,” CoRR, vol. abs/1604.07316, 2016. [Online]. Available:http://arxiv.org/abs/1604.07316

[3] A. Krizhevsky, I. Sutskever, and G. E. Hinton, “Imagenetclassification with deep convolutional neural networks,” Commun.ACM, vol. 60, no. 6, pp. 84–90, May 2017. [Online]. Available:http://doi.acm.org/10.1145/3065386

[4] R. Collobert, J. Weston, L. Bottou, M. Karlen, K. Kavukcuoglu,and P. Kuksa, “Natural language processing (almost) from scratch,”J. Mach. Learn. Res., vol. 12, pp. 2493–2537, Nov. 2011. [Online].Available: http://dl.acm.org/citation.cfm?id=1953048.2078186

[5] G. Hinton, L. Deng, D. Yu, G. E. Dahl, A. Mohamed, N. Jaitly,A. Senior, V. Vanhoucke, P. Nguyen, T. N. Sainath, and B. Kingsbury,“Deep neural networks for acoustic modeling in speech recognition:The shared views of four research groups,” IEEE Signal ProcessingMagazine, vol. 29, no. 6, pp. 82–97, Nov 2012.

[6] I. Sutskever, O. Vinyals, and Q. V. Le, “Sequence to sequence learningwith neural networks,” in Proceedings of the 27th InternationalConference on Neural Information Processing Systems - Volume 2, ser.NIPS’14. Cambridge, MA, USA: MIT Press, 2014, pp. 3104–3112.[Online]. Available: http://dl.acm.org/citation.cfm?id=2969033.2969173

[7] D. Grzonka, A. Jakobik, J. Kolodziej, and S. Pllana, “Using amulti-agent system and artificial intelligence for monitoring andimproving the cloud performance and security,” Future GenerationComputer Systems, vol. 86, pp. 1106 – 1117, 2018. [Online]. Available:http://www.sciencedirect.com/science/article/pii/S0167739X17310531

[8] S. Memeti, S. Pllana, A. Binotto, J. Kołodziej, and I. Brandic, “Usingmeta-heuristics and machine learning for software optimization ofparallel computing systems: a systematic literature review,” Computing,Apr 2018. [Online]. Available: https://doi.org/10.1007/s00607-018-0614-9

[9] S. Vitabile, M. Marks, D. Stojanovic, S. Pllana, J. M. Molina,M. Krzyszton, A. Sikora, A. Jarynowski, F. Hosseinpour, A. Jakobik,A. Stojnev Ilic, A. Respicio, D. Moldovan, C. Pop, and I. Salomie,Medical Data Processing and Analysis for Remote Health and ActivitiesMonitoring. Cham: Springer International Publishing, 2019, pp. 186–220. [Online]. Available: https://doi.org/10.1007/978-3-030-16272-6 7

[10] P. Czarnul, Parallel Programming for Modern High Performance Com-puting Systems. Chapman and Hall/CRC, 2018.

[11] S. Pllana and F. Xhafa, Programming Multicore and Many-core Com-puting Systems, 1st ed. Hoboken, New Jersey, USA: John Wiley &Sons, Inc., 2017.

[12] W. W. Smari, M. Bakhouya, S. Fiore, and G. Aloisio, “New advancesin high performance computing and simulation: parallel and distributedsystems, algorithms, and applications,” Concurrency and Computation:Practice and Experience, vol. 28, no. 7, pp. 2024–2030, 2016. [Online].Available: https://onlinelibrary.wiley.com/doi/abs/10.1002/cpe.3774

[13] S. Benkner, S. Pllana, J. L. Traff, P. Tsigas, U. Dolinsky, C. Augonnet,B. Bachmayer, C. Kessler, D. Moloney, and V. Osipov, “Peppher:Efficient and productive usage of hybrid computing systems,” IEEEMicro, vol. 31, no. 05, pp. 28–41, sep 2011.

[14] E. Abraham, C. Bekas, I. Brandic, S. Genaim, E. B. Johnsen, I. Kondov,S. Pllana, and A. Streit, “Preparing HPC Applications for Exascale:Challenges and Recommendations,” in 2015 18th International Confer-ence on Network-Based Information Systems, Sep. 2015, pp. 401–406.

[15] T. Ben-Nun and T. Hoefler, “Demystifying parallel anddistributed deep learning: An in-depth concurrency analy-sis,” CoRR, vol. abs/1802.09941, 2018. [Online]. Available:http://arxiv.org/abs/1802.09941

[16] A. Zlateski, K. Lee, and S. Seung, “Znn – a fast and scalable algorithmfor training 3d convolutional networks on multi-core and many-coreshared memory machines,” in 2016 IEEE International Parallel andDistributed Processing Symposium (IPDPS), May 2016, pp. 801–811.

[17] “TOP500 list,” www.top500.org/, Nov. 2018.[18] F. Yan, O. Ruwase, Y. He, and T. Chilimbi, “Performance modeling

and scalability optimization of distributed deep learning systems,”in Proceedings of the 21th ACM SIGKDD International Conference

on Knowledge Discovery and Data Mining, ser. KDD ’15. NewYork, NY, USA: ACM, 2015, pp. 1355–1364. [Online]. Available:http://doi.acm.org/10.1145/2783258.2783270

[19] Y. Oyama, A. Nomura, I. Sato, H. Nishimura, Y. Tamatsu, and S. Mat-suoka, “Predicting statistics of asynchronous sgd parameters for a large-scale distributed deep learning system on gpu supercomputers,” in 2016IEEE International Conference on Big Data (Big Data), Dec 2016, pp.66–75.

[20] S. Shi, Q. Wang, and X. Chu, “Performance modeling and evaluationof distributed deep learning frameworks on gpus,” in 2018 IEEE 16thIntl Conf on Dependable, Autonomic and Secure Computing, 16th IntlConf on Pervasive Intelligence and Computing, 4th Intl Conf on BigData Intelligence and Computing and Cyber Science and TechnologyCongress(DASC/PiCom/DataCom/CyberSciTech), Aug 2018, pp. 949–957.

[21] M. Song, Y. Hu, H. Chen, and T. Li, “Towards pervasive and user satis-factory cnn across gpu microarchitectures,” in 2017 IEEE InternationalSymposium on High Performance Computer Architecture (HPCA), Feb2017, pp. 1–12.

[22] D. Ciresan, “Simple C/C++ code for training and testing MLPs andCNNs,” http://people.idsia.ch/~ciresan/, [Online; accessed 11-February-2019].

[23] N. Andrew, N. Jiquan, F. Chuan Yu, M. Yifan, and S. Caroline, “Ufldltutorial on neural networks,” Ufldl Tutorial on Neural Networks, 2011.

[24] A. Gibansky, “Fully connected neural network algorithms,”http://andrew.gibiansky.com/blog/machine-learning/fully-connected-neural-networks/, [Online; accessed 21-March-2019].

[25] J. Schmidhuber, “Deep learning in neural networks: An overview,”Neural Networks, vol. 61, pp. 85–117, 2015.

[26] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner, “Gradient-based learningapplied to document recognition,” Proceedings of the IEEE, vol. 86,no. 11, pp. 2278–2324, 1998.

[27] Y. LeCun and C. Cortes, “Mnist handwritten digit database,” AT&T Labs[Online]. Available: http://yann. lecun. com/exdb/mnist, 2010.

[28] G. Chrysos, “Intel® Xeon Phi Coprocessor-the Architecture,” IntelWhitepaper, 2012. [Online]. Available: https://software.intel.com/en-us/articles/intel-xeon-phi-coprocessor-codename-knights-corner

[29] X. Tian, H. Saito, S. Preis, E. N. Garcia, S. Kozhukhov, M. Masten,A. G. Cherkasov, and N. Panchenko, “Practical SIMD VectorizationTechniques for Intel Xeon Phi Coprocessors,” in IPDPS Workshops.IEEE, 2013, pp. 1149–1158.

[30] S. Memeti, L. Li, S. Pllana, J. Kolodziej, and C. Kessler, “Benchmarkingopencl, openacc, openmp, and cuda: Programming productivity,performance, and energy consumption,” in Proceedings of the 2017Workshop on Adaptive Resource Management and Scheduling for CloudComputing, ser. ARMS-CC ’17. New York, NY, USA: ACM, 2017, pp.1–6. [Online]. Available: http://doi.acm.org/10.1145/3110355.3110356

[31] S. Pllana, S. Benkner, F. Xhafa, and L. Barolli, “Hybrid performancemodeling and prediction of large-scale computing systems,” in 2008International Conference on Complex, Intelligent and Software IntensiveSystems, March 2008, pp. 132–138.

[32] T. Fahringer, S. Pllana, and J. Testori, “Teuta: Tool support for perfor-mance modeling of distributed and parallel applications,” in Computa-tional Science - ICCS 2004, M. Bubak, G. D. van Albada, P. M. A. Sloot,and J. Dongarra, Eds. Berlin, Heidelberg: Springer Berlin Heidelberg,2004, pp. 456–463.

[33] H. Qi, E. R. Sparks, and A. S. Talwalkar, “Paleo: A performance modelfor deep neural networks,” in International Conference on LearningRepresentations (ICLR), 2017.

[34] Y. Ma, Y. Cao, S. Vrudhula, and J. sun Seo, “Performance modeling forcnn inference accelerators on fpga,” IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, pp. 1–1, 2019.

[35] S. Memeti and S. Pllana, “A machine learning approach foraccelerating DNA sequence analysis,” The International Journal ofHigh Performance Computing Applications, vol. 32, no. 3, pp. 363–379,2018. [Online]. Available: https://doi.org/10.1177/1094342016654214

[36] S. Memeti and S. Pllana, “Accelerating DNA Sequence Analysis UsingIntel(R) Xeon Phi(TM),” in 2015 IEEE Trustcom/BigDataSE/ISPA,vol. 3, Aug 2015, pp. 222–227.

[37] S. Memeti, S. Pllana, and J. Kołodziej, Optimal Worksharing ofDNA Sequence Analysis on Accelerated Platforms. Cham: SpringerInternational Publishing, 2016, pp. 279–309. [Online]. Available:https://doi.org/10.1007/978-3-319-44881-7 14