파이썬과 OpenCL을 함께 쓰는 방법을 안내 합니다.
this slides introduce how to use python with OpenCL.
unfortunately, I made this for korean readers only. however, if anyone wants to know this procedure in english, please contact me.
Delivered as plenary at USENIX LISA 2013. video here: https://www.youtube.com/watch?v=nZfNehCzGdw and https://www.usenix.org/conference/lisa13/technical-sessions/plenary/gregg . "How did we ever analyze performance before Flame Graphs?" This new visualization invented by Brendan can help you quickly understand application and kernel performance, especially CPU usage, where stacks (call graphs) can be sampled and then visualized as an interactive flame graph. Flame Graphs are now used for a growing variety of targets: for applications and kernels on Linux, SmartOS, Mac OS X, and Windows; for languages including C, C++, node.js, ruby, and Lua; and in WebKit Web Inspector. This talk will explain them and provide use cases and new visualizations for other event types, including I/O, memory usage, and latency.
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...Adrian Huang
Note: When you view the the slide deck via web browser, the screenshots may be blurred. You can download and view them offline (Screenshots are clear).
Note: When you view the the slide deck via web browser, the screenshots may be blurred. You can download and view them offline (Screenshots are clear).
USENIX ATC 2017: Visualizing Performance with Flame GraphsBrendan Gregg
Talk by Brendan Gregg for USENIX ATC 2017.
"Flame graphs are a simple stack trace visualization that helps answer an everyday problem: how is software consuming resources, especially CPUs, and how did this change since the last software version? Flame graphs have been adopted by many languages, products, and companies, including Netflix, and have become a standard tool for performance analysis. They were published in "The Flame Graph" article in the June 2016 issue of Communications of the ACM, by their creator, Brendan Gregg.
This talk describes the background for this work, and the challenges encountered when profiling stack traces and resolving symbols for different languages, including for just-in-time compiler runtimes. Instructions will be included generating mixed-mode flame graphs on Linux, and examples from our use at Netflix with Java. Advanced flame graph types will be described, including differential, off-CPU, chain graphs, memory, and TCP events. Finally, future work and unsolved problems in this area will be discussed."
ZIO: Powerful and Principled Functional Programming in ScalaWiem Zine Elabidine
This is an introduction of purely functional programming type safe abstractions that provide a variety of features for building asynchronous and concurrent applications data structures built on ZIO.
You'll learn by examples about the power of functional programming to solve the hard problems of software development in a principled, without compromises.
Decompressed vmlinux: linux kernel initialization from page table configurati...Adrian Huang
Talk about how Linux kernel initializes the page table.
Note: When you view the the slide deck via web browser, the screenshots may be blurred. You can download and view them offline (Screenshots are clear).
Delivered as plenary at USENIX LISA 2013. video here: https://www.youtube.com/watch?v=nZfNehCzGdw and https://www.usenix.org/conference/lisa13/technical-sessions/plenary/gregg . "How did we ever analyze performance before Flame Graphs?" This new visualization invented by Brendan can help you quickly understand application and kernel performance, especially CPU usage, where stacks (call graphs) can be sampled and then visualized as an interactive flame graph. Flame Graphs are now used for a growing variety of targets: for applications and kernels on Linux, SmartOS, Mac OS X, and Windows; for languages including C, C++, node.js, ruby, and Lua; and in WebKit Web Inspector. This talk will explain them and provide use cases and new visualizations for other event types, including I/O, memory usage, and latency.
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...Adrian Huang
Note: When you view the the slide deck via web browser, the screenshots may be blurred. You can download and view them offline (Screenshots are clear).
Note: When you view the the slide deck via web browser, the screenshots may be blurred. You can download and view them offline (Screenshots are clear).
USENIX ATC 2017: Visualizing Performance with Flame GraphsBrendan Gregg
Talk by Brendan Gregg for USENIX ATC 2017.
"Flame graphs are a simple stack trace visualization that helps answer an everyday problem: how is software consuming resources, especially CPUs, and how did this change since the last software version? Flame graphs have been adopted by many languages, products, and companies, including Netflix, and have become a standard tool for performance analysis. They were published in "The Flame Graph" article in the June 2016 issue of Communications of the ACM, by their creator, Brendan Gregg.
This talk describes the background for this work, and the challenges encountered when profiling stack traces and resolving symbols for different languages, including for just-in-time compiler runtimes. Instructions will be included generating mixed-mode flame graphs on Linux, and examples from our use at Netflix with Java. Advanced flame graph types will be described, including differential, off-CPU, chain graphs, memory, and TCP events. Finally, future work and unsolved problems in this area will be discussed."
ZIO: Powerful and Principled Functional Programming in ScalaWiem Zine Elabidine
This is an introduction of purely functional programming type safe abstractions that provide a variety of features for building asynchronous and concurrent applications data structures built on ZIO.
You'll learn by examples about the power of functional programming to solve the hard problems of software development in a principled, without compromises.
Decompressed vmlinux: linux kernel initialization from page table configurati...Adrian Huang
Talk about how Linux kernel initializes the page table.
Note: When you view the the slide deck via web browser, the screenshots may be blurred. You can download and view them offline (Screenshots are clear).
USENIX LISA2021 talk by Brendan Gregg (https://www.youtube.com/watch?v=_5Z2AU7QTH4). This talk is a deep dive that describes how BPF (eBPF) works internally on Linux, and dissects some modern performance observability tools. Details covered include the kernel BPF implementation: the verifier, JIT compilation, and the BPF execution environment; the BPF instruction set; different event sources; and how BPF is used by user space, using bpftrace programs as an example. This includes showing how bpftrace is compiled to LLVM IR and then BPF bytecode, and how per-event data and aggregated map data are fetched from the kernel.
Memory Mapping Implementation (mmap) in Linux KernelAdrian Huang
Note: When you view the the slide deck via web browser, the screenshots may be blurred. You can download and view them offline (Screenshots are clear).
Formation Gratuite Total Tests par les experts Java Ippon Ippon
Garantissez la qualité des vos applications par des tests efficaces : unitaire, d'intégration, de performance... Apprenez à mettre en oeuvre un harnais de tests complet et efficace avec Junit, AssertJ, Mockito, Spring Test, Arquillian, ... et assimilez les concepts du TDD et du BDD, illustré avec Cucumber. La formation Total Test Training ira encore plus loin en vous présentant l'utilisation de Sonar et le rôle des tests dans un système d'intégration continue. Enfin, les aspects liés à la mesure de la performance (instrumentation avec Metric et stress test avec JMeter et Gatling) et à l'optimisation ciblée vous permettront d'être en mesure de produire un code "propre", protégé des risques de regressions.
C++20 comes with some big new language features: modules, coroutines, concepts, spaceship, and many new libraries. But apart from all those, C++20 also offers many small language improvements, making C++ more powerful and expressive, but also safer and more consistent. This talk is an overview over all those smaller additions to the core language that will make your life easier. We will discuss much-needed improvements to existing facilities such as lambdas, CTAD, structured bindings, and initialisation, as well as brand-new language utilities that you may not yet have heard about!
A Journey to Boot Linux on Raspberry PiJian-Hong Pan
Each processor/chip architecture has its own procedure to boot the kernel. It works with desgined partition layout and vendor specific firmwares/bootloaders in the boot partition. We can learn the related knowledge from the Raspbian image for Raspberry Pi, which is the board we can obtain easily. However, the diversity between the special booting procedures with specific firmwares/bootloaders increases the complexity for distribution maintainers. It will be great if there is a way to make it more generic that can be applied to most of the chip architectures/boards to boot up the system.
After referring to some Linux distributions, we learned U-Boot may play a role in the solution. It splits the booting procedure into hardware specific and generic system parts. This helps distribution maintainers deploy the generic system with OSTree, including device trees.
Let’s deep dive into this magic booting procedure!
NHN NEXT 게임 서버 프로그래밍 강의 자료입니다. 최소한의 필요한 이론 내용은 질문 위주로 구성되어 있고 (답은 학생들 개별로 고민해와서 피드백 받는 방식) 해당 내용에 맞는 실습(구현) 과제가 포함되어 있습니다.
참고로, 서버 아키텍처에 관한 과목은 따로 있어서 본 강의에는 포함되어 있지 않습니다.
Python의 계산성능 향상을 위해 Fortran, C, CUDA-C, OpenCL-C 코드들과 연동하기Ki-Hwan Kim
PYCON Korea 2015
Python은 과학 계산 분야에서도 이미 널리 사용되고 있습니다. numpy와 scipy 기반으로 만들어진 많은 모듈들이 휼륭한 생태계를 이루고 있기 때문입니다. 그러나 극한의 계산 성능을 요구하는 분야(HPC, High Performance Computing)에서는 여전히 C와 Fortran으로만으로 짜여진 코드들이 선호되고 있습니다. 이런 분야에서 Python에 대한 일반적인 견해는 전처리/후처리에는 유용하지만 메인 코드에 적용하기에는 느리다라는 것입니다.
이번 발표에서는 HPC 분야에서도 Python의 유용함을 보여줍니다. 계산이 집중된 부분만을 Fortran, C로 구현하여 Python 메인 코드에 접합하면, Python의 장점은 충분히 활용하면서도 계산 성능에 큰 손해는 보지 않을 수 있습니다. 게다가 CUDA-C, OpenCL-C와 연동하면 GPU, MIC와 같은 가속 프로세서들도 비교적 쉽게 활용할 수 있습니다. 이번 발표에서는 간단한 시뮬레이션 코드를 예제로 사용하여 Python 코드로부터 시작하여 Fortran, C, CUDA-C, OpenCL-C 등을 단계적으로 접합해 나가는 것을 보여줄 것입니다.
USENIX LISA2021 talk by Brendan Gregg (https://www.youtube.com/watch?v=_5Z2AU7QTH4). This talk is a deep dive that describes how BPF (eBPF) works internally on Linux, and dissects some modern performance observability tools. Details covered include the kernel BPF implementation: the verifier, JIT compilation, and the BPF execution environment; the BPF instruction set; different event sources; and how BPF is used by user space, using bpftrace programs as an example. This includes showing how bpftrace is compiled to LLVM IR and then BPF bytecode, and how per-event data and aggregated map data are fetched from the kernel.
Memory Mapping Implementation (mmap) in Linux KernelAdrian Huang
Note: When you view the the slide deck via web browser, the screenshots may be blurred. You can download and view them offline (Screenshots are clear).
Formation Gratuite Total Tests par les experts Java Ippon Ippon
Garantissez la qualité des vos applications par des tests efficaces : unitaire, d'intégration, de performance... Apprenez à mettre en oeuvre un harnais de tests complet et efficace avec Junit, AssertJ, Mockito, Spring Test, Arquillian, ... et assimilez les concepts du TDD et du BDD, illustré avec Cucumber. La formation Total Test Training ira encore plus loin en vous présentant l'utilisation de Sonar et le rôle des tests dans un système d'intégration continue. Enfin, les aspects liés à la mesure de la performance (instrumentation avec Metric et stress test avec JMeter et Gatling) et à l'optimisation ciblée vous permettront d'être en mesure de produire un code "propre", protégé des risques de regressions.
C++20 comes with some big new language features: modules, coroutines, concepts, spaceship, and many new libraries. But apart from all those, C++20 also offers many small language improvements, making C++ more powerful and expressive, but also safer and more consistent. This talk is an overview over all those smaller additions to the core language that will make your life easier. We will discuss much-needed improvements to existing facilities such as lambdas, CTAD, structured bindings, and initialisation, as well as brand-new language utilities that you may not yet have heard about!
A Journey to Boot Linux on Raspberry PiJian-Hong Pan
Each processor/chip architecture has its own procedure to boot the kernel. It works with desgined partition layout and vendor specific firmwares/bootloaders in the boot partition. We can learn the related knowledge from the Raspbian image for Raspberry Pi, which is the board we can obtain easily. However, the diversity between the special booting procedures with specific firmwares/bootloaders increases the complexity for distribution maintainers. It will be great if there is a way to make it more generic that can be applied to most of the chip architectures/boards to boot up the system.
After referring to some Linux distributions, we learned U-Boot may play a role in the solution. It splits the booting procedure into hardware specific and generic system parts. This helps distribution maintainers deploy the generic system with OSTree, including device trees.
Let’s deep dive into this magic booting procedure!
NHN NEXT 게임 서버 프로그래밍 강의 자료입니다. 최소한의 필요한 이론 내용은 질문 위주로 구성되어 있고 (답은 학생들 개별로 고민해와서 피드백 받는 방식) 해당 내용에 맞는 실습(구현) 과제가 포함되어 있습니다.
참고로, 서버 아키텍처에 관한 과목은 따로 있어서 본 강의에는 포함되어 있지 않습니다.
Python의 계산성능 향상을 위해 Fortran, C, CUDA-C, OpenCL-C 코드들과 연동하기Ki-Hwan Kim
PYCON Korea 2015
Python은 과학 계산 분야에서도 이미 널리 사용되고 있습니다. numpy와 scipy 기반으로 만들어진 많은 모듈들이 휼륭한 생태계를 이루고 있기 때문입니다. 그러나 극한의 계산 성능을 요구하는 분야(HPC, High Performance Computing)에서는 여전히 C와 Fortran으로만으로 짜여진 코드들이 선호되고 있습니다. 이런 분야에서 Python에 대한 일반적인 견해는 전처리/후처리에는 유용하지만 메인 코드에 적용하기에는 느리다라는 것입니다.
이번 발표에서는 HPC 분야에서도 Python의 유용함을 보여줍니다. 계산이 집중된 부분만을 Fortran, C로 구현하여 Python 메인 코드에 접합하면, Python의 장점은 충분히 활용하면서도 계산 성능에 큰 손해는 보지 않을 수 있습니다. 게다가 CUDA-C, OpenCL-C와 연동하면 GPU, MIC와 같은 가속 프로세서들도 비교적 쉽게 활용할 수 있습니다. 이번 발표에서는 간단한 시뮬레이션 코드를 예제로 사용하여 Python 코드로부터 시작하여 Fortran, C, CUDA-C, OpenCL-C 등을 단계적으로 접합해 나가는 것을 보여줄 것입니다.
http://www.ubuntu-kr.org/viewtopic.php?f=2&t=16175
내 용
발표 1 우분투로 슈퍼컴 만들기 = 김성윤
발표 2 geogebra (수학 그래프+도형 툴) = 미남imsu(구임수)
자기 소개 및 자유 이야기
발표 3 : 우분투에서 임베디드 리눅스 개발 환경 구축하기 = 뻔뻔강사(유명환)
[NDC 2014] 유저 수만큼 다양한 섬을 만들자
<야생의>의 절차적인 섬 생성 기법
발표장에서 시간이 없어서 답변드리지 못했던 Q&A 내용들을 뒷 부분에 추가하였습니다.
GIF 가 포함된 부분은 잘 나오지 않으므로 궁금하시면 직접 다운로드 받아서 보시기 바랍니다. - http://goo.gl/UUKmjL
OpenCV를 활용하는 영상처리 어플리케이션 개발자들은 항상 GPU 자원을 활용하고 싶을 것이다. 하지만 이기종 컴퓨팅 환경에서 CPU 이외의 다른 하드웨어 자원을 활용하는 것은 개발 환경 및 백그라운드 지식 등의 많은 어려움이 따른다.
GPGPU 활용에 가장 상용화로 성공한 대중적인 솔루션으로는 nVidia 사의 CUDA 기술이 있지만, 그 외에도 GPGPU 자원을 쉽게 활용할 수 있는 오픈 플랫폼이 있는데 이것이 OpenCL 표준이다.
최근 하드웨어와 소프트웨어 진영에서 모두 OpenCL의 지원 및 발전이 두드러지며 점점 더 확산되는 추세이다.
OpenCV 진영에서도, 3.0이 정식 릴리즈 면서 본격적으로 OpenCL을 활용하기가 한층 쉬워졌다.
GDB와 strace로 Hang 걸린 Python Process 원격 디버깅Youngmin Koo
Python 프로그램을 디버깅하실 때 어떤 툴을 사용하시나요? 아무래도 가장 많이 사용하고 계신 툴은 PyCharm이 아닐까 싶습니다. PyCharm은 JetBrains에서 만든 GUI 환경에서 사용할 수 있는 Python IDE입니다.
PyCharm은:
로컬 컴퓨터에서 디버깅 모드로 (PyDev로) Python 프로세스를 실행할 수 있습니다.
로컬 컴퓨터에서 실행 중인 Python 프로세스에 Attach해 디버깅할 수 있습니다.
원격 서버에서 디버깅 모드로 (PyDev로) Python 프로세스를 실행할 수 있습니다.
하지만 원격에서 동작하고 있는 프로세스에 디버거를 Attach하는 기능은 제공하지 않고 있습니다. 또한 Python 디버깅 모듈인 pdb를 사용하여도 동작하고 있는 프로세스에 Attach하는 것은 지원하고 있지 않습니다.
로컬 환경에서는 문제 없이 돌아갔던 Python 프로그램이 원격 서버에서는 아무런 로그 없이 멈춰 버리는 경우 어디서부터 손을 대야 할지 정말 막막합니다. 이 때 GDB와 strace를 이용하면 어디에서 문제가 발생했는지 진단할 수 있습니다. 이 세션에서는 GDB와 strace를 이용해 디버깅하여 원격 리눅스 서버에서 Python Process가 Hang 되어 버리는 문제를 진단하고 해결했던 경험을 공유하려고 합니다.
빌드? 우선 사용부터 매뉴얼? Getting started 한 번 돌려보기 TV 리모컨 버튼 5개 전문가는 교육받아 만들어진다? 경험=시간+시행착오+성공실패 오픈소스 트러블슈팅 “메시지” 구글링 오픈소스 함부로 수정하지 마라 최신 버전을 대하는 우리의 자세 LTS로 대동단결 팀장 설득하기 오픈소스는 공짜가 아닙니다. 저도 기여하고 싶어요 2,000년 톰캣을 시작으로 Ant, Eclipse, JUnit, JMeter를 거쳐 현재 개발에 잘 사용하고 있는 Yona, Git, VSCode, Jenkins, CentOS, VirtualBox, Nginx, Node.js, Express.js, MariaDB, Uptime, Mocha, SonarQube, ZAP 이야기 등입니다.
https://www.youtube.com/watch?v=5LHOTBxG0hc
머신러닝 및 데이터 과학 연구자를 위한 python 기반 컨테이너 분산처리 플랫폼 설계 및 개발Jeongkyu Shin
머신러닝 및 데이터 과학 분야의 컴퓨팅 수요는 해가 갈수록 급증하고 있습니다. 이와 더불어 분산처리 기술, 데이터 파이프라이닝 및 개발 환경 스택 관리 등의 관련된 다양한 이슈들 또한 엄청나게 늘어나고 있습니다. 머신러닝 모델의 기하급수적인 모델 복잡도 증가 추세와 마찬가지로, 모델 학습을 위한 환경 관리 또한 갈수록 복잡도가 높아지는 추세입니다.
이 세션에서는 이러한 문제를 해결하기 위해 python 언어 기반의 분산처리 스케쥴링/오케스트레이션 미들웨어 플랫폼을 개발한 4년간의 과정에서 겪은 다양한 문제들에 대해 다룹니다. 2015년 컨테이너 기반의 고밀도 분산처리 플랫폼 설계 및 프로토타이핑 과정을 PyCon KR에서 발표한 이후, 실제 구현 및 오픈소스화, 안정화를 거치며 겪은 다양한 기술적/비기술적 문제들에 대한 경험을 공유합니다.
기술적으로는 최근 몇 년 간의 클러스터 플랫폼 관련 기술의 진보와 함께 탄생한 다양한 도구들과, 이러한 도구들을 python 기반으로 엮어내기 위해 사용하고 개발한 다양한 오픈소스들을 다룹니다. Python 기반의 컨테이너 스케쥴링 및 오케스트레이션 과정의 구현과, 다양한 프로그래밍 언어로 만든 SDK를 graphQL을 이용하여 연동하는 과정에서의 몇몇 유의점을 설명합니다. 아울러 python 기반의 SDK를 다양한 언어로 포팅했던 경험을 간단하게 안내합니다.
플랫폼을 개발하는 중 등장한 TensorFlow, PyTorch 등의 다양한 머신러닝 프레임워크들을 도입하며 겪은 문제와 해결 과정에 대해서도 나눕니다. 연구 분야에는 Python 2.7 기반의 프레임워크들이 여전히 많습니다. 이러한 프레임워크 및 라이브러리의 지원을 위하여 Python 2 기반의 프레임워크와 Python 3.7로 구현한 컨테이너 인터페이스를 단일 컨테이너 환경에 중복 빌드 및 상호 간섭 없이 공존시키기 위해 개발한 아이디어를 소개합니다.
마지막으로 Python 기반의 프레임워크를 개발, 배포 및 상용화 하는 과정에서 겪은 다양한 어려움을 소개합니다. 솔루션을 배포 및 보급할 때 겪는 다양한 런타임, 하드웨어 환경 및 개인 정보 보호를 위한 폐쇄망 대상의 디플로이 등에 대응하기 위하여 Python 응용프로그램을 단독 실행용으로 패키징하는 과정에서 겪은 팁들을 설명합니다. 또한 GUI 빌드 및 Python, Go 및 C++을 함께 사용한 드라이버 가상화 레이어 개발 등의 내용도 살짝 다룹니다.
이 슬라이드는 PyCon KR 2019의 발표 슬라이드입니다. ( https://www.pycon.kr/program/talk-detail?id=138 )
2. OpenCL?
• OpenCL은 애플이 제안하고 여러 반도체 업체가 동참한 병렬처리에 대한 산업 표
준 입니다.
• 그래픽 카드를 이용한 병렬처리(gpgpu)를 제공하고 있으며, nvidia의 cuda와 일종
의 경쟁 관계를 가지고 있습니다. (cuda가 더 편리하다는 평가 입니다. 그러나 업
체 독점 입니다.)
• 병렬처리는 요즈음 컴퓨터 과학과 로봇계의 핫 이슈인 머신러닝, 영상처리 등에 매
우 광범위하게 사용되며, 계산 시간을 줄이는데 적지 않은 역할을 하고 있습니다.
(약 30%의 속도 증가가 보고 됨)
2
3. 누구를 위해?
• 이 짧은 슬라이드는 다음 독자를 대상으로 작성 되었습니다.
• Python과 c/c++ 문법에 대한 약간의 경험
• 병렬처리에 대한 뜨거운 관심
• 그러나 당장 좋은 그래픽 카드를 살 여유는 없음
• 윈도우즈 8 or 10 사용 중 (64bit를 상정함)
• 인텔의 내장형 그래픽 카드 사용 중 (hd3000~5500)
3
4. 준비물
• pyOpenCL 설치를 완료 하기 위해서 다음과 같은 파일들이 준비 되어야 합니다.
• intel OpenCL Runtime: 무엇보다 중요한 런타임 입니다.
(https://software.intel.com/en-us/articles/opencl-drivers, OpenCL™ Runtime
15.1 for Intel® Core™ and Intel® Xeon® Processors for Windows* OS (64-
bit & 32-bit))
• anaconda: python과 numpy, matplolib 등의 유용한 라이브러리가 포함 됩니
다. (http://continuum.io/downloads, 64bit, python 2.7)
• get_pip.py: python 패키지 관리자인 pip를 설치하기 위한 스크립트 입니다.
(https://pip.pypa.io/en/latest/installing.html)
• pyOpenCL wrapper: python과 OpenCL을 연결하기 위한 wrapper 입니다.
(http://www.lfd.uci.edu/~gohlke/pythonlibs/,
pyopencl-2015.1-cp27-none-win_amd64.whl)
• OpenCV: python과 OpenCV를 연결하기 위한 wrapper 입니다.
(http://sourceforge.net/.../opencv-2.4.10.exe/download)
4
5. intel runtime & anaconda
• 인텔의 런타임 환경을 설치 합니다.
• anaconda도 설치 합니다. 단, 전체 사용자를 위한 설치를 해 주어야 합니다. 그렇
지 않으면 path 설정을 수동으로 해야 하는 등의 번거로움이 발생 합니다.
• anaconda의 설치에 문제가 없으면 윈도우즈의 런처에서 ipython을 발견할 수 있
습니다. 또한, c:anaconda 폴더가 생성 되었음을 확인할 수 있습니다.
5
6. get_pip.py로 pip 설치
• 파일 탐색기를 열어 get_pip가 다운로드 된 디렉토리로 이동 합니다.
• 그 상태에서 shift+우클릭을 합니다.
• 여기서 명령 창 열기를 클릭 합니다.
• 열린 터미널에서 다음 명령을 입력 합니다.
• python get_pip
6
7. pyOpenCL 설치
• 이번엔 pyopencl-2015.1-cp27-none-win_amd64.whl가 다운로드 된 디렉토리로
이동 합니다. (보통은 C:UsersUSERNAMEDownloads 겠죠?)
• 그 상태에서 shift+우클릭을 합니다.
• 여기서 명령 창 열기를 클릭 합니다.
• 열린 터미널에서 다음 명령을 입력 합니다.
• python –m pip install pyopencl-2015.1-cp27-none-win_amd64.whl
7
8. pyOpenCV 설치
• 영상처리에 있어서 병렬처리는 상당히 매력적인 한 수 입니다. 사용하려는 코어를
위한 커널 코드와 메모리 할당은 약간은 귀찮고 어렵기도 하지만, 한번 익혀 두면
알고리즘의 성능 향상에 상당히 도움이 됩니다. 최근 발표된 opencv3은 opencl과
상당한 통합을 이룬바 있습니다.
• 자, 다운로드 했던 opencv-2.4.10.exe를 실행하면 어디에 압축을 풀지 물어 봅니다.
기억해 두시기 바랍니다.
• 압축이 모두 풀리면 어딘가에 opencv 폴더가 생성이 되어 있습니다.
• 탐색기를 이용해 ….opencvbuildpython2.7x64 로 이동 합니다.
• cv2.pyd 파일이 있을 것 입니다. 이 파일을 python의 site-package로 복사해 줍니
다. 예를들어, 제 경우에는…
• C:AnacondaLibsite-packages 입니다.
8
9. 환경 변수 입력
• 물론 우리는 가난하니까 선택권이 별로 없지만, 친절한 OpenCL은 코드가 실행 될
때 마다 우리에게 자꾸 물어 옵니다. ‘너 cpu는 뭐 쓰고, gpu는 뭐 쓸래?’
• 고맙지만 사양 합니다. 고놈의 주디를 틀어 막기 위해 환경 변수를 미리 정해 놓기
로 합니다.
• 시스템 – 고급시스템설정 – 시스템 속성으로 갑니다.
• 환경 변수를 클릭하면 사용자 변수와 시스템 변수가 있습니다.
• 시스템 변수의 새로 만들기를 클릭 합니다.
• PYOPENCL_CTX와 0:1을 아래와 같이 입력 합니다.
9
10. 확인!!
• 이제, 설치는 모두 끝났습니다. 잘 설치가 되었을까요?
• ipython을 실행 하고 다음과 같이 입력 해봅니다.
• import cv2
• import pyopencl
• 위의 두 라이브러리를 잘 로드 했다면 설치는 무사히 완료 된 것 입니다.
• 수고 하셨습니다.
10
11. 뽀오나쓰 스테이지-
• 간단한 코드를 통해 코드 구조를 살펴 봅시다.
• 아래 코드는 python 코드가 컨텍스트를 만들고 작업 큐를 할당하며, 버퍼를 만들
어 커널 코드에 건네는 과정을 담고 있습니다. 이 코드에서 커널 코드는 메모리에
대한 작업은 하지 않습니다만 자신의 id를 확인하는 방법을 보여 줍니다.
11
12. 좋은 예제들
• 현재 Apple 소속인 Aaftap Munshi 아저씨는 OpenGL에도 많은 영향을 끼쳤습니
다. 그의 책인 OpenCL Programming Guide는 입문서로 손색이 없습니다.
(http://www.amazon.com/OpenCL-Programming-Guide-Aaftab-
Munshi/dp/0321749642)
• 또한, 이 책의 모든 코드는 깃헙에 모두 공개 되어 있습니다.
(https://github.com/bgaster/opencl-book-samples)
• 그럼, 즐거운 병렬처리 되시기 바랍니다.
12