How to build latest MXNet from source on Mac without GPU

I am struggling to do an initial build of the project from source on my Mac.

Instructions found in https://mxnet.apache.org/versions/1.6/get_started/osx_setup no longer work with the latest source as it looks like all the .mk fies were removed from source and build is done via cmake.

Instruction in https://mxnet.apache.org/versions/1.6/get_started/build_from_source suggest looking at the location of .cmake files under config in source for instructions but there is not much instructions in there.

I installed all the dependencies as instructed but running cmake .. fails with Could not find nvcc, please set CUDAToolkit_ROOT. I don’t have nvcc installed, can i still build? What would be the right build configuration to use?

As you can probably tell, I am no expert in this but hoping to learn more C++ by contributing, this seems like a right project to me as I’m already heavily using MXNet it as an end user.

Thanks

Hi,
I am just learning now to do that on Linux.
I think your best chance is to compile with cmake, and try both files in master branch:

config/distribution/darwin_cpu.cmake
config/darwin.cmake (set any GPU flags in file to OFF)

(they can work even if your OSX version is newer than darwin).
Copy them to mxnet repo root and follow instructions.
Have you already tried that?

It doesn’t look like I can edit the original post so posting an update here. I eventually managed to build the project, can run unittest and (after some minor change to source) can run the mnist gluon example.

For the benefit of those who may encounter similar issues on Mac, here is what I did in addition to instructions in https://mxnet.apache.org/versions/1.6/get_started/build_from_source#install-mxnet-for-python

  1. Install libturbojpeg as cmake was failing to find the lib: brew install libjpeg-turbo
  2. jpeg-turbo was not symlinked to avoid conflicts with libjpeg so I had to use export PKG_CONFIG_PATH="/usr/local/opt/jpeg-turbo/lib/pkgconfig" in the shell before running next step
  3. cp config/distribution/darwin_cpu.cmake config.make
  4. run a cmake .. from build dir as mentioned in the instructions at the top of the config/distribution/darwin.cmake file
  5. Had to pip3 install pytest to be able to run the included smoke test with nosetests
  6. Had to remove with net.name_scope() from example/gluon/mnist/mnist.py to be able to run the mnist example

Happy days!

1 Like