Welcome back to the oneAPI channel.​
In the previous video, video number 10, we talked about oneDNN , ​
oneAPI Deep Neural Network Library
We have seen that you can get the oneDNN binaries in the oneAPI base toolkit
And of course, on git-hub..​ Just google git oneDNN​
And you can find here the source code​ For example, for CPU​
For example, on x64 architecture​ And you can find here the actual implementation
of the library functions or primitives..​ You can also find here, under examples, tutorials
and code snippets.. ​ A great way to learn…​
The easiest way to try it out, maybe even on a new HW from Intel, is using the dev-cloud​
Google it, apply, it only take few clicks..​
Once you get the email with the link,​ You have a full access, you can just
open a linux terminal and you start running the benchmark on the samples..​
No need to install anything, you are all set.. Just start coding..​
Another way is to browse to the oneAPI-Samples/ libraries / oneDNN / tutorials ​
And you can open a jupyter notebook for say, the getting started tutorial..​
And just follow the instructions to get the content, and run the samples step by step
Maybe the best way to introduce you to the programming model is by an example..​
So, let’s build an implementation step by step.​
The first thing we need is a structure for the input and the output,​
A memory type will define them
In many cases we need also the weights as an input data
And here is the actual operation, ​ A primitive is a real mathematical
or logical function to execute​
We can create it, hopefully only once to save the overhead​
and then execute it as many time as needed and then destroy it
using post-ops you can concatenate or fuse
certain operations and by that, obviously can boost the performance.
To form what is call a Stream And this stream is working on an engine
An engine is the device that execute the stream​
It could be an intel CPU, an nVidia GPU or many others..
Let’s look at the getting started sample..​ We are using DNNL namespace​
First, we define the Engine.. The target device
Then we define the stream, that will run on my engine..​
Here is the memory description, the data layout, format and so on..
And we use this format to define the Input output and if needed the weights,,​
Now we have the memory structures in place ​ We are performing a RELU operation so there is
no really need in weights.. ​ For this example..​
And we even write the input data to the source, ​ here it’s an image
And now comes the operation itself.​
We define a RELU operation.​ And a relu primitive descriptor,​
which is an actual implementation of Relu to a specific engine.. Specific target device
And we create the primitive ​ And execute the stream,
which here has only one primitive, but can hold many
Now we just need to wait for the stream to finish the execution ​
and then read the results into the output buffer
oneDNN has much more to offer, you can read all about it in the documentation​
For example, the connection to vTune analyzer..​
vTune automatically detect the JIT code of oneDNN, it can recognize the primitives, ​
and provide you all the statistics you need to trace and debug the performance..
We have seen the oneDNN programming model and concepts​
We have seen where to get the code, ​ and we have explored the getting started sample.​
You can communicate with the design team on git-hub,
ask questions, request enhancements or provide feedback.​
and you can follow these links for further information,​
Good luck