LoginSignup
1
0

More than 5 years have passed since last update.

Install cuda to macOS

Last updated at Posted at 2017-02-05

Environment

macOS Sierra 10.12.2
2.9GHz, 8GB, NVIDIA Geforce

Install Driver + Toolkit

Download link:

Setting the bashrc file

~/.bashrc
## cuda
export PATH=/Developer/NVIDIA/CUDA-7.5/bin:$PATH
export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-7.5/lib:$DYLD_LIBRARY_PATH

Install pycuda from source

cd ~/Download
git clone http://git.tiker.net/trees/pycuda.git
cd pycuda
python configure.py

modify the siteconf.py under the pycuda folder
(if boost is not installed brew install boost)

BOOST_INC_DIR = ['/usr/local/Cellar/boost/1.60.0_1/include']
BOOST_LIB_DIR = ['usr/local/Cellar/boost/1.60.0_1/lib']
BOOST_COMPILER = 'gcc49'
USE_SHIPPED_BOOST = True
BOOST_PYTHON_LIBNAME = ['boost_python-mt']
BOOST_THREAD_LIBNAME = ['boost_thread-mt']
CUDA_TRACE = False
CUDA_ROOT = '/usr/local/cuda'
CUDA_ENABLE_GL = False
CUDA_ENABLE_CURAND = True
CUDADRV_LIB_DIR = ['${CUDA_ROOT}/lib']
CUDADRV_LIBNAME = ['cuda']
CUDART_LIB_DIR = ['${CUDA_ROOT}/lib']
CUDART_LIBNAME = ['cudart']
CURAND_LIB_DIR = ['${CUDA_ROOT}/lib']
CURAND_LIBNAME = ['curand']
CXXFLAGS = ['-arch', 'x86_64', '-mmacosx-version-min=10.7', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk']
LDFLAGS = ['-F/Library/Frameworks', '-arch', 'x86_64', '-mmacosx-version-min=10.7', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk']
cd ~/Download/pycuda
sudo make
sudo make install

※Note
You must import any of pycuda files while you are in the different directory that you extracted the pycuda tar.gz file

Check whether pycuda was installed or not yet

python
>>> import pycuda.autoinit
>>>
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0