1. tensorflow with GPU support.

환경 : 윈도우 10 64bit / nvidia gtx1060

CPU 처리방식은 안내대로 설치하면 아무 문제 없이 잘 돌아감.

GPU 가속 지원받으면 훨씬 빨라짐. CUDA + anaconda 개발환경으로 설치함.

https://www.tensorflow.org/install/ 에서 알맞는 운영체제 선택해서 설치(여기서는 윈도우 버젼으로 진행)

Installing TensorFlow on Windows

This guide explains how to install TensorFlow on Windows.

Determine which TensorFlow to install

You must choose one of the following types of TensorFlow to install:

  • TensorFlow with CPU support only. If your system does not have a NVIDIA® GPU, you must install this version. Note that this version of TensorFlow is typically much easier to install (typically, in 5 or 10 minutes), so even if you have an NVIDIA GPU, we recommend installing this version first.
  • TensorFlow with GPU support. TensorFlow programs typically run significantly faster on a GPU than on a CPU. Therefore, if your system has a NVIDIA® 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 %PATH% environment variable as described in the NVIDIA documentation.  https://developer.nvidia.com/cuda-downloads 여기가서 다운받아서 설치
  • The NVIDIA drivers associated with CUDA Toolkit 8.0.
  • cuDNN v5.1. For details, see NVIDIA’s documentation. Note that cuDNN is typically installed in a different location from the other CUDA DLLs. Ensure that you add the directory where you installed the cuDNN DLL to your %PATH%environment variable. 17년 8월 2일 현재 v6.0은 안됨. v5.1로 설치(https://developer.nvidia.com/rdp/cudnn-download) 가입해야함.
  • GPU card with CUDA Compute Capability 3.0 or higher. See NVIDIA documentation for a list of supported GPU cards. CUDA를 사용할 수 있는 그래픽 카드인지 확인…

If you have an earlier version of the preceding packages, please upgrade to the specified versions.

Determine how to install TensorFlow 편의를 위해서 Anaconda 추천

You must pick the mechanism by which you install TensorFlow. The supported choices are as follows:

  • “native” pip
  • Anaconda

Native pip installs TensorFlow directly on your system without going through a virtual environment. Since a native pip installation is not walled-off in a separate container, the pip installation might interfere with other Python-based installations on your system. However, if you understand pip and your Python environment, a native pip installation often entails only a single command! Furthermore, if you install with native pip, users can run TensorFlow programs from any directory on the system.

In Anaconda, you may use conda to create a virtual environment. However, within Anaconda, we recommend installing TensorFlow with the pip install command, not with the conda install command.

NOTE: The conda package is community supported, not officially supported. That is, the TensorFlow team neither tests nor maintains this conda package. Use that package at your own risk.

Installing with native pip

If the following version of Python is not installed on your machine, install it now:

TensorFlow only supports version 3.5.x of Python on Windows. Note that Python 3.5.x comes with the pip3 package manager, which is the program you’ll use to install TensorFlow.

To install TensorFlow, start a terminal. Then issue the appropriate pip3 install command in that terminal. To install the CPU-only version of TensorFlow, enter the following command:

C:\> pip3 install --upgrade tensorflow

To install the GPU version of TensorFlow, enter the following command:

C:\> pip3 install --upgrade tensorflow-gpu

Installing with Anaconda 추천!

The Anaconda installation is community supported, not officially supported.

Take the following steps to install TensorFlow in an Anaconda environment:

  1. Follow the instructions on the Anaconda download site to download and install Anaconda.
  2. Create a conda environment named tensorflow by invoking the following command: Anaconda Prompt를 실행해서 아래 명령을 수행
    C:> conda create -n tensorflow python=3.5
  3. Activate the conda environment by issuing the following command:
    C:> activate tensorflow
     (tensorflow)C:>  # Your prompt should change
  4. Issue the appropriate command to install TensorFlow inside your conda environment. To install the CPU-only version of TensorFlow, enter the following command:
    (tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.1-cp35-cp35m-win_amd64.whl

    To install the GPU version of TensorFlow, enter the following command (on a single line):

    (tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.2.1-cp35-cp35m-win_amd64.whl

Validate your installation

Start a terminal.

If you installed through Anaconda, activate your Anaconda environment.

Invoke python from your shell as follows:

$ python

Enter the following short program inside the python interactive shell:

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session() 이거 수행하면 워닝뜨는데 무시해도 됨.
워닝 안뜨게 하려면 소스를 끌어와서 빌드하던가 아래를 추가
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf


>>> print(sess.run(hello))

If the system outputs the following, then you are ready to begin writing TensorFlow programs:

Hello, TensorFlow!

If you are new to TensorFlow, see Getting Started with TensorFlow.

If the system outputs an error message instead of a greeting, see Common installation problems.

답글 남기기