Home > Deep learning, Open Source, Programming > Install Deepnet on Mac

Install Deepnet on Mac

November 15, 2013 Leave a comment Go to comments

This may help to have Nitish’s deepnet work on your mac. The code is very clean, most important thing is to follow the instructions here https://github.com/nitishsrivastava/deepnet/blob/master/INSTALL.txt


a) You will need Numpy, Scipy installed first, because the tools is largely python. Simply way is to use ‘brew‘. For example, follow the instructions here.

b) CUDA Toolkit and SDK.
Follow the instructions(CUDA5.5):  http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-mac-os-x/
NVIDIA CUDA Toolkit (available at http://developer.nvidia.com/cuda-downloads)

I followed both instruction on http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-mac-os-x/
and instruction from the deepnet to set the system paths:

export PATH=/Developer/NVIDIA/CUDA-5.5/bin:$PATH

Follow the deepnet instruction: for mac, it is the ‘~.profile’, edit/add to the file:

export CUDA_BIN=/usr/local/cuda-5.0/bin
export CUDA_LIB=/usr/local/cuda-5.0/lib

First make sure CUDA installed right:
install the examples: cuda-install-samples-5.5.sh <dir>

and go to /Developer/NVIDIA/CUDA-5.5/samples, choose any simple example subfolder, go into and do ‘make’, after make completed, you can do a simple test.

(c) Protocol Buffers.

Download the file: http://code.google.com/p/protobuf/

Follow the instructions to compile/install it.  It will be install (generally in /usr/local/bin/protoc). It was said that you only need to include the directory that contains ‘proc’, so add to path:
export PATH=$PATH:/usr/local/bin


For making the cuda work, do ‘make’ in cudamat , but change all the ‘uint’ to ‘unsigned’ in file: cudamat_conv_kernels.cuh
or do a #define uint unsigned
Then run ‘make’ in cudamat folder

(3,4) STEP 3,4

continue follow step 3, and 4 on https://github.com/nitishsrivastava/deepnet/blob/master/INSTALL.txtand you will get there.

Note (1): I did not install separately for  cudamat library by Vlad Mnih and cuda-convnet library by Alex Krizhevsky.

Note (2): If you do NOT have GPU: another alternative is to not use GPU, most recent mac come with NVIDIA 650, but some old version may use intel graphical card. In that case you can still do the deep learning part, but using eigenmat. The drawback is that it will be very slow. 

Install eigen from here: http://eigen.tuxfamily.org/index.php?title=Main_Page
if given error <Eigen/..> can not found, change to “Eigen/…”
also you need to change python path, including path to where ‘libeigenmat.dylib’ located. It it still fails to find: libeigenmat.dylib. It may not hurt to give it a direct path, edit the file <eigenmat/eigenmat.py>.
_eigenmat = ct.cdll.LoadLibrary(‘the-path-to/libeigenmat.dylib’)

  1. Xin Lu
    November 20, 2013 at 10:09 AM

    Hi Wei,

    I have also tried the code on mac os 10.8.2 with GeForce 660M.
    Can I ask two questions?
    1. I tried the test code, “python test_cudamat.py”. In most cases, it works. But sometimes, it does not work, and showed that “cudamat.CUDAMatException: CUBLAS error.”

    Traceback (most recent call last):
    File “test.py”, line 44, in
    File “test.py”, line 36, in test_assign
    m1 = cm.CUDAMatrix(a)
    File “/Users/xin_local/Documents/projs/dl/code/cuda/deepnet-master/cudamat/cudamat.py”, line 195, in __init__
    raise generate_exception(err_code)
    cudamat.CUDAMatException: CUBLAS error.

    2. When I tried the I tried to run ./runall.sh under the rbm folder, it showed that “No GPU board available”.

    Have you met similar issues? Or do you have some suggestions about those problems?


    • Wei
      November 21, 2013 at 4:07 PM

      Hi Xin, I think the first problem might related to CUDA installation — something might not right with your installation.

      For the 2nd, this is what I found. Everything should work well on Ubuntu, for mac (as you have just one GPU) it’s not necessary to do GUP locking. so you can try comment : board = LockGPU() (as well as the free GPU) in the trainer.py and and do these two instead to initialize GPU setting:


      • Xin Lu
        November 25, 2013 at 5:45 PM

        Thanks Wei. Yeah, it works well on linux…

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: