Top Banner
Como aumentar o desempenho de sua aplicação com
25

Palestra hpc python

Aug 13, 2015

Download

Technology

Leandro Zanotto
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Palestra hpc python

Como aumentar o desempenho de sua aplicação com

Page 2: Palestra hpc python

2

Agenda

● Apresentação

● Introdução

● HPC e Aplicações

● Python /Compiladores

● Profiler

● Caching

● Multicore – ManyCore

● Threading / Multiprocess

● MPI4Py

● NumPy

● PyCUDA

● Anaconda / NumbaPro

● Perguntas

Page 3: Palestra hpc python

3

Apresentação

● O que é HPC TOP 500

Page 4: Palestra hpc python

4

CEPID ­ CCES

● Center for Computational Engineering & Sciences● Desenvolvimento e Aplicação de Técnicas de

modelagem computacionais avançadas● Interação com a Indústria● Promover a Educação e Difusão de Conhecimento

Page 5: Palestra hpc python

5

CCES – Aplicações

● Data Cyberstructure● High-Performance and Data-Intensive Computing● Quantum and Classical Molecular Simulations in

Biophisical Chemistry / Applied Physics● Computational Quantum Chemistry● Computational Mechanical Engineering● Bioinformatics and Computational Biology● Computational Geophysics

Page 6: Palestra hpc python

6

Moore's Law

O número de transistores em um denso circuito integrado tem dobrado aproximadamente a cada dois anos

Gordon E. Moore (1965)

Page 7: Palestra hpc python

7

Free Lunch is Over

Page 8: Palestra hpc python

8

Python

● Linguagem de programação de alto nível ● Interpretada● Imperativa● Orientada a objetos● Funcional● De tipagem dinâmica e forte● Portável

Page 9: Palestra hpc python

9

Desempenho

● O Python não é lento● Os interpretadores Python existentes são lentos● Cpython por exemplo

Page 10: Palestra hpc python

10

Melhorando o Desempenho

● Solução → outros Interpretadores● PyPy – Jython – IronPython● Exemplo PyPy → http://pypy.org/

Page 11: Palestra hpc python

11

PyPy Performance

● Comparando com CPython

http://speed.pypy.org/

Page 12: Palestra hpc python

12

Profilers

● Profile e cProfile → APIs para coletar e analizar estatisticamente como o Python consome recursos do processador

Page 13: Palestra hpc python

13

Profilers (cont.)

● Pstats → Maior flexibilidade para seus próprios relatórios

Page 14: Palestra hpc python

14

Profilers(cont.)

● VMProf

É simples python -m vmprof● Parecido com Intel Vtune ● Captura informações sobre seu código sobre

pequenas execuções podendo ser configurado dentro da API.

● Trabalha em cima da C Stack

Page 15: Palestra hpc python

15

Caching

● Arrays devem ter acesso sequencial● Evitar saltos como listas se possível● Utilize bibliotecas que são otimizadas

while i < n

x += array[i]

i += 1

Page 16: Palestra hpc python

16

Multicore ­ ManyCore

● Multicore –> Processadores com Poucos Núcleos

ManyCores → Centenas de Núcleos

Ex. GPUs

Page 17: Palestra hpc python

17

Threading

Page 18: Palestra hpc python

18

Multiprocessing

Page 19: Palestra hpc python

19

MPI4PY

Page 20: Palestra hpc python

20

NumPy

● Potente N-dimensional objeto de array● Funções de Broadcast● Ferramentas para itegrar C/C++ e Fortran● Várias funções matemáticas prontas acelerando o processamento e

desenvolvimento

NumPy é um pacote fundamental para computação científica com Python.

Page 21: Palestra hpc python

21

NumPy Exemplo

Page 22: Palestra hpc python

22

PyCUDA

● Permite acessar as GPUs (Nvidia) através do Python permitindo acelerar o código

Page 23: Palestra hpc python

23

Anaconda / NumbaPro

● Anaconda é um pacote free para Python para procesamento em larga escala, análise de dados e computação científica

● NumbaPro é um versão do Numba que auxilia os desenvolvedores a acelerar suas aplicações

Page 24: Palestra hpc python

24

NumbaPro Exemplos

CPU GPU

Page 25: Palestra hpc python

25

Perguntas