I've seen a lot of documentation about making using of a CPU with tensorflow, however, I don't have a GPU. What I do have is a fairly capable CPU and a holing 5GB of intel math kernel, which, I hope, might help me speed up tensorflow a fair bit.
Does anyone know how I can "make" tensorflow use the intel-mlk ?
At pretty much each new release of TensorFlow, the MKL build is broken on various platforms and it requires some gymnastics on our side to get it work again (if we are even able to). We did not investigated much on the reasons why but performances with MKL were many times worst than without it.
Intel Math Kernel Library (MKL) Intel MKL is free to use in any commercial and academic purposes.
Tensorflow uses CUDA which means only NVIDIA GPUs are supported. For OpenCL support, you can track the progress here. BTW, Intel/AMD CPUs are supported.
To load the default MKL, run the following command: module load mkl . To load a particular version, use module load mkl/version . For example, use module load mkl/11.3. 3 to load MKL version 11.3.
Build TensorFlow 1.2 from source and during the configuration step enable the support of MKL.
As of Dec. 2017, MKL only works on Linux. See https://tensorflow.org/performance/performance_guide#optimizing_for_cpu
Note: MKL was added as of TensorFlow 1.2 and currently only works on Linux. It also does not work when also using --config=cuda.
Since tensorflow uses Eigen, try to use an MKL enabled version of Eigen as described here:
- define the EIGEN_USE_MKL_ALL macro before including any Eigen's header
- link your program to MKL libraries (see the MKL linking advisor)
- on a 64bits system, you must use the LP64 interface (not the ILP64 one)
So one way to do it is to follow the above steps to modify the source of tensorflow, recompile and install on your machine. While you're at it you should also try the Intel compiler, which might provide a decent performance boost by itself, if you set the correct flags: -O3 -xHost -ipo
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With