-
Notifications
You must be signed in to change notification settings - Fork 4.3k
CNTK 2.0 Setup
This page will walk through the manual installation steps for binary install one component at a time. This is intended for those users who want to have a customized installation.
If you are a developer intending to contribute to CNTK please follow the instructions to build from sources
This section is for those individuals who want deploy CNTK V2 binary package following manual steps of Windows and Linux.
[Note: If you previously installed an earlier version of the CNTK 2.0 Python pip package, you can jump to step 3 to update existing CNTK 2.0 package installation from your Python 3.4 environment]
Step 1: Install pre-requisites
CNTK V2 on windows requires the following prerequisites to be installed on your system. Please install them from the links below:
-
Microsoft MPI of version 7 (7.0.12437.6). Note, that you need run-time (file
MSMpiSetup.exe
) and not SDK. We strongly suggest using version 7 (7.0.12437.6). Using Version 7.1 or any other versions may result in errors -
For GPU systems ensure that you have the latest NVIDIA driver
Step 2: Python setup
-
If you do not have Anaconda environment: install Anaconda Python for Windows
-
If you already have existing Anaconda env or after your have installed the environment above: Create a conda environment, activate the
cntk-py34
environment, update the pip version by running the following commands from the anaconda / windows shell
conda create --name cntk-py34 python=3.4.3 numpy scipy jupyter matplotlib
activate cntk-py34
python -m pip install --upgrade pip**
Step 3: Install CNTK (TODO: UPDATE THE PATHS)
Python
-
Choose a wheel file suitable for your machine pick wheel from local drop
-
From the anaconda / windows shell run:
pip install --upgrade <Location of wheel file>
Brainscript (optional)
-
Download the required binary package from CNTK Releases page and extract it to your machine.
-
From Windows cmd prompt run:
set PATH=%PATH%;[binary folder]\cntk\cntk
Step 4: Download the examples and tutorials
-
Install GIT
-
Clone the CNTK repository (we assume
c:\repos\CNTK
as the repository root) to get the python examples and tutorials and include examples directory inPYTHONPATH
by running:
git clone --recursive https://github.com/Microsoft/CNTK/
cd c:\repos\cntk
git checkout v2.alpha4 # TODO update
setx PYTHONPATH [CNTK repo root]\bindings\python\examples;%PYTHONPATH%
Step 5: Verify setup
Python
Run the examples from inside the [CNTK clone root]/bindings/python
directory, to verify your installation. Run python examples/NumpyInterop/feedforwardNet.py
. You should following output on the console:
Minibatch: 0, Train Loss: 0.7915553283691407, Train Evaluation Criterion: 0.48
Minibatch: 20, Train Loss: 0.6266774368286133, Train Evaluation Criterion: 0.48
Minibatch: 40, Train Loss: 1.0378565979003906, Train Evaluation Criterion: 0.64
Minibatch: 60, Train Loss: 0.6558118438720704, Train Evaluation Criterion: 0.56
Brainscript (optional)
Please run the following self contained example:
cd C:\repos\CNTK\Examples\Other\Simple2d
CNTK configFile=Config/Simple.cntk currentDirectory=Data
You should be able to see the results getting printed on the console.
[Note: If you previously installed an earlier version of the CNTK 2.0 Python pip package, you can skip steps 1 through 3 below and directly jump to step 4 to update your existing CNTK 2.0 package installation from your Python 3.4 environment]
Step 1: Download and install pre-requisites
Docker users please follow the instructions here. Others please continue reading.
CNTK V2 on Linux requires the following prerequisites to be installed from the links below:
- C++ Compiler
- Open MPI IMPORTANT! We strongly recommend to follow Open MPI installation procedure described by the link above to ensure the correct work of CNTK.
- For GPU systems ensure that you have the latest NVIDIA driver
Step 2: Python setup
-
If you do not have Anaconda environment: install Anaconda Python 3.5 for Linux
-
If you already have existing Anaconda env or after your have installed the environment above, create a conda environment, upgrade the pip package by running (if needed under elevated command prompt)
conda create --name cntk-py34 python=3.4.3 numpy scipy jupyter matplotlib
activate cntk-py34
python -m pip install --upgrade pip
Note: Make sure that this Python version above is what you use for the remainder of the instructions.]
Step 3: Install CNTK2.0 (TODO: UPDATE THE PATHS)
Python
-
Choose a wheel file suitable for your machine # TODO pick from local wheel
-
Run
pip install --upgrade <Location of wheel file>
Brainscript
- Set the following environment variables (we assume that the CNTK archive is extracted to
/home/username/cntkbin
):
# TODO make sure: if openmpi built yourself, add to LD_LIBRARY_PATH (.../openmpi-1.10.3/lib)
export PATH=/home/username/cntkbin/cntk/bin:$PATH
export LD_LIBRARY_PATH=/home/username/cntkbin/cntk/lib:/home/username/cntkbin/cntk/dependencies/lib:$LD_LIBRARY_PATH
Step 4: Download the examples and tutorials
-
Install GIT
-
Clone the CNTK repository (we assume
c:\repos\CNTK
as the repository root) to get the python examples and tutorials and include examples directory inPYTHONPATH
by running:
git clone --recursive https://github.com/Microsoft/CNTK/
cd $HOME/[USERNAME]/repos/cntk
git checkout v2.alpha4 # TODO update
export PYTHONPATH=$PWD/bindings/python:$PYTHONPATH
Step 5: Verify setup
Python
- Run the examples from inside the
[CNTK clone root]/bindings/python
directory, to verify your installation. Runpython examples/NumpyInterop/feedforwardNet.py
. You should following output on the console:
Minibatch: 0, Train Loss: 0.7915553283691407, Train Evaluation Criterion: 0.48
Minibatch: 20, Train Loss: 0.6266774368286133, Train Evaluation Criterion: 0.48
Minibatch: 40, Train Loss: 1.0378565979003906, Train Evaluation Criterion: 0.64
Minibatch: 60, Train Loss: 0.6558118438720704, Train Evaluation Criterion: 0.56
- Additional test (Optional): You may run the Python test included in the CNTK module
pip install pytest
python -c "import cntk, os; print(os.path.dirname(os.path.abspath(cntk.__file__)))"
pytest [the directory output by the previous command]
Brainscript (optional)
- Please run the following self contained example:
cd /home/username/repos/CNTK/Examples/Other/Simple2d
cntk configFile=Config/Simple.cntk currentDirectory=Data
You should be able to see the results getting printed on the console.