CUDA in Macbook Pro (early 2013)

Hello,
I would like to use my MacBook Pro to learn Pytorch with the use of the GPU. I looked around the web, I couldn’t find exactly what I need for my machine.
Here are the details of my HW and SW. I am trying to use CUDA 8.0, I was not able to use a newer version. thank you for any help.

Hardware

  • MacBook Pro Early 2013 15-inch
    • Processor: 2.7 GHz Intel Core i7
    • Memory: 16 GB 1600 MHz DDR3
    • Graphics:
      • NVIDIA GeForce GT 650M 1024 MB
      • ntel HD Graphics 4000 1536 MB

Software versions

  • macOS Sierra Version 10.13.6 (17G6030)
  • GPU Driver Version: Nvidia Web Driver - 387.10.10.10.40.127
  • CUDA Driver Version:
    • cat /usr/local/cuda/version.txt
    • CUDA Version 8.0.62
  • [cuDNN v5.1 Library for OSX]
    • cudnn-8.0-osx-x64-v5.1-tgz) (Jan 20, 2017), for CUDA 8.0
  • XCODE Version 9.4.1 (9F2000)
  • conda 4.8.5

cc seems fine:

% cc --version
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

installation of cuddnn:

cd ~/Downloads
tar xzvf cudnn-8.0-osx-x64-v5.1.tar
sudo mv cuda/include/cudnn.h /Developer/NVIDIA/CUDA-8.0/include/
sudo mv cuda/lib/libcudnn* /Developer/NVIDIA/CUDA-8.0/lib
sudo ln -s /Developer/NVIDIA/CUDA-8.0/lib/libcudnn* /usr/local/cuda/lib/

I have added in ~/.bash_profile

export PATH="/Developer/NVIDIA/CUDA-8.0/bin:$PATH"
export DYLD_LIBRARY_PATH="/Developer/NVIDIA/CUDA-8.0/lib:$DYLD_LIBRARY_PATH"
export CUDA_HOME="/usr/local/cuda"
export PATH="/usr/local/cuda/extras/CUPTI/lib:$PATH"
export DYLD_LIBRARY_PATH="/usr/local/cuda/extras/CUPTI/lib:$DYLD_LIBRARY_PATH"
export CMAKE_PREFIX_PATH=“/Users/pytorch/opt/anaconda3:$CMAKE_PREFIX_PATH"
export CUDNN_LIBRARY="/Developer/NVIDIA/CUDA-8.0/lib/libcudnn.5.dylib"
export CUDNN_INCLUDE_DIR="/Developer/NVIDIA/CUDA-8.0/include"
export CUDNN_LIB_DIR="/Developer/NVIDIA/CUDA-8.0/lib"

sanity check on nvcc

% nvcc --version
nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:46_CST_2017
Cuda compilation tools, release 8.0, V8.0.61

I get error if I compile one of one examples:

% cd /usr/local/cuda/samples/1_Utilities/deviceQuery
% sudo make
/Developer/NVIDIA/CUDA-8.0/bin/nvcc -ccbin clang++ -I…/…/common/inc -m64 -Xcompiler -arch -Xcompiler x86_64 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o deviceQuery.o -c deviceQuery.cpp
nvcc warning : The ‘compute_20’, ‘sm_20’, and ‘sm_21’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc fatal : The version (‘90100’) of the host compiler (‘Apple clang’) is not supported
make: *** [deviceQuery.o] Error 1

I am not sure about how to install pytorch with conda, I tried:

conda install pytorch torchvision cudatoolkit=8.0 -c pytorch

but I get errors:
PackagesNotFoundError: The following packages are not available from current channels:

  • cudatoolkit=8.0

when I try in Python:

import torch
print(torch.version)
1.6.0

torch.cuda.is_available()
False
torch.cuda.is_available()