*/

TensorFlow 개발 환경 구축하기(Docker)

TensorFlow 개발 환경 구축하기(Docker)

필요조건

  • 64-bit desktops or laptops
  • Ubuntu 16.04 or higher

TensorFlow 종류 선택

  • CPU 만 사용 :  NVIDIA GPU가 없는 경우
  • GPU 지원 : 텐서플로우 프로그램은 일반적으로 CPU보다 GPU에서 훨씬 빠르게 실행됨.

GPU지원 타입으로 텐서플로우 실행시 필요한 NVIDIA  소프트웨어

  • CUDA® Toolkit 9.0: NVIDIA 설명서 참조. CUDA 경로 이름을 LD_LIBRARY_PATH 환경 변수에 추가
  • cuDNN v7.0. : NVIDIA 설명서 참조.   설명서 대로 CUDA_HOME 환경 변수 만들었는 확인
  • 소스에서 빌드하기위한 CUDA Compute Capability 3.0 이상 및 당사 바이너리 용 3.5 이상의 GPU 카드
  • libcupti-dev library

Docker 설치

  • Community Edition(CE) 와 Enterprise Edition(EE) 두 종류의 에디션이 존재
  • 설치방법으로Docker’s  Repository 를 이용하거나 Manually 설치 할 수 있음

Repository를 이용한 설치

Docker CE를 설치하기 전에 Docker Repository를 설정하고, 그 다음에  Docker를 설치하고 업데이트 할 수 있다.

Ropository 셋업

  • apt package 인덱스를 업데이트
  • $ sudo apt-get update
  • HTTPS를 통해 저장소를 사용할 수 있도록 패키지를 설치
  • $ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
  • Docker의 official GPG key를 추가
  • $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • Repository  추가
  • $ sudo add-apt-repository \
       "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
       $(lsb_release -cs) \
       stable" 

  Docker CE 설치

  • apt package 인덱스 업데이트
  • $ sudo apt-get update
  • Docker CE 마지막 버젼 install
  • $ sudo apt-get install docker-ce

Root 유저가 아닐 경우 추가 작업

  • sudo 명령없이 docker를 수행할 수 있도록 docker 그룹을 생성한다.
  • $ sudo groupadd docker 
  • 내 user id를 docker 그룹에 등록한다.
  • $ sudo usermod -aG docker $USER  

Boot 시 Docker를 바로 사용할 수 있도록 설정

  •   systemd에 등록
  • $ sudo systemctl enable docker  
  • 제대로 됐는지 확인하기 위해 logout후 login 후  sudo 없이 실행. 다음과 같이 나오면 성공
  • $ docker run hello-world
    
    Hello from Docker!
     This message shows that your installation appears to be working correctly.
    
    To generate this message, Docker took the following steps:
      1. The Docker client contacted the Docker daemon.
      2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
         (amd64)
      3. The Docker daemon created a new container from that image which runs the
         executable that produces the output you are currently reading.
      4. The Docker daemon streamed that output to the Docker client, which sent it
         to your terminal.
    
    To try something more ambitious, you can run an Ubuntu container with:
      $ docker run -it ubuntu bash
    
    Share images, automate workflows, and more with a free Docker ID:
      https://hub.docker.com/
    
    For more examples and ideas, visit:
    
    https://docs.docker.com/engine/userguide/
  • docker version 확인
  • $ docker version
    Client:
     Version:      18.03.1-ce
     API version:  1.37
     Go version:   go1.9.5
     Git commit:   9ee9f40
     Built:        Thu Apr 26 07:17:20 2018
     OS/Arch:      linux/amd64
     Experimental: false
     Orchestrator: swarm
    
    Server:
     Engine:
      Version:      18.03.1-ce
      API version:  1.37 (minimum version 1.12)
      Go version:   go1.9.5
      Git commit:   9ee9f40
      Built:        Thu Apr 26 07:15:30 2018
      OS/Arch:      linux/amd64
      Experimental: false
    
참조 :

0 comments:

댓글 쓰기