CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Using MKL with cntk

Open rashee182 opened this issue 10 years ago • 14 comments

I have installed the MKL lib and set the preprocessor definition USE_MKL in the Math project. When I compile Math prj, I am seeing these errors related to missing cuda and acml headers: error C1083: Cannot open include file: 'cuda_runtime_api.h': No such file or directory \Source\Repos\cntk\Source\Math\CUDAPageLockedMemAllocator.cpp 5 1 Math

error C1083: Cannot open include file: 'cuda.h': No such file or directory (MatrixQuantizerCPU.cpp) \source\repos\cntk\source\math\ValueQuantizer.h 8 1 Math

error C1083: Cannot open include file: 'acml.h': No such file or directory \Source\Repos\cntk\Source\Math\CPUSparseMatrix.cpp 33 1 Math

Are there any more dependencies which I am missing. Understanding was that CUDA or ACML is not needed when using MKL. I am building for CPU only config

rashee182 avatar Jun 03 '16 23:06 rashee182

I would recommend to install ACML instead of MKL, it's the mainstream meanwhile. See #447.

quicktrick avatar Jun 04 '16 06:06 quicktrick

Thanks for referring to this post ! Actually I have to use MKL. I will try what some other users have suggested here

rashee182 avatar Jun 08 '16 00:06 rashee182

We will update CNTK in the very soon to make it easier to build with MKL I would guess this will become available next week in the master branch We will distribute custom MKL libraries for use with CNTK, so you won't need to install the complete MKL kit. You will than be able to switch between building with ACML or MKL custom libraries by changing an environment setting

In the mid-term we plan to deprecate ACML and make MKL-custom-libraries the default

thx Wolfgang

wolfma61 avatar Jun 09 '16 22:06 wolfma61

Thanks. Please keep us updated on the check ins. If I want to use an updated version of MKL, is installing the updates sufficient or it requires changes to cntk (source/config) as well.

rashee182 avatar Jun 10 '16 00:06 rashee182

We are supplying a custom library for you to use with the CNTK source code (https://software.intel.com/en-us/node/528362). this is all you need, so no MKL SDK necessary

If you want extend the usage of MKL or use a different version of the MKL SDK, you should be able to build your own version of the custom library with your version of the MKL SDK (it is a pretty straight forward process, we will supply our scripts as a blueprint) and you build CNTK with that version. This should be possible with very minimal changes to the build config (couple of lines)

Give it a try next week and give us feedback. I hope it will make your life easier ....

wolfma61 avatar Jun 10 '16 01:06 wolfma61

Thanks, will try this. I am looking for some answers related to resnet usage with cntk : https://github.com/Microsoft/CNTK/issues/522

Can you help me with this.

rashee182 avatar Jun 14 '16 01:06 rashee182

@rashee182, @quicktrick - Today we've merged the updated CNTK MKL support based on a CNTK custom MKL into master. Please give it a go, if you want. Updated set up instructions are provided here, specifically in the section on "MKL": https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-Windows https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-Linux Hope this helps,

Mark

mahilleb-msft avatar Jun 15 '16 16:06 mahilleb-msft

@mahilleb-msft I pulled in the master branch today and downloaded CNTKCustomMKL-Windows-1.zip. Following the build instructions here : https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-Windows Still it seems that the prj files need some updates since I am seeing errors like 2>CPUSparseMatrix.cpp(33): fatal error C1083: Cannot open include file: 'acml.h': No such file or directory 2>CPUMatrix.cpp(44): fatal error C1083: Cannot open include file: 'acml.h': No such file or directory

Looks like USE_ACML is still defined in these files.

rashee182 avatar Jun 23 '16 17:06 rashee182

@rashee182 - can you double-check that the ACML_PATH environment variable is not set (and Visual Studio doesn't see it, i.e., possibly sign-out and sign-in again)?

mahilleb-msft avatar Jun 23 '16 17:06 mahilleb-msft

@mahilleb-msft - There was one stale copy of ACML_PATH which I removed. Also removed ACML_FMA. Now I am able to build. Thanks :)

rashee182 avatar Jun 23 '16 18:06 rashee182

Glad to hear this! Closing...

Best, Mark

mahilleb-msft avatar Jun 23 '16 18:06 mahilleb-msft

@mahilleb-msft - Are there any plans to release a CNTK custom MKL which is based on AVX 512

rashee182 avatar Jun 24 '16 21:06 rashee182

@mahilleb-msft : Going through some previous comments on this issue "If you want extend the usage of MKL or use a different version of the MKL SDK, you should be able to build your own version of the custom library with your version of the MKL SDK (it is a pretty straight forward process, we will supply our scripts as a blueprint) and you build CNTK with that version. This should be possible with very minimal changes to the build config (couple of lines)"

Can you provide directions on how to build the custom CNTK MKL lib using a different version of MKL SDK

rashee182 avatar Jul 29 '16 01:07 rashee182

@rashee182 - can you check out the files and README here: https://github.com/Microsoft/CNTK/tree/master/Dependencies/CNTKCustomMKL If there are additional questions or problems, please open a new issue...

Thanks, Mark

mahilleb-msft avatar Jul 29 '16 06:07 mahilleb-msft