반응형

7. [Mac] 에서 텐서플로우(Tensorflow) GPU 설치하기


원문 : https://www.tensorflow.org/install/install_mac


  • TensorFlow with GPU support. TensorFlow programs typically run significantly faster on a GPU than on a CPU. Therefore, if your system has a NVIDIA CUDA GPU meeting the prerequisites shown below and you need to run performance-critical applications, you should ultimately install this version.

Requirements to run TensorFlow with GPU support

If you are installing TensorFlow with GPU support using one of the mechanisms described in this guide, then the following NVIDIA software must be installed on your system:

  • CUDA Toolkit 8.0. For details, see NVIDIA's documentation. Ensure that you append the relevant CUDA pathnames to the LD_LIBRARY_PATH environment variable as described in the NVIDIA documentation.
  • The NVIDIA drivers associated with CUDA Toolkit 8.0.
  • cuDNN v5.1. For details, see NVIDIA's documentation. Ensure that you create the CUDA_HOMEenvironment variable as described in the NVIDIA documentation.
  • GPU card with CUDA Compute Capability 3.0 or higher. See NVIDIA documentation for a list of supported GPU cards.

If you have an earlier version of the preceding packages, please upgrade to the specified versions. If upgrading is not possible, you may still run TensorFlow with GPU support, but only if you do both of the following:

  • Install TensorFlow from sources (as described in Installing TensorFlow from Sources.
  • Install or upgrade to at least the following NVIDIA versions:
    • CUDA toolkit 7.0 or greater
    • cuDNN v3 or greater
    • GPU card with CUDA Compute Capability 3.0 or higher.



1) 본인 PC에 NVIDIA GPU가 있는지 확인하기



사과 > 이 MAC에 관하여.. > 개요 > 그래픽 

본인 맥북은 2015년형 맥북 레티나 (macbook pro retina 15 inch) - Intel Iris 그래픽 카드를 쓰고있다...윽!


[window에서 확인하는 방법]

윈도우키+R > dxdiag > 디스플레이> AMD Radeon (TM) R5 340X 


2) CUDA 설치

NVIDIA CUDA란? (https://namu.wiki/w/CUDA)

NVIDIA GPU에서만 사용할 수 있습니다.. 


3) Tensorflow GPU 설치

방법1) cmd로 설치

pip install --upgrade tensorflow-gpu # for Python 2.7 and GPU

pip3 install --upgrade tensorflow-gpu # for Python 3.n and GPU


방법2) Pycharm 으로 설치


File > Default Settings .. 



Project Interpreter > 하단 Install 클릭 > Tensorflow-gpu 검색



설치 중 ... 



tensorflow-gpu 버전이 설치된 것을 확인 가능하다.


4) GPU 예제 실행해보기

테스트 진행




궁금한 점

NVIDIA GPU가 아닌 라데온이나 다른 그래픽 카드에서는 CUDA를 실행할 순 없을까?.. 없당.

*http://s3delta.tistory.com/401 > 썰일뿐이군.. 

*https://www.quora.com/Can-CUDA-work-with-AMD-Radeon-HD-8330-with-12Gb-RAM > 단호하네....


결론은 안되니까.. Open CL과 Open GL은 뭐지 알아봐야겠다.



참고 링크


+ Recent posts