Skip to content

Commit

Permalink
doc: update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
fitchbe authored and Fomenko, Evarist M committed May 3, 2019
1 parent d4fc1ec commit 776c10f
Show file tree
Hide file tree
Showing 50 changed files with 4,437 additions and 1,492 deletions.
376 changes: 37 additions & 339 deletions README.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion cmake/Doxygen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ if(DOXYGEN_FOUND)
file(GLOB_RECURSE DOX
${PROJECT_SOURCE_DIR}/doc/*
)
file(GLOB_RECURSE EXAMPLES
${PROJECT_SOURCE_DIR}/examples/*
)
add_custom_command(
OUTPUT ${DOXYGEN_STAMP_FILE}
DEPENDS ${HEADERS} ${DOX}
DEPENDS ${HEADERS} ${DOX} ${EXAMPLES}
COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
COMMAND cmake -E touch ${DOXYGEN_STAMP_FILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
Expand Down
29 changes: 17 additions & 12 deletions doc/Doxyfile.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#===============================================================================
# Copyright 2016-2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -203,7 +202,7 @@ QT_AUTOBRIEF = NO
# not recognized any more.
# The default value is: NO.

MULTILINE_CPP_IS_BRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO

# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
# documentation from any documented member that it re-implements.
Expand Down Expand Up @@ -236,6 +235,8 @@ TAB_SIZE = 4

ALIASES =

ALIASES += img{3}="@htmlonly <style>div.image img[src=\"\1\"]{width:80%;\3}</style>@endhtmlonly\n@image html \1 \"\2\""

# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
Expand Down Expand Up @@ -412,7 +413,7 @@ LOOKUP_CACHE_SIZE = 0
# normally produced when WARNINGS is set to YES.
# The default value is: NO.

EXTRACT_ALL = YES
EXTRACT_ALL = NO

# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
# be included in the documentation.
Expand All @@ -438,7 +439,7 @@ EXTRACT_STATIC = NO
# for Java sources.
# The default value is: YES.

EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_CLASSES = NO

# This flag is only useful for Objective-C code. When set to YES local methods,
# which are defined in the implementation section but not in the interface are
Expand All @@ -463,15 +464,15 @@ EXTRACT_ANON_NSPACES = NO
# section is generated. This option has no effect if EXTRACT_ALL is enabled.
# The default value is: NO.

HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_MEMBERS = YES

# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy. If set
# to NO these classes will be included in the various overviews. This option has
# no effect if EXTRACT_ALL is enabled.
# The default value is: NO.

HIDE_UNDOC_CLASSES = NO
HIDE_UNDOC_CLASSES = YES

# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
# (class|struct|union) declarations. If set to NO these declarations will be
Expand Down Expand Up @@ -750,7 +751,8 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched.

INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include \
@CMAKE_CURRENT_SOURCE_DIR@/doc
@CMAKE_CURRENT_SOURCE_DIR@/doc \
@CMAKE_CURRENT_SOURCE_DIR@/examples

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand All @@ -772,6 +774,8 @@ INPUT_ENCODING = UTF-8

FILE_PATTERNS = *.h \
*.hpp \
*.c \
*.cpp \
*.md

# The RECURSIVE tag can be used to specify whether or not subdirectories should
Expand Down Expand Up @@ -820,14 +824,15 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).

EXAMPLE_PATH =
EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/examples

# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank all
# files are included.

EXAMPLE_PATTERNS =
EXAMPLE_PATTERNS = *.c \
*.cpp

# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude commands
Expand Down Expand Up @@ -1416,7 +1421,7 @@ FORMULA_TRANSPARENT = YES
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

USE_MATHJAX = NO
USE_MATHJAX = YES

# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
Expand All @@ -1439,7 +1444,7 @@ MATHJAX_FORMAT = HTML-CSS
# The default value is: http://cdn.mathjax.org/mathjax/latest.
# This tag requires that the tag USE_MATHJAX is set to YES.

MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/

# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example
Expand Down Expand Up @@ -1601,7 +1606,7 @@ PAPER_TYPE = a4
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.

EXTRA_PACKAGES =
EXTRA_PACKAGES = amsmath

# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
Expand Down
93 changes: 93 additions & 0 deletions doc/build/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Build from Source {#dev_guide_build}
====================================

## Download the Source Code

Download [Intel MKL-DNN source code](https://github.com/intel/mkl-dnn/archive/master.zip)
or clone [the repository](https://github.com/intel/mkl-dnn.git).

~~~sh
git clone https://github.com/intel/mkl-dnn.git
~~~

## Build the Library

Ensure that all software dependencies are in place and have at least the
minimal supported version.

The Intel MKL-DNN build system is based on CMake. Use

- `CMAKE_INSTALL_PREFIX` to control the library installation location,

- `CMAKE_BUILD_TYPE` to select between build type (`Release`, `Debug`,
`RelWithDebInfo`).

See @ref dev_guide_build_options for detailed description of build-time
configuration options.

### Linux/macOS

- Generate makefile
~~~sh
mkdir -p build && cd build && cmake ..
~~~

- Build the library
~~~sh
make -j
~~~

- Build the documentation
~~~sh
make doc
~~~

- Install the library, headers, and documentation:
~~~sh
make install
~~~

### Windows

- Generate a Microsoft Visual Studio solution:
~~~bat
mkdir build && cd build && cmake -G "Visual Studio 15 2017 Win64" ..
~~~
For the solution to use the Intel C++ Compiler, select the corresponding
toolchain using the cmake `-T` switch:
~~~bat
cmake -G "Visual Studio 15 2017 Win64" -T "Intel C++ Compiler 19.0" ..
~~~

- Build the library
~~~bat
cmake --build .
~~~
You can also use the `msbuild` command-line tool directly (here
`/p:Configuration` selects the build configuration which can be different from
the one specified in `CMAKE_BUILD_TYPE`, and `/m` enables a parallel build):
~~~bat
msbuild "Intel(R) MKL-DNN.sln" /p:Configuration=Release /m
~~~

- Build the documentation
~~~bat
cmake --build . --target DOC
~~~

- Install the library, headers, and documentation:
~~~bat
cmake --build . --target INSTALL
~~~

## Validate the Build

Run unit tests:

~~~sh
ctest
~~~

--------

[Legal information](@ref legal_information)
145 changes: 145 additions & 0 deletions doc/build/build_options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
Build Options {#dev_guide_build_options}
====================================

## Configuring the Build

Intel MKL-DNN supports the following build-time options.

| Option | Supported values (defaults in bold) | Description
| :--- | :--- | :---
| MKLDNN_LIBRARY_TYPE | **SHARED**, STATIC | Defines the resulting library type
| MKLDNN_THREADING | **OMP**, OMP:INTEL, OMP:COMP, TBB | Defines the threading type
| MKLDNN_USE_MKL | **DEF**, NONE, ML, FULL, FULL:STATIC | Defines the binary dependency on Intel MKL
| MKLDNN_GPU_BACKEND | **NONE**, OPENCL | Defines the backend for GPU engine
| MKLDNN_BUILD_EXAMPLES | **ON**, OFF | Controls building the examples
| MKLDNN_BUILD_TESTS | **ON**, OFF | Controls building the tests
| MKLDNN_ARCH_OPT_FLAGS | *compiler flags* | Specifies compiler optimization flags (see warning note below)
| MKLDNN_ENABLE_JIT_PROFILING | **ON**, OFF | Enables integration with Intel(R) VTune(TM) Amplifier

## Targeting Specific Architecture

Intel MKL-DNN uses JIT code generation to implement most of its functionality
and will choose the best code based on detected processor features. However,
some Intel MKL-DNN functionality will still benefit from targeting a specific
processor architecture at build time. You can use `MKLDNN_ARCH_OPT_FLAGS` CMake
option for this.

For Intel(R) C++ Compilers, the default option is `-xHOST`, which instructs
the compiler to generate the code for the architecture of the processor where
the build is occurring. This option would not allow you to run the library on
older processor architectures.

For GNU\* Compiler 5.0 and newer, the default options are `-march=native
-mtune=native`.

@warning
While use of `MKLDNN_ARCH_OPT_FLAGS` option gives better performance, the
resulting library can be run only on systems that have instruction set
compatible with the target instruction set. Therefore, `ARCH_OPT_FLAGS`
should be set to an empty string (`""`) if the resulting library needs to be
portable.

## GPU support (experimental)

To enable GPU support in Intel MKL-DNN you need to specify the GPU backend
to use. Currently the only supported one is implemented using OpenCL\* and
requires Intel(R) SDK for OpenCL\* applications. You can explicitly specify
the pass to the SDK using `-DOPENCLROOT` cmake option.

~~~sh
cmake -DMKLDNN_GPU_BACKEND=OPENCL -DOPENCLROOT=/path/to/opencl/sdk ..
~~~

## Threading

Intel MKL-DNN can use the OpenMP or TBB threading runtimes. OpenMP threading
is the default build mode and is recommended for the best performance. TBB
support is experimental. This behavior is controlled by the `MKLDNN_THREADING`
CMake option.

### OpenMP

Intel MKL-DNN can use the Intel, GNU, or Clang OpenMP runtimes. Because
different OpenMP runtimes may not be binary-compatible, it's important to
ensure that only one OpenMP runtime is used throughout the application. Having
more than one OpenMP runtime linked to an executable may lead to undefined
behavior including incorrect results or crashes.

The Intel MKL-DNN library linked with Intel MKL (full or small libraries
version) link to the Intel OpenMP runtime included with the Intel MKL. The
Intel OpenMP runtime is binary compatible with the GNU OpenMP and Clang OpenMP
runtimes and is recommended for the best performance results.

If Intel MKL-DNN library is built standalone, it will link to the OpenMP
library supplied by the compiler. This means that there would be no conflicts
as long as both the library and the application use the same or compatible
compilers.

### TBB

TBB support is experimental.

To build Intel MKL-DNN with TBB support, set the `TBBROOT` environmental
variable to point to the TBB installation path or pass the path directly to
cmake:

~~~sh
$ cmake -DTBBROOT=/opt/intel/path/tbb ..
~~~

Intel MKL-DNN has limited optimizations for Intel TBB and has some functional
limitations if built with Intel TBB.

Functional limitations:
* Winograd convolution algorithm is not supported.

The following primitives have lower performance compared to OpenMP (mostly due
to limited parallelism):
* Batch normalization,
* Convolution backward by weights,
* Inner product,
* `mkldnn_*gemm()`.

## Linking to Intel(R) MKL

Intel MKL-DNN can be configured to use Intel MKL via the `MKLDNN_USE_MKL`
CMake option. Using Intel MKL may improve performance on older platforms not
supported by the matrix-matrix multiplication routine implemented in Intel
MKL-DNN itself.

If you choose to build Intel MKL-DNN with the binary dependency, download the
Intel MKL small libraries using the provided script:

* Linux/macOS
~~~sh
cd scripts && ./prepare_mkl.sh && cd ..
~~~

* Windows
~~~bat
cd scripts && call prepare_mkl.bat && cd ..
~~~

You can also download the small libraries from
[GitHub release section](https://github.com/intel/mkl-dnn/releases). You need
to unpack the archive in the `external` directory of the repository root or
set `MKLROOT` environment variable to point to the installation location of
the small libraries of full Intel MKL library.

@note
Intel MKL small libraries are currently only compatible with OpenMP threading.
You need the full Intel MKL library to use Intel MKL and TBB threading. Using
Intel MKL or Intel MKL small libraries will introduce additional runtime
dependencies. For additional information, refer to the Intel MKL
[system requirements](https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-2019-system-requirements).

@warning
If the library is built with TBB threading, the user is expected to set the
`MKL_THREADING_LAYER` environment variable to either `tbb` or `sequential` in
order to force Intel MKL to use Intel TBB for parallelization or to be
sequential, respectively. Without this setting, Intel MKL (the `mkl_rt`
library) uses the OpenMP threading by default.

--------

[Legal information](@ref legal_information)
Loading

0 comments on commit 776c10f

Please sign in to comment.