Skip to content

CNTK Library Evaluation on Linux

marhamil723 edited this page Apr 28, 2017 · 20 revisions

The CNTK Library on Linux is provided as C++ and Python library.

Using C++

The usage pattern on Linux is the same as that on Windows.

The evaluation library, libCntk.Core, can be found under cntk/lib in the CNTK binary package. If you build CNTK from source code, the libCntk.Core is available in the lib folder of the build directory.

Any program using the evaluation library needs to link the libraries libCntk.Core and libCntk.Math, e.g.

-lCntk.Core-<VERSION> -lCntk.Math-<VERSION>

, and set the appropriate search path for these libraries. Please use the same build flavor (Debug/Release) and the same compiler version as the one used to create the libraries. The Examples/Evaluation/CNTKLibraryCPPEvalCPUOnlyExamples and Examples/Evaluation/CNTKLibraryCPPEvalGPUExamples in the CNTK source code illustrates the usage pattern in Linux. The Makefile contains the target CNTKLIBRARY_CPP_EVAL_EXAMPLES showing how to build the example.

For details on the CNTK Library for evaluation, please refer to the CNTK Library C++ Evaluation Interface page in this wiki.

Using Python

You can use Python to evaluate a pre-trained model. Examples can be found here.

Using Java

  • This API is still experimental and subject to change.

  • The JavaEvalTest contains an example Java project that evaluates a CNN using the Java API.

  • To run the java tests use the following command: python Tests/EndToEndTests/TestDriver.py run -f debug -s cpu -t nightly EvalClientTests/JavaEvalTest Change the debug and cpu flags as necessary for your testing worflow.

  • If you are using the bindings in your java project, add the cntk.jar file - If you are using the bindings in your java project, add the cntk.jar file to the classpath. If you are working with an IDE you should add this as an unmanaged jar. The cntk.jar file can be found in the distributed CNTK binaries. You can also build cntk.jar from code base by yourself. In this case, it can be found in the "java" folder of CNTK's output directory.

  • The install-cntk.sh script sets the LD_LIBRARY_PATH environment variable to the output directory of the build. If you get UnsatisfiedLinkErrors in Java, it is typically because the output directory is not on the LD_LIBRARY_PATH (or in the wrong order).

  • The Java bindings have been tested using 64-bit OpenJDK 7.

Clone this wiki locally