반응형
반응형

ㅅㄷㄴㅅ

import tensorflow as tf

# --------------------------------------------------------------------
# https://www.tensorflow.org/versions/r0.11/api_docs/python/
# --------------------------------------------------------------------

#-------------------------------------------------- 1. 텐서플로우 기본 Hello,World 출력 p40
#hello = tf.constant("hello, World!") #-- 생성
#sess = tf.Session() #-- 텐서플로우 세션 생성
#print(sess.run(hello)) #-- 출력

#-------------------------------------------------- 2. 텐서플로우로 사칙연산 계산법 p46
#a = tf.placeholder("int32") # --
#b = tf.placeholder("int32") # --
#y = tf.multiply(a, b) #-- a와 b를 곱셈합니다. https://www.tensorflow.org/api_docs/python/tf/multiply
#sess = tf.Session()
#print (sess.run(y, feed_dict={a:2, b:5})) #-- feed_dict :

#-------------------------------------------------- 3. 텐서보드 시각화를 통한 출력 p48
#a = tf.constant(10, name = "a")
#b = tf.constant(2, name = "b")
#y = tf.Variable(a*b, name = "y")
#model = tf.global_variables_initializer #initialize_all_variables() :: https://www.tensorflow.org/api_docs/python/tf/initialize_all_variables
#with tf.Session() as session:
# merged = tf.summary.merge_all() # merge_all_summaries :: https://www.tensorflow.org/api_docs/python/tf/contrib/deprecated/merge_all_summaries
# writer = tf.train.SummaryWriter("/tmp/tensorflowlogs", session.graph)
# session.run(model)
#print (session.run(y))

#-------------------------------------------------- 4.


반응형
반응형
  • https://namu.wiki/w/OpenCL
  • https://namu.wiki/w/OpenGL

[OpenCL]

OpenCL(Open Computing Language)은 개방형 범용 병렬 컴퓨팅 프레임워크이다. CPU, GPU, DSP 등의 프로세서로 이루어진 이종 플랫폼에서 실행되는 프로그램을 작성할 수 있게 해 준다. OpenCL은 커널 코드를 작성하기 위한 C99 기반의 언어인 OpenCL C와 플랫폼을 정의하고 제어하기 위한 API를 포함하고 있다. OpenCL은 작업 기반(task-based) 및 데이터 기반(data-based) 병렬 컴퓨팅을 제공한다.

OpenCL이 만들어진 이유는 OpenGL이나 OpenAL이 만들어진 이유와 비슷하다. OpenGL과 OpenAL은 각각 3차원 컴퓨터 그래픽스 및 컴퓨터 오디오에 대한 산업계의 개방형 표준이다. OpenCL은 비영리 기술 컨소시엄인 크로노스 그룹(Khronos Group)에서 관리하고 있다.


[openGL]

OpenGL(Open Graphics Library)은 1992년 실리콘 그래픽스사에서 만든 2차원 및 3차원 그래픽스 표준 API 규격으로, 프로그래밍 언어 간 플랫폼 간의 교차 응용 프로그래밍을 지원한다. 이 API는 약 250여개 가량의 함수 호출을 이용하여 단순한 기하도형에서부터 복잡한 삼차원 장면을 생성할 수 있다. OpenGL은 현재 CAD, 가상현실, 정보시각화, 비행 시뮬레이션 등의 분야에서 활용되고 있다. 또한 컴퓨터 게임 분야에서도 널리 활용되고 있으며, 마이크로소프트사의 Direct3D와 함께 컴퓨터 그래픽 세계를 양분하고 있다. Direct3D와는 달리, 표준안이 여러 관련 업체의 토론과 제안으로 이루어지기에 버전 업데이트는 느린 편이다. OpenGL을 사용하여 개발된 대표적인 게임은 이드 소프트웨어 퀘이크, 둠3 시리즈이다. 현재 비영리 기술 컨소시엄인 크로노스 그룹에 의하여 관리되고 있다.

반응형
반응형

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은 뭐지 알아봐야겠다.



참고 링크


반응형
반응형


반응형
반응형

김성 교수님의 딥러닝 git 다운받기


반응형
반응형

파이참(Pycharm)에서 텐서플로우 예제 실행해보기



File > Settings .. 



Project 선택 > Project Intepreter > TensorFlow가 있는지 확인!

없으면, + Install > 



TensorFlow 검색 > Install Package


간단한 예제와 결과

import tensorflow as tf

# https://www.tensorflow.org/get_started/get_started
node1 = tf.constant(3.0, tf.float32)
node2 = tf.constant(4.0) # also tf.float32 implicitly print('result:', node1, node2)

/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 /Users/aileen/PycharmProjects/test_project/TensorFlow/__init__.py result: Tensor("Const:0", shape=(), dtype=float32) Tensor("Const_1:0", shape=(), dtype=float32) Process finished with exit code 0


관련문서


반응형
반응형

파이참(Pycharm)으로 Hello world 찍기



파이참 첫 화면!

Pycharm의 프로젝트 구조 : https://www.jetbrains.com/help/pycharm/2016.3/project-structure-dialog.html



Empty Project에서 마우스 오른쪽 클릭하여 Python File 추가



파일에 Print ("Hello, world") 입력하고 실행하면!


C:\Users\Aileen\AppData\Local\Programs\Python\Python35\python.exe C:/Users/Aileen/PycharmProjects/exam_project/HelloWorld.py

Hello, world!


Process finished with exit code 0


다음편 ☞Pycharm에서 텐서플로우 예제 실행해보기

반응형
반응형

텐서플로우 개발하기 위해 필요한 프로그램들 설치하기

 

1. Python 설치 : 텐서플로우는 파이썬 기반의 언어이므로 파이썬 설치가 필요하지만 Anaconda를 설치할 경우 설치하지 않아도 된다.

 

2. Anaconda 설치하기 

    • 나콘다란? Continuum Analytics 라는 곳에서 만든 파이썬 배포판으로 다양한 형태의 파이썬 관련 패키지를 모두 포함하여 개발을 더 편리하게 해주는 툴!

 

아나콘다 설치 후, 버전확인 및 conda 라이브러리 업데이트 명령어

$python --version
 
$pip --version
 
$conda update --all 

 

[Mac에서 pip 업데이트 하기] ☞ 업데이트 실패시

$pip install -U 

 

[Windows에서 pip 업데이트 하기] ☞ 업데이트 실패시

$python -m pip install -U pip

 

3. 텐서플로우 설치https://www.tensorflow.org/install/

 

다음편 : ☞파이썬 개발을 위한 Pycharm IDE 설치하기편

 

반응형

+ Recent posts