1/27/2016

First Try at Microsoft CNTK Installation on Windows plus (GPUs are coming to Azure)

Saw a post today on Twitter, "Microsoft releases CNTK, its open source deep learning toolkit, on GitHub"

This is big news.  Because now anybody can download an application to run Neural Networks on their own machines.  On Windows operating systems:




So let's get started.

Windows Visual Studio setup

Create or logon to Github, then go to this link.

Download and unzip from the release page to the folder where you want to install CNTK.

Click on the "Download Zip" button:



File downloads:



And the extracted files:



If Visual C++ Redistributable for Visual Studio 2013 is not installed on your computer, install it from http://www.microsoft.com/en-us/download/details.aspx?id=40784.

Download (x86 or 64) and run:








For the GPU built version, ensure the latest NVIDIA driver is installed for your CUDA-enabled GPU.

You do not need to install the CUDA SDK, though it would be fine if you do so now or in the future.

Install Microsoft MS-MPI SDK and runtime from https://msdn.microsoft.com/en-us/library/bb524831(v=vs.85).aspx

https://www.microsoft.com/en-us/download/details.aspx?id=49926 



Install Cuda 7.0 from the Nvidia website.


https://developer.nvidia.com/cuda-toolkit-70
Download NVidia CUB from GitHub ...
https://github.com/NVlabs/cub/archive/1.4.1.zip
 
 
Install NVIDIA CUDA Deep Neural Network library (cuDNN) by downloading the Windows version of cuDNN v4 using the following link. Unzip the file to a folder, e.g. c:\NVIDIA\cudnn-4.0 and set environment variable CUDNN_PATH to the cuDNN cuda directory, for example:
CUDNN_PATH=C:\NVIDIA\cudnn-4.0\cuda 

CUB_PATH=c:\src\cub-1.4.1 
CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0
 
Install Boost, We are using the Boost library (http://www.boost.org/) for unit tests. We are probably going to incorporate the Boost library into CNTK code in the future. Download and install boost version 1.59 (you need msvc-12.0 binaries) from Sourceforge.
Set the environment variable BOOST_INCLUDE PATH to your boost installation, e.g.:
BOOST_INCLUDE_PATH=c:\local\boost_1_59_0
Set the environment variable BOOST_LIB_PATH to the boost libraries, e.g.:
BOOST_LIB_PATH=c:\local\boost_1_59_0\lib64-msvc-12.0
To integrate Boost into the Visual Studio Test Framework you can install a runner for Boost tests in VS from the VisualStudio Gallery.

Downloaded 1.59 Binaries from here: http://sourceforge.net/projects/boost/files/boost-binaries/1.59.0/


Next, Install ACML 5.3.1 or above (make sure to pick the ifort64_mp variant, e.g., acml5.3.1-ifort64.exe) from the AMD website.

http://developer.amd.com/tools-and-sdks/archive/amd-core-math-library-acml/acml-downloads-resources/#download

Set the environment variable ACML_PATH, to the folder you installed the library to, e.g.
ACML_PATH=C:\AMD\acml5.3.1\ifort64_mp 
 
Set the environment variables:

ACML_FMA=0
CUDNN_PATH=C:\NVIDIA\cudnn-4.0\cuda 
CUB_PATH=c:\src\cub-1.4.1 
CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0
BOOST_INCLUDE_PATH=c:\local\boost_1_59_0
BOOST_LIB_PATH=c:\local\boost_1_59_0\lib64-msvc-12.0
ACML_PATH=C:\AMD\acml5.3.1\ifort64_mp


Next, MKL. (didn't install)

An alternative to the ACML library are the Intel MKL libraries.
To use MKL you have to define USE_MKL in the CNTKMath project. MKL is faster and more reliable on Intel chips, but it might requires a license.

Next, Install the latest Microsoft MS-MPI SDK (version 7 or later) and runtime from Microsoft Developer Network.


Next, If you want to use ImageReader, install OpenCV v3.0.0. Download and install OpenCV v3.0.0 for Windows from OpenCV-Org.
Set environment variable OPENCV_PATH to the OpenCV build folder, e.g.
C:\src\opencv\build


At this point, all files were downloaded off the web:



Installed, and set the environment variables.  

Opened the solution in Visual Studio 2013, performed a "Build", it ran for a long time:

At that point, one of the projects did not load in Visual Studio 2013.  

Troubleshot, turns out the Cuda install did not complete successfully.  

So I re-downloaded the cuda_7.0.28_windows_network file and performed a reinstall.

At that point, all the projects loaded correctly in Visual Studio 2013:


Next, attempt a "Build" on the entire Solution:



Successful build!   

Overall, it took several hours to bring down the install files, set the variables, etc.

Will try to run one of the example demo's next.  This is not easy stuff, involves understanding of advanced math, statistics, as well as real world machine learning.  As well as deep learning.  And Neural Networks.  And Artificial Neural Networks.  And NN with short long term memory.

Scanning images, pattern recognition, speech detection. 
Self learning Neural Nets. 
A lot different than writing standard SQL.  But that's what makes it great.  A challenge indeed.

In the meantime, here's a video indicating GPU technology will be on the Microsoft Azure platform at some time in the future:

https://azure.microsoft.com/en-us/documentation/videos/azurecon-2015-applications-that-scale-using-gpu-compute/

Tutorial Linkhttp://research.microsoft.com/en-us/um/people/dongyu/CNTK-Tutorial-NIPS2015.pdf

 Good stuff~!
 

Get Sh#t Done!