Mac OS Install with GPU support or MKLDNN does not work


I have a MacPro 10.13.6 and I am following the instructions at
After having performed Prepare Environment for GPU Installation I was able to build following these instructions:

    git clone --recursive ~/mxnet
    cd ~/mxnet
    cp make/ ./
    echo "USE_BLAS = openblas" >> ./
    echo "ADD_CFLAGS += -I/usr/local/opt/openblas/include" >> ./
    echo "ADD_LDFLAGS += -L/usr/local/opt/openblas/lib" >> ./
    echo "ADD_LDFLAGS += -L/usr/local/lib/graphviz/" >> ./
    make -j$(sysctl -n hw.ncpu)

but if I add to my the options for GPU support:

    echo "USE_CUDA = 1" >> ./
    echo "USE_CUDA_PATH = /usr/local/cuda" >> ./
    echo "USE_CUDNN = 1" >> ./
    make -j$(sysctl -n hw.ncpu)

then nvcc fails with:

nvcc fatal : The version ('10.0') of the host compiler ('Apple clang') is not supported

even though clang from the llvm package is in the path:

which clang

my in this case has the following settings:

USE_BLAS = openblas
ADD_CFLAGS += -I/usr/local/opt/openblas/include
ADD_LDFLAGS += -L/usr/local/opt/openblas/lib
ADD_LDFLAGS += -L/usr/local/lib/graphviz/
USE_CUDA_PATH = /usr/local/cuda

Am I trying to combine incompatible options?

If I try to build with MKLDNN I get the following problem:

CMake Error at /usr/local/Cellar/cmake/3.12.1/share/cmake/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler


  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/SB/Software/mxnet/3rdparty/mkldnn/build/CMakeFiles/CMakeTmp
    Run Build Command:"/usr/bin/make" "cmTC_2a162/fast"
    /Applications/ -f CMakeFiles/cmTC_2a162.dir/build.make CMakeFiles/cmTC_2a162.dir/build
    Building C object CMakeFiles/cmTC_2a162.dir/testCCompiler.c.o
    /usr/local/opt/llvm/bin/clang++    -o CMakeFiles/cmTC_2a162.dir/testCCompiler.c.o   -c /Users/SB/Software/mxnet/3rdparty/mkldnn/build/CMakeFiles/CMakeTmp/testCCompiler.c
    clang-7: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
    /Users/SB/Software/mxnet/3rdparty/mkldnn/build/CMakeFiles/CMakeTmp/testCCompiler.c:2:3: error: "The CMAKE_C_COMPILER is set to a C++ compiler"
    # error "The CMAKE_C_COMPILER is set to a C++ compiler"
    1 error generated.
    make[2]: *** [CMakeFiles/cmTC_2a162.dir/testCCompiler.c.o] Error 1
    make[1]: *** [cmTC_2a162/fast] Error 2
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:51 (project)

-- Configuring incomplete, errors occurred!

This looks trivial, but a few things (such as forcing -xc for clang++) I tried did not work.

my in this case has the following settings:


What are the correct steps to install with MKLDNN?
Also, some indications about the preferred installation options would be appreciated, I had a look at the FAQ but did not seem to find installation questions.



Hi Stefano,

For installing mxnet with mkldnn on cpu, have you tried installing with pip? i.e

pip install mxnet-mkl

Also you seem to be trying to install with GPU support on your mac. This won’t work as you need a machine with nvidia gpu and cuda/cudnn libraries installed.

Hi sad,

Thanks for your reply, you are right about the GPU, for some reason I thought I had an NVIDIA GPU but it is not true.

In any case, I think that the compilation for MKLDNN should work.

I am working with R and I have installed now mxnet in R, but the version without MKLDNN. I am not (yet) using Python, so I am not sure whether pip install mxnet-mkl would be useful for me, right?


Yes you’re correct. pip install is for the python package not the R package. I had assumed you were using python. Yes the compilation for MKLDNN should work when you build from source as well.