Installing cuda via brew and dmg

blue-sky picture blue-sky · Jul 25, 2016 · Viewed 11.7k times · Source

After attempting to install nvidia toolkit on MAC by following guide : http://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html#axzz4FPTBCf7X I received error "Package manifest parsing error" which led me to this : NVidia CUDA toolkit 7.5.27 failing to install on OS X . I unmounted the dmg and upshot was that instead of receiving "Package manifest parsing error" the installer would not launch (it seemed to launch briefly , then quit).

Installing via command brew install Caskroom/cask/cuda (CUDA 7.5 install on Mac missing nvrtc) seems to have successfully installed cuda.

command nvcc --version returns :

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Mon_Apr_11_13:23:40_CDT_2016
Cuda compilation tools, release 7.5, V7.5.26

I've built the example in /Developer/NVIDIA/CUDA-7.5/samples/1_Utilities with :

make -C bandwidthTest/

This executed without error.

It appears installing with brew install Caskroom/cask/cuda is safe method of installing ? What is difference between this install method and installing via DMG file from nvidia ?

Caskroom appears to be an extension for brew for installing GUI applications : https://github.com/caskroom/homebrew-cask

Should an IDE also be installed as part of the cuda install ?

Answer

asmaier picture asmaier · Nov 3, 2017

Nowadays you have to do the following to install cuda via brew:

brew tap homebrew/cask-drivers
brew cask install nvidia-cuda

See https://github.com/caskroom/homebrew-cask/issues/38325 . Then you also need to add the following to your file ~/.bash_profile:

export PATH=/Developer/NVIDIA/CUDA-9.0/bin${PATH:+:${PATH}}
export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-9.0/lib${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}

See http://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html.

UPDATE: Newer versions of Mac OS X with activated SIP (System integrity protection) will prevent modifying the DYLD_LIBRARY_PATH (see https://groups.google.com/forum/#!topic/caffe-users/waugt62RQMU). You can check that via

source ~/.bash_profile
env | grep DYLD_LIBRARY_PATH

If the output of this command is empty SIP is active and you might want to deactivate it as described at https://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html . After doing this you should see

env | grep DYLD_LIBRARY_PATH
DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-9.0/lib