SlideShare a Scribd company logo
1 of 113
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
HPC per l’industria 4.0
Design e tecniche per sviluppo software HP
eric.pascolo@cineca.it
HPC User Support Group - CINECA
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 2
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 3
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
MARCONI, dettagli tecnici
4
Marconi A1
• 1500 nodi
• Intel BRD 2x18 cores, 2.3
GHZ
• 128 GB RAM/CN
• 2 Pflops
• 21 racks
• 500 MCoreH/yrs
• Modello Lenovo Nextscale
Marconi A2
• 3600 nodi
• Intel KNL 68 cores, 1.4
GHZ
• 96 GB RAM/CN
• 11 Pflops
• 50 racks
• 2000 MCoreH/yrs
• Modello Lenovo Adam Pass
Marconi A3
• 2300 nodi
• Intel SKL 2x24 cores, 2.1
GHZ
• 192 GB RAM/CN
• 7 Pflops
• 30 racks
• Modello Lenovo Stark
Intel
OmniPath
100 Gb/s
(Fat –tree)
8 SHARED LOGIN NODES
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Teoria
5
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Moore’s Law = Bussines Law
«Ogni 18 mesi il numero di
transistor in un processore
raddoppia»
6
Gordon
Moore
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Ma dove siamo adesso?
7
0.5 nm
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Purtroppo è arrivato Dennard…
8
Robert Dennard
Gordon Moore
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Dennard’s Law
9
Length (next) = L/2
Voltage(next) = V/2
Frequency(next) = F*2
Power(next) = P
CPU
( NOW )
CPU
( NEXT )
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 10
PROBLEMA
Length (next) = L/2
Voltage(next) = V/2
Frequency(next) = F*2
Power(next) = P
Dennard’s Law
CPU
( NOW )
CPU
( NEXT )
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 11
L(next) = L/2
V(next) = ~V
F(next) = F*2
P(next) = 4*P
AUMENTANDO LA FREQUENZA
AUMENTANO
DRASTICAMENTE I CONSUMI
Dennard’s Law
CPU
( NOW )
CPU
( NEXT )
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
vs
SINGLE CORE MULTI CORE MANY CORE
12
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 13
SINGLE CORE MULTI CORE
vs
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 14
SINGLE CORE MULTI CORE
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Un semplice problema:
«Ho un database con varie tabelle, devo riuscire a scorrerle nel
modo più rapido possibile»
15
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
E se cambiamo processore?
«Ho un database con varie tabelle, devo riuscire a scorrerle nel
modo più rapido possibile»
16
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 17
T// = Ts/N
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Torniamo con i piedi per terra ☹
• Begin program
• Load var
• Open file
• Read Table
• Close file
• Manage Table
• Save table
• End program
18
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Torniamo con i piedi per terra ☹
• Begin program
• Load env
• Read Table
• Manage Table
• Save table
• End program
19
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Amdahl’s Law
20
Gene Amdahl
T// = Ts [(1-P) + P/N)]
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Amdahl’s Law
21
Number of core
T// = Ts [(1-P) + P/N)]
1
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 22
#include <stdio.h>
int main()
{
printf("Hello world!n");
return 0;
}
COMPILAZIONE
Hello World!
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Cpu
23
• Clock ( Hz )
• Flops
• CORE
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Preparare un dolce al ristorante
24
Dovete preparare 50 gelati con 3 gusti ognuno per
una tavolata di clienti, sono molto affamati.
Come fate a prepararli nel minor tempo possibile?
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Preparare un dolce al ristorante
25
Località Temporale
1 2 3
Località Spaziale
1 2 3
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Memoria
REG
CACHE L2
CACHE L2
CACHE L3
RAM
HARD DISK
26
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Architetture
27
CORE0 CORE1
MEM
FPU FPU
CORE0 CORE1
MEM
FPU
A B
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Approfondimenti sul core
28
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 29
Modern Processor Pipeline
Front END
Back END
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 30
Front End
Compiled CODE
Allocation:
process that
fed the BE of uOP
Retirement:
The completion of a uOp’s
execution. The results are
committed to the architectural
state.
Ideal : all uOP are retired
4 uOP/cycle(pipeline slot) => CPI = 0.25
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 31
Back End
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 32
Increase Performance
256 Vector Register
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 33
Single Instruction Multiple Data
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 34
Many Ways
Easy Difficult
Compiler Auto
Vectorization
Compiler
Assist
Vectorization
Intrinsic
Function
Assembler
code
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 35
Compiler AutoVectorization
gcc –fno-tree-vectorize
gcc –x<ARCH> -ftree-vectorize
To see code optimization report
gcc –fopt-info
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 36
Reason for Vectorization Fails
Non-unit stride access
Data dependencies
Non Vec Math
functions
Wrong Alignement
Function calls
Loop body
Too complex
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 37
Data Alignment
void * _mm_malloc(int size, int word)
Data alignment means putting the data at
a memory address equal to some multiple of
the word size (AVX 256 bit).
Remember to compiler that an array is aligned
__builtin_assume_aligned(var,word);
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 38
Data Dependency
Flow dependence
for(int i;..){
X[i] =
… = X[i]
}
Anti dependence
for(int i;..){
… = X[i]
X[i] = …
}
Output dependence
for(int i;..){
X[i] = …
X[i] = …
}
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Paradigmi di Parallelizzazione
39
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Come si costruisce un muro?
40
?
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Come si costruisce un muro?
41
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Costruiamo una casetta!!
42
?
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Costruiamo una casetta!!
43
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Hanno lavorato bene i nostri muratori?
44
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Hanno lavorato bene i nostri muratori?
45
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
La comunicazione è importante!
46
In questo modo
riusciamo a costruire
la casetta in modo
corretto?
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 47
La comunicazione è importante!
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Confronto tra i modelli…
48
SHARED MEMORY
MESSAGE PASSING
Posso ridurre i tempi di costruzione?
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Posso ridurre i tempi di costruzione?
49
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Network
50
2
3
4
6
5
7
8
9
switch
LOGIN NODE 1
LOGIN NODE 2
MASTER
NODE
//FILESYSTEM
INTERNET
I/O
NODE
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Shared memory
51
Processor Processor
Memory
NETWORKController
Processor Processor
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 52
• OpenMP è un API // multi-thread e shared memory
• Schema Fork/Join, nella regione parallela SPMD
• Numero Thread dinamico
• Il codice non va riscritto ma basta aggiungere direttive
#pragma
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 53
#include <omp.h>
int main () {
int var1, var2, var3;
Serial code
// Beginning of parallel section. Fork a team of threads.
omp_set_num_threads(num);
#pragma omp parallel private(var1, var2) shared(var3)
{
/*** Parallel section executed by all threads ***/
}
//Resume serial code }
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 54
I’m thread 0!
A(th)=th
I’m thread 3!
A(th)=th
I’m thread 1!A(th)=th
I’m thread 2!A(th)=th
A[1:4]=0
I’m your job!
I set A[1:4]=0
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 55
A=0,1,2,3
I’m thread 0!
A(th)=th
I’m thread 3!
A(th)=th
I’m thread 1!A(th)=th
I’m thread 2!A(th)=th
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
OpenMP Cluses
•Private
•Shared
•default
•Firstprivate
•Lastprivate
56
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
C ex1
int main(int, char **)
{
int num_threads,myid;
myid = 0;
num_threads = 1;
#pragma omp parallel private(myid,num_threads)
{
num_threads = omp_get_num_threads();
myid = omp_get_thread_num();
cout<<"Hello world! I'm "<<myid<<" of <<num_threads<<"n";
}}
57
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
int main(int, char **)
{
int num_threads,myid;
myid = 0;
num_threads = 1;
#pragma omp parallel private(myid,num_threads)
{
num_threads = omp_get_num_threads();
myid = omp_get_thread_num();
#pragma omp critical
cout<<"Hello world! I'm "<<myid<<" of <<num_threads<<"n";
}}
58
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Calcolo di un fattoriale
#include <omp.h>
int main ()
{ double var = 10000;
omp_set_num_threads(4);
#pragma omp parallel for
for( int i =var-1; 1<i ; i-- )
var = i * var ;
printf( ‘’Fattoriale = %d’’ , var ); }
59
Funziona?!
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
#include <omp.h>
int main ()
{ double var = 10000;
omp_set_num_threads(4);
#pragma omp parallel for reduction(*:var)
for( int i =var-1; 1<i ; i-- )
var = i * var ;
printf( ‘’Fattoriale = %d’’ , var ); }
60
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Message Passing
61
2
3
4
6
5
7
8
9
switch
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Message Passing
62
2
3
4
6
5
7
8
9
switch
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Message Passing
63
2
3
4
6
5
7
8
9
switch
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
GPGPU, verniciare un soffitto!
64
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
GPGPU, verniciare un soffitto!
65
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Deadlock
66
COSTRUISCI MURO
A INIZIO
MANDA MISURE
FINE
PROCEDI
SE B HA INVIATO
MISURE
COSTRUISCI MURO
B INIZIO
MANDA MISURE
FINE
PROCEDI
SE A HA INVIATO
MISURE
COSA SUCCEDE?
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Deadlock
67
COSTRUISCI MURO
A INIZIO
MANDA MISURE
FINE
PROCEDI
SE B HA INVIATO
MISURE
COSTRUISCI MURO
B INIZIO
MANDA MISURE
FINE
PROCEDI
SE A HA INVIATO
MISURE
CHE NOIA!!
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Eric Pascolo (OGS)
I rischi del mestiere: sbilanciamento
03/12/2015
68
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
I rischi del mestiere: sbilanciamento
69
Malloc printF For i->500000
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
I rischi del mestiere: sbilanciamento
70
Fine! Fine! i=2000
Se sbilanciate il lavoro alcuni core
potrebbero annoiarsi!
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Design del software //
71
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Scegliere il linguaggio
• Il linguaggio che conosco meglio
• Performance
• Semplicità di scrittura del problema
• Librerie già disponibili
72
Non è vietato scrivere il software in diversi linguaggi di programmazione!
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Linguaggi di programmazione
73
C/C++
Fortran
Python
CUDA
OpenCL
Java
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Librerie // e Linguaggi
74
C/C++
Fortran
Python
CUDA
OpenCL
Java
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Livelli di parallelismo
75
Start
End
Mpi comm
Omp comm
Mpi comm
Omp comm
Start
End
Mpi comm
Omp comm
Mpi comm
Omp comm
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Glue PL and Performance
76
C/C++
Fortran
Python
CL
GUI
Plasma
MPI Plugin Py
C
(MKL)
Python
(MPI4Py)
C++
(Boost)
High Performance
Easy Interface
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Tipi di Dato
Scegliere il tipo di dato giusto può aumentare
considerevolmente le performance:
256 bit vector:
• (4) 64 bit double, long int
• (8) 32 bit integer, float
• (16) 16 bit half precision float, integer
• (32) 8 bit char
77
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Deblurring delle immagini
78
S. Bonettini, R. Zanella, L. Zanni, 2009, A scaled gradient projection method for
constrained image deblurring, Inverse Problems, 25(1),015002
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Caso Reale
79
E.Pascolo, 2014, SGP-dec Porting su Xeon Phi
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Compilare
• Il compilatore è uno strumento potente, se istruito bene
permette di ottenere ottime performance
• I compilatori non sono tutti uguali, i più conosciuti General
purpose sono:
• Intel compiler
• PGI
• GNU compiler
• Portabilità o Performance? La differenza tra Apple e Microsoft
80
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Simulare un motore
Logica dei livelli di parallelizzazione
81
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 82
Schematizziamo
RADIATORE
CARBURATOREBatteria
Calcola
corrente in
uscita
BLOCCO
MOTORE
Calcola potenza
trasmessa all’albero
Centralina
Elabora segnali
sensori e gestisce il
motore
Calcola flusso
dell’acqua
Calcola miscela
Aria benzina
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 83
Algoritmo seriale Batteria
BLOCCO
MOTORE
Centralina
CARBURATORE
RADIATORE
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 84
Algoritmo SM Batteria
BLOCCO
MOTORE
Centralina
CARBURATORE
RADIATORE
Rimane quasi
uguale, ma è
taskizzato!
// la fisica dei componenti ma il
controllo della centralina è
seriale!
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 85
Algoritmo MPI Batteria
BLOCCO
MOTORE
Centralina
CARBURATORE
RADIATORE
Sempre taskizzato!
Ho solo più memoria per singolo
componente!
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 86
Algoritmo MPI
Batteria
BLOCCO
MOTORE
Centralina
CARBURATORE
RADIATORE
Ognuno chiede quello che gli
serve da un altro, meno
serializzazione!
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 87
2 Livelli di //
TASK MPI
THREADS
OMPBatteria
Circuito interno: ogni
threads calcola una ramo
RADIATORE
Tubi paralleli a contatto con
l’aria: ogni thread calcola la
temperatura di
raffreddamento e la
pressione in quel tubo
BLOCCO
MOTORE
Più cilindri:ogni thread
dato il flusso di benzina
calcola potenza
CARBURATORE
Fisica dei fluidi per
mescolamento aria
benzina: soluzioni eq
Centralina
Input sensori: controllo //
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Eric Pascolo (OGS) 03/12/2015
88
3 livelli di //
BLOCCO
MOTORE
TASK MPI
C1 C2 C3
THREADS
OMP
VECTORIZATION
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Aumentiamo i livelli di //
89
Tutti i sistemi elencati sono distribuiti su
più gruppi di task MPI, che lavorano //.
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Distribuzione e Run del
Software
90
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
MARCONI, dettagli tecnici
91
Marconi A1
• 1500 nodi
• Intel BRD 2x18 cores, 2.3
GHZ
• 128 GB RAM/CN
• 2 Pflops
• 21 racks
• 500 MCoreH/yrs
• Modello Lenovo Nextscale
Marconi A2
• 3600 nodi
• Intel KNL 68 cores, 1.4
GHZ
• 96 GB RAM/CN
• 11 Pflops
• 50 racks
• 2000 MCoreH/yrs
• Modello Lenovo Adam Pass
Marconi A3
• 2300 nodi
• Intel SKL 2x24 cores, 2.1
GHZ
• 192 GB RAM/CN
• 7 Pflops
• 30 racks
• Modello Lenovo Stark
Intel
OmniPath
100 Gb/s
(Fat –tree)
8 SHARED LOGIN NODES
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
HPC e differenti tipi di servizi
• HPC Batch
• Interactive computing
• Hight throughput computing
• High performance data Analysis
92
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Cloud e differenti tipi di servizi
93
NETWORKING
STORAGE
SERVERS
VIRTUALIZATION
OS
MIDDLEWARE
RUNTIME
DATA
APPLICATION
IT tradizionale
NETWORKING
STORAGE
SERVERS
VIRTUALIZATION
OS
MIDDLEWARE
RUNTIME
DATA
APPLICATION
Infrastructure aaS
NETWORKING
STORAGE
SERVERS
VIRTUALIZATION
OS
MIDDLEWARE
RUNTIME
DATA
APPLICATION
Platform aaS
NETWORKING
STORAGE
SERVERS
VIRTUALIZATION
OS
MIDDLEWARE
RUNTIME
DATA
APPLICATION
Service aaS
Da gestire
Fornito come
Servizio
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Servizio CLOUD
Supporto ai Workflow che non prevedono solomente tecnologie
HPC
• Servizi accessori alla produzione HPC
• Repository, Continuos Integration
• Gestioni delle catene di lavoro
• Accesso al HPC su interfacce e no SSH (Engine Frame)
• Web server
• Dissemination dei dati
94
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 95
HPC CLOUD
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
HPC costumer environment
Creare un ambiente personalizzabile su
macchine HPC
96
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Come realizzarlo?
97
Virtual Machine Container
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Nel dettaglio
98
PHYSICAL HARDWARE LAYER
LINUX KERNEL
ROOT FILE SYSTEM
APP VIRTUAL HD LAYER
LINUX KERNEL
ROOT FILE SYSTEM
HYPERVISOR
APP
APP APP
APP APP APP
VIRTUAL MACHINE
PHYSICAL HARDWARE LAYER
LINUX KERNEL
ROOT FILE SYSTEM
APP
SINGULARITY
APP
APP APP
IMG ROOT FS
APP APP
APP APP
USER NAMESPACE
PHYSICAL HARDWARE LAYER
LINUX KERNEL
ROOT FILE SYSTEM
APP
DOCKERDEAMON
APP
APP APP
IMG ROOT FS
APP APP
APP APP
DOCKER
NAMESPACE
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Singularity
• Sicurezza :lascia libertà all’utente non compromettendo la
sicurezza del cluster
• Mobilità: l’utente è libero di importate il suo software su cluster
• Riproducibilità: le simulazioni vengono eseguite nello stesso
ambiente dovunque
• Libertà: lascia l’utente libero di pensare alla simulazione e non ai
dettagli tecnici
• Flessibilità: permette la creazione dei container partendo da
differenti risorse
99
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Workflow
100
CREAZIONE
FILE IMG
BOOTSTRAP IMG:
DOCKER,DEB,RPM
SYSTEM
CONTAINER
MODIFICATION
CLOUD VM
RUN
SIMULATION
SETUP EXTERNAL ENVIRONMENT,
MOUNT FS
SHELL
USER MOD
INTO IMG
HPC CLUSTER
COPY
COPY
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Altri dettagli
• In un container SINGULARITY l’utente possiede gli stessi diritti
che avrebbe sulla macchina.
• Con SINGULARITY è possibile lavorare con una SHELL dentro
l’immagine o lanciare un comando(exec)
• MPI è utilizzabile dall’esterno dell’immagine
• All’intero dell’immagine è possibili avere OS,App o Dati
• Una volta creata l’immagine si può solo ingrandire
• Dal interno dell’immagine si può accedere direttamente al File
System parallelo
101
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
SPACK : user space package manager
• Package manager per HPC software
• Prerequisiti : necessita di Python e di un compilatore C
• Configurazione: facilmente configurabile, può essere confinato
all’interno di un singolo ambiente
• Riusabilità e Portabilità: le ricette di installazione di SPACK sono
completamente indipendenti dall’hardware
102
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Struttura del container
103
ROOT FILE SYSTEM
(777 PERMISSION)
/SPACK
/SPACK/OPT
ALL APP
/GALILEO
MOUNT HOME HERE
/SCRATCH
MOUNT SCRATCH
HERE
/ETC
/USR
/OPT
/VAR
……
sudo singularity create --size 2048 ubuntu.img
sudo singularity bootstrap ubuntu.img Ubuntu.def
sudo singularity expand —-size 1024 ubuntu.img
singularity shell --shell /bin/bash -w —bind $CINECA_SCRATCH:/scratch ubuntu.img
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Performance
Confronto run QE 16 task MPI tra Singularity container e su
classico nodo HPC (Galileo)
104
0
12,5
25
37,5
50
ALL2ALL FFT ORTHO
QE Singularity QE nodo
QE Singularity : 744 s
QE Nodo : 780 s
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Installazione Flessibile
105
CLOUD VM CENTOS Galileo
OPENMPI
LINPACK CON OPENMPI
PRECEDENTEMENTE INSTALLATO
QE CON OPENMPI
PRECEDENTEMENTE INSTALLATO
PROVA DI TUTTI I SOFTWARE
RIUSCITA
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
3. Spack view, non ricompilare il software
106
COMPILATO QE CON INTEL COMPILER
E INTEL MPI DI SISTEMA, AGGIUNTO
COME MODULO ESTERNO ALLO SPACK
DI SISTEMA
CREAZIONE DI UNA SPACK VIEW
DI QE INSTALLATO
PRECEDENTEMENTE
COMPRESSIONE IN TAR.GZ DELLA
SPACK VIEW DEREFERENZIANDO
I LINK
COPIA DEL TAR NELL’IMG
SINGULARITY E
SCOMPARTIMENTOCOPIA DELL’IMG SU
GALILEO
CARICAMENTO VIA SHELL
DELL’IMG E SISTEMAZIONE
LD_LIBRARY_PATH
PER INTEL MPI
PROVA DI CP.X E VERIFICA DEL
SUO FUNZIONAMENTO
ALL’INTERNO DELL’IMG
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Grazie dell’attenzione
Spero di non avermi annoiato troppo!
eric.pascolo@cineca.it
HPC User Support Group - CINECA
107
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Consorzio pubblico di diritto privato:
• 70 Atenei
• 8 Enti pubblici di Ricerca
109
Attività principali:
• Supercalcolo
• Supporto al Miur
• Supporto agli Atenei
• Trasferimento Tecnologico
707 Dipendenti, 3 sedi: Bologna,Milano,Roma
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Supercalcolo in Italia Top 500 2017
111
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Breve confronto tra sistemi di
Supercalcolo
113
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 114
Cray I
• 1976 -1982-> il computer più
potente al mondo!
• 135 MegaFLOPS
• Progettazione armi nucleari!
• 80 MHz
• 8 MILIONI $
HPC per l’industria 4.0 - Eric Pascolo03/10/2017
Cray I
• 1976 -1982-> il computer più
potente al mondo!
• 135 MegaFLOPS
• Progettazione armi nucleari!
• 80 MHz
• 8 MILIONI $
iPad mini (2012)
• Processore A5: 171
MegaFLOP
• 2 core (32 bit)
• 1 GHz
• 329 €
115
HPC per l’industria 4.0 - Eric Pascolo03/10/2017 116
Intel Haswell E5-2699 v3
(2014)
• 1.2 TeraFLOP
• 36 core(64 bit)
• 2.30 GHz
• 8218€
Nvidia Tesla K20
• 2.9 TeraFLOP
• 2x Kepler GK210
• 4992 CUDA core
• 24 GB VRAM
• 3000 €

More Related Content

Similar to Hpc per l'industria 4.0

Mpc8308 rdb piattaforma di riferimento della freescale - recensione - 2010-10-26
Mpc8308 rdb piattaforma di riferimento della freescale - recensione - 2010-10-26Mpc8308 rdb piattaforma di riferimento della freescale - recensione - 2010-10-26
Mpc8308 rdb piattaforma di riferimento della freescale - recensione - 2010-10-26
Ionela
 
Agrillo Fedora 11 release party 18 giugno 2009
Agrillo Fedora 11 release party 18 giugno 2009Agrillo Fedora 11 release party 18 giugno 2009
Agrillo Fedora 11 release party 18 giugno 2009
Giuseppe Agrillo
 

Similar to Hpc per l'industria 4.0 (20)

Automatizzazione di analisi e sviluppo di piattaforme eterogenee - F. Palumbo...
Automatizzazione di analisi e sviluppo di piattaforme eterogenee - F. Palumbo...Automatizzazione di analisi e sviluppo di piattaforme eterogenee - F. Palumbo...
Automatizzazione di analisi e sviluppo di piattaforme eterogenee - F. Palumbo...
 
Mpc8308 rdb piattaforma di riferimento della freescale - recensione - 2010-10-26
Mpc8308 rdb piattaforma di riferimento della freescale - recensione - 2010-10-26Mpc8308 rdb piattaforma di riferimento della freescale - recensione - 2010-10-26
Mpc8308 rdb piattaforma di riferimento della freescale - recensione - 2010-10-26
 
Lenovo porta a ISC 2016 l’innovazione collaborativa per la ricerca e l’High-P...
Lenovo porta a ISC 2016 l’innovazione collaborativa per la ricerca e l’High-P...Lenovo porta a ISC 2016 l’innovazione collaborativa per la ricerca e l’High-P...
Lenovo porta a ISC 2016 l’innovazione collaborativa per la ricerca e l’High-P...
 
DHow2 - L5
DHow2 - L5DHow2 - L5
DHow2 - L5
 
Eurotech HPC day Innova-FVG 2015
Eurotech  HPC  day   Innova-FVG  2015Eurotech  HPC  day   Innova-FVG  2015
Eurotech HPC day Innova-FVG 2015
 
Supercalcolo: mercato, sfide, trend e sistemi HPC
Supercalcolo: mercato, sfide, trend e sistemi HPCSupercalcolo: mercato, sfide, trend e sistemi HPC
Supercalcolo: mercato, sfide, trend e sistemi HPC
 
Seminario Marco Moro, 8-11-2012
Seminario Marco Moro, 8-11-2012Seminario Marco Moro, 8-11-2012
Seminario Marco Moro, 8-11-2012
 
Cell Programming 1
Cell Programming 1Cell Programming 1
Cell Programming 1
 
Tesi
TesiTesi
Tesi
 
Migrare da TYPO3 4.5 a TYPO3 6.x
Migrare da TYPO3 4.5 a TYPO3 6.xMigrare da TYPO3 4.5 a TYPO3 6.x
Migrare da TYPO3 4.5 a TYPO3 6.x
 
Optimizing dax
Optimizing daxOptimizing dax
Optimizing dax
 
Optimizing dax
Optimizing daxOptimizing dax
Optimizing dax
 
MODULO 04: Il microprocessore
MODULO 04: Il microprocessoreMODULO 04: Il microprocessore
MODULO 04: Il microprocessore
 
Linux Day 2016 Milano - Open Source Hardware PowerPC Notebook
Linux Day 2016 Milano - Open Source Hardware PowerPC Notebook Linux Day 2016 Milano - Open Source Hardware PowerPC Notebook
Linux Day 2016 Milano - Open Source Hardware PowerPC Notebook
 
Agrillo Fedora 11 release party 18 giugno 2009
Agrillo Fedora 11 release party 18 giugno 2009Agrillo Fedora 11 release party 18 giugno 2009
Agrillo Fedora 11 release party 18 giugno 2009
 
Open Source Day 2019 - Cosa puoi fare con Ansible in 1200 secondi?
Open Source Day 2019 - Cosa puoi fare con Ansible in 1200 secondi?Open Source Day 2019 - Cosa puoi fare con Ansible in 1200 secondi?
Open Source Day 2019 - Cosa puoi fare con Ansible in 1200 secondi?
 
Piano di indirizzamento di una rete IPv6
Piano di indirizzamento di una rete IPv6Piano di indirizzamento di una rete IPv6
Piano di indirizzamento di una rete IPv6
 
MySQL Day Milano 2019 - Il backup non ammette ignoranza
MySQL Day Milano 2019 - Il backup non ammette ignoranzaMySQL Day Milano 2019 - Il backup non ammette ignoranza
MySQL Day Milano 2019 - Il backup non ammette ignoranza
 
Industry 4.0 & AgileIoT
Industry 4.0 & AgileIoTIndustry 4.0 & AgileIoT
Industry 4.0 & AgileIoT
 
Architettura dei calcolatori
Architettura dei calcolatoriArchitettura dei calcolatori
Architettura dei calcolatori
 

More from Eric Pascolo

Quantum espresso G Vector distributon
Quantum espresso G Vector distributonQuantum espresso G Vector distributon
Quantum espresso G Vector distributon
Eric Pascolo
 

More from Eric Pascolo (8)

Anatomia di una macchina fotografica
Anatomia di una macchina fotograficaAnatomia di una macchina fotografica
Anatomia di una macchina fotografica
 
Hpc: usare un computer è facile? e un supercomputer?
Hpc: usare un computer è facile? e un supercomputer?Hpc: usare un computer è facile? e un supercomputer?
Hpc: usare un computer è facile? e un supercomputer?
 
Ottimizzazione e parallelizzazione del codice
Ottimizzazione e parallelizzazione del codiceOttimizzazione e parallelizzazione del codice
Ottimizzazione e parallelizzazione del codice
 
Quantum espresso G Vector distributon
Quantum espresso G Vector distributonQuantum espresso G Vector distributon
Quantum espresso G Vector distributon
 
Volantino Diprtimento FIM Unimore
Volantino Diprtimento FIM UnimoreVolantino Diprtimento FIM Unimore
Volantino Diprtimento FIM Unimore
 
Eire13 Photo Travel journey
Eire13 Photo Travel journeyEire13 Photo Travel journey
Eire13 Photo Travel journey
 
Colors
ColorsColors
Colors
 
Supercomputer: potremmo farne a meno?
Supercomputer: potremmo farne a meno?Supercomputer: potremmo farne a meno?
Supercomputer: potremmo farne a meno?
 

Hpc per l'industria 4.0

  • 1. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 HPC per l’industria 4.0 Design e tecniche per sviluppo software HP eric.pascolo@cineca.it HPC User Support Group - CINECA
  • 2. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 2
  • 3. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 3
  • 4. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 MARCONI, dettagli tecnici 4 Marconi A1 • 1500 nodi • Intel BRD 2x18 cores, 2.3 GHZ • 128 GB RAM/CN • 2 Pflops • 21 racks • 500 MCoreH/yrs • Modello Lenovo Nextscale Marconi A2 • 3600 nodi • Intel KNL 68 cores, 1.4 GHZ • 96 GB RAM/CN • 11 Pflops • 50 racks • 2000 MCoreH/yrs • Modello Lenovo Adam Pass Marconi A3 • 2300 nodi • Intel SKL 2x24 cores, 2.1 GHZ • 192 GB RAM/CN • 7 Pflops • 30 racks • Modello Lenovo Stark Intel OmniPath 100 Gb/s (Fat –tree) 8 SHARED LOGIN NODES
  • 5. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Teoria 5
  • 6. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Moore’s Law = Bussines Law «Ogni 18 mesi il numero di transistor in un processore raddoppia» 6 Gordon Moore
  • 7. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Ma dove siamo adesso? 7 0.5 nm
  • 8. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Purtroppo è arrivato Dennard… 8 Robert Dennard Gordon Moore
  • 9. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Dennard’s Law 9 Length (next) = L/2 Voltage(next) = V/2 Frequency(next) = F*2 Power(next) = P CPU ( NOW ) CPU ( NEXT )
  • 10. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 10 PROBLEMA Length (next) = L/2 Voltage(next) = V/2 Frequency(next) = F*2 Power(next) = P Dennard’s Law CPU ( NOW ) CPU ( NEXT )
  • 11. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 11 L(next) = L/2 V(next) = ~V F(next) = F*2 P(next) = 4*P AUMENTANDO LA FREQUENZA AUMENTANO DRASTICAMENTE I CONSUMI Dennard’s Law CPU ( NOW ) CPU ( NEXT )
  • 12. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 vs SINGLE CORE MULTI CORE MANY CORE 12
  • 13. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 13 SINGLE CORE MULTI CORE vs
  • 14. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 14 SINGLE CORE MULTI CORE
  • 15. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Un semplice problema: «Ho un database con varie tabelle, devo riuscire a scorrerle nel modo più rapido possibile» 15
  • 16. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 E se cambiamo processore? «Ho un database con varie tabelle, devo riuscire a scorrerle nel modo più rapido possibile» 16
  • 17. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 17 T// = Ts/N
  • 18. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Torniamo con i piedi per terra ☹ • Begin program • Load var • Open file • Read Table • Close file • Manage Table • Save table • End program 18
  • 19. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Torniamo con i piedi per terra ☹ • Begin program • Load env • Read Table • Manage Table • Save table • End program 19
  • 20. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Amdahl’s Law 20 Gene Amdahl T// = Ts [(1-P) + P/N)]
  • 21. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Amdahl’s Law 21 Number of core T// = Ts [(1-P) + P/N)] 1
  • 22. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 22 #include <stdio.h> int main() { printf("Hello world!n"); return 0; } COMPILAZIONE Hello World!
  • 23. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Cpu 23 • Clock ( Hz ) • Flops • CORE
  • 24. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Preparare un dolce al ristorante 24 Dovete preparare 50 gelati con 3 gusti ognuno per una tavolata di clienti, sono molto affamati. Come fate a prepararli nel minor tempo possibile?
  • 25. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Preparare un dolce al ristorante 25 Località Temporale 1 2 3 Località Spaziale 1 2 3
  • 26. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Memoria REG CACHE L2 CACHE L2 CACHE L3 RAM HARD DISK 26
  • 27. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Architetture 27 CORE0 CORE1 MEM FPU FPU CORE0 CORE1 MEM FPU A B
  • 28. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Approfondimenti sul core 28
  • 29. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 29 Modern Processor Pipeline Front END Back END
  • 30. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 30 Front End Compiled CODE Allocation: process that fed the BE of uOP Retirement: The completion of a uOp’s execution. The results are committed to the architectural state. Ideal : all uOP are retired 4 uOP/cycle(pipeline slot) => CPI = 0.25
  • 31. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 31 Back End
  • 32. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 32 Increase Performance 256 Vector Register
  • 33. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 33 Single Instruction Multiple Data
  • 34. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 34 Many Ways Easy Difficult Compiler Auto Vectorization Compiler Assist Vectorization Intrinsic Function Assembler code
  • 35. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 35 Compiler AutoVectorization gcc –fno-tree-vectorize gcc –x<ARCH> -ftree-vectorize To see code optimization report gcc –fopt-info
  • 36. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 36 Reason for Vectorization Fails Non-unit stride access Data dependencies Non Vec Math functions Wrong Alignement Function calls Loop body Too complex
  • 37. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 37 Data Alignment void * _mm_malloc(int size, int word) Data alignment means putting the data at a memory address equal to some multiple of the word size (AVX 256 bit). Remember to compiler that an array is aligned __builtin_assume_aligned(var,word);
  • 38. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 38 Data Dependency Flow dependence for(int i;..){ X[i] = … = X[i] } Anti dependence for(int i;..){ … = X[i] X[i] = … } Output dependence for(int i;..){ X[i] = … X[i] = … }
  • 39. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Paradigmi di Parallelizzazione 39
  • 40. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Come si costruisce un muro? 40 ?
  • 41. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Come si costruisce un muro? 41
  • 42. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Costruiamo una casetta!! 42 ?
  • 43. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Costruiamo una casetta!! 43
  • 44. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Hanno lavorato bene i nostri muratori? 44
  • 45. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Hanno lavorato bene i nostri muratori? 45
  • 46. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 La comunicazione è importante! 46 In questo modo riusciamo a costruire la casetta in modo corretto?
  • 47. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 47 La comunicazione è importante!
  • 48. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Confronto tra i modelli… 48 SHARED MEMORY MESSAGE PASSING Posso ridurre i tempi di costruzione?
  • 49. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Posso ridurre i tempi di costruzione? 49
  • 50. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Network 50 2 3 4 6 5 7 8 9 switch LOGIN NODE 1 LOGIN NODE 2 MASTER NODE //FILESYSTEM INTERNET I/O NODE
  • 51. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Shared memory 51 Processor Processor Memory NETWORKController Processor Processor
  • 52. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 52 • OpenMP è un API // multi-thread e shared memory • Schema Fork/Join, nella regione parallela SPMD • Numero Thread dinamico • Il codice non va riscritto ma basta aggiungere direttive #pragma
  • 53. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 53 #include <omp.h> int main () { int var1, var2, var3; Serial code // Beginning of parallel section. Fork a team of threads. omp_set_num_threads(num); #pragma omp parallel private(var1, var2) shared(var3) { /*** Parallel section executed by all threads ***/ } //Resume serial code }
  • 54. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 54 I’m thread 0! A(th)=th I’m thread 3! A(th)=th I’m thread 1!A(th)=th I’m thread 2!A(th)=th A[1:4]=0 I’m your job! I set A[1:4]=0
  • 55. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 55 A=0,1,2,3 I’m thread 0! A(th)=th I’m thread 3! A(th)=th I’m thread 1!A(th)=th I’m thread 2!A(th)=th
  • 56. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 OpenMP Cluses •Private •Shared •default •Firstprivate •Lastprivate 56
  • 57. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 C ex1 int main(int, char **) { int num_threads,myid; myid = 0; num_threads = 1; #pragma omp parallel private(myid,num_threads) { num_threads = omp_get_num_threads(); myid = omp_get_thread_num(); cout<<"Hello world! I'm "<<myid<<" of <<num_threads<<"n"; }} 57
  • 58. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 int main(int, char **) { int num_threads,myid; myid = 0; num_threads = 1; #pragma omp parallel private(myid,num_threads) { num_threads = omp_get_num_threads(); myid = omp_get_thread_num(); #pragma omp critical cout<<"Hello world! I'm "<<myid<<" of <<num_threads<<"n"; }} 58
  • 59. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Calcolo di un fattoriale #include <omp.h> int main () { double var = 10000; omp_set_num_threads(4); #pragma omp parallel for for( int i =var-1; 1<i ; i-- ) var = i * var ; printf( ‘’Fattoriale = %d’’ , var ); } 59 Funziona?!
  • 60. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 #include <omp.h> int main () { double var = 10000; omp_set_num_threads(4); #pragma omp parallel for reduction(*:var) for( int i =var-1; 1<i ; i-- ) var = i * var ; printf( ‘’Fattoriale = %d’’ , var ); } 60
  • 61. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Message Passing 61 2 3 4 6 5 7 8 9 switch
  • 62. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Message Passing 62 2 3 4 6 5 7 8 9 switch
  • 63. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Message Passing 63 2 3 4 6 5 7 8 9 switch
  • 64. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 GPGPU, verniciare un soffitto! 64
  • 65. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 GPGPU, verniciare un soffitto! 65
  • 66. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Deadlock 66 COSTRUISCI MURO A INIZIO MANDA MISURE FINE PROCEDI SE B HA INVIATO MISURE COSTRUISCI MURO B INIZIO MANDA MISURE FINE PROCEDI SE A HA INVIATO MISURE COSA SUCCEDE?
  • 67. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Deadlock 67 COSTRUISCI MURO A INIZIO MANDA MISURE FINE PROCEDI SE B HA INVIATO MISURE COSTRUISCI MURO B INIZIO MANDA MISURE FINE PROCEDI SE A HA INVIATO MISURE CHE NOIA!!
  • 68. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Eric Pascolo (OGS) I rischi del mestiere: sbilanciamento 03/12/2015 68
  • 69. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 I rischi del mestiere: sbilanciamento 69 Malloc printF For i->500000
  • 70. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 I rischi del mestiere: sbilanciamento 70 Fine! Fine! i=2000 Se sbilanciate il lavoro alcuni core potrebbero annoiarsi!
  • 71. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Design del software // 71
  • 72. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Scegliere il linguaggio • Il linguaggio che conosco meglio • Performance • Semplicità di scrittura del problema • Librerie già disponibili 72 Non è vietato scrivere il software in diversi linguaggi di programmazione!
  • 73. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Linguaggi di programmazione 73 C/C++ Fortran Python CUDA OpenCL Java
  • 74. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Librerie // e Linguaggi 74 C/C++ Fortran Python CUDA OpenCL Java
  • 75. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Livelli di parallelismo 75 Start End Mpi comm Omp comm Mpi comm Omp comm Start End Mpi comm Omp comm Mpi comm Omp comm
  • 76. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Glue PL and Performance 76 C/C++ Fortran Python CL GUI Plasma MPI Plugin Py C (MKL) Python (MPI4Py) C++ (Boost) High Performance Easy Interface
  • 77. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Tipi di Dato Scegliere il tipo di dato giusto può aumentare considerevolmente le performance: 256 bit vector: • (4) 64 bit double, long int • (8) 32 bit integer, float • (16) 16 bit half precision float, integer • (32) 8 bit char 77
  • 78. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Deblurring delle immagini 78 S. Bonettini, R. Zanella, L. Zanni, 2009, A scaled gradient projection method for constrained image deblurring, Inverse Problems, 25(1),015002
  • 79. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Caso Reale 79 E.Pascolo, 2014, SGP-dec Porting su Xeon Phi
  • 80. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Compilare • Il compilatore è uno strumento potente, se istruito bene permette di ottenere ottime performance • I compilatori non sono tutti uguali, i più conosciuti General purpose sono: • Intel compiler • PGI • GNU compiler • Portabilità o Performance? La differenza tra Apple e Microsoft 80
  • 81. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Simulare un motore Logica dei livelli di parallelizzazione 81
  • 82. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 82 Schematizziamo RADIATORE CARBURATOREBatteria Calcola corrente in uscita BLOCCO MOTORE Calcola potenza trasmessa all’albero Centralina Elabora segnali sensori e gestisce il motore Calcola flusso dell’acqua Calcola miscela Aria benzina
  • 83. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 83 Algoritmo seriale Batteria BLOCCO MOTORE Centralina CARBURATORE RADIATORE
  • 84. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 84 Algoritmo SM Batteria BLOCCO MOTORE Centralina CARBURATORE RADIATORE Rimane quasi uguale, ma è taskizzato! // la fisica dei componenti ma il controllo della centralina è seriale!
  • 85. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 85 Algoritmo MPI Batteria BLOCCO MOTORE Centralina CARBURATORE RADIATORE Sempre taskizzato! Ho solo più memoria per singolo componente!
  • 86. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 86 Algoritmo MPI Batteria BLOCCO MOTORE Centralina CARBURATORE RADIATORE Ognuno chiede quello che gli serve da un altro, meno serializzazione!
  • 87. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 87 2 Livelli di // TASK MPI THREADS OMPBatteria Circuito interno: ogni threads calcola una ramo RADIATORE Tubi paralleli a contatto con l’aria: ogni thread calcola la temperatura di raffreddamento e la pressione in quel tubo BLOCCO MOTORE Più cilindri:ogni thread dato il flusso di benzina calcola potenza CARBURATORE Fisica dei fluidi per mescolamento aria benzina: soluzioni eq Centralina Input sensori: controllo //
  • 88. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Eric Pascolo (OGS) 03/12/2015 88 3 livelli di // BLOCCO MOTORE TASK MPI C1 C2 C3 THREADS OMP VECTORIZATION
  • 89. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Aumentiamo i livelli di // 89 Tutti i sistemi elencati sono distribuiti su più gruppi di task MPI, che lavorano //.
  • 90. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Distribuzione e Run del Software 90
  • 91. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 MARCONI, dettagli tecnici 91 Marconi A1 • 1500 nodi • Intel BRD 2x18 cores, 2.3 GHZ • 128 GB RAM/CN • 2 Pflops • 21 racks • 500 MCoreH/yrs • Modello Lenovo Nextscale Marconi A2 • 3600 nodi • Intel KNL 68 cores, 1.4 GHZ • 96 GB RAM/CN • 11 Pflops • 50 racks • 2000 MCoreH/yrs • Modello Lenovo Adam Pass Marconi A3 • 2300 nodi • Intel SKL 2x24 cores, 2.1 GHZ • 192 GB RAM/CN • 7 Pflops • 30 racks • Modello Lenovo Stark Intel OmniPath 100 Gb/s (Fat –tree) 8 SHARED LOGIN NODES
  • 92. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 HPC e differenti tipi di servizi • HPC Batch • Interactive computing • Hight throughput computing • High performance data Analysis 92
  • 93. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Cloud e differenti tipi di servizi 93 NETWORKING STORAGE SERVERS VIRTUALIZATION OS MIDDLEWARE RUNTIME DATA APPLICATION IT tradizionale NETWORKING STORAGE SERVERS VIRTUALIZATION OS MIDDLEWARE RUNTIME DATA APPLICATION Infrastructure aaS NETWORKING STORAGE SERVERS VIRTUALIZATION OS MIDDLEWARE RUNTIME DATA APPLICATION Platform aaS NETWORKING STORAGE SERVERS VIRTUALIZATION OS MIDDLEWARE RUNTIME DATA APPLICATION Service aaS Da gestire Fornito come Servizio
  • 94. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Servizio CLOUD Supporto ai Workflow che non prevedono solomente tecnologie HPC • Servizi accessori alla produzione HPC • Repository, Continuos Integration • Gestioni delle catene di lavoro • Accesso al HPC su interfacce e no SSH (Engine Frame) • Web server • Dissemination dei dati 94
  • 95. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 95 HPC CLOUD
  • 96. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 HPC costumer environment Creare un ambiente personalizzabile su macchine HPC 96
  • 97. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Come realizzarlo? 97 Virtual Machine Container
  • 98. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Nel dettaglio 98 PHYSICAL HARDWARE LAYER LINUX KERNEL ROOT FILE SYSTEM APP VIRTUAL HD LAYER LINUX KERNEL ROOT FILE SYSTEM HYPERVISOR APP APP APP APP APP APP VIRTUAL MACHINE PHYSICAL HARDWARE LAYER LINUX KERNEL ROOT FILE SYSTEM APP SINGULARITY APP APP APP IMG ROOT FS APP APP APP APP USER NAMESPACE PHYSICAL HARDWARE LAYER LINUX KERNEL ROOT FILE SYSTEM APP DOCKERDEAMON APP APP APP IMG ROOT FS APP APP APP APP DOCKER NAMESPACE
  • 99. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Singularity • Sicurezza :lascia libertà all’utente non compromettendo la sicurezza del cluster • Mobilità: l’utente è libero di importate il suo software su cluster • Riproducibilità: le simulazioni vengono eseguite nello stesso ambiente dovunque • Libertà: lascia l’utente libero di pensare alla simulazione e non ai dettagli tecnici • Flessibilità: permette la creazione dei container partendo da differenti risorse 99
  • 100. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Workflow 100 CREAZIONE FILE IMG BOOTSTRAP IMG: DOCKER,DEB,RPM SYSTEM CONTAINER MODIFICATION CLOUD VM RUN SIMULATION SETUP EXTERNAL ENVIRONMENT, MOUNT FS SHELL USER MOD INTO IMG HPC CLUSTER COPY COPY
  • 101. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Altri dettagli • In un container SINGULARITY l’utente possiede gli stessi diritti che avrebbe sulla macchina. • Con SINGULARITY è possibile lavorare con una SHELL dentro l’immagine o lanciare un comando(exec) • MPI è utilizzabile dall’esterno dell’immagine • All’intero dell’immagine è possibili avere OS,App o Dati • Una volta creata l’immagine si può solo ingrandire • Dal interno dell’immagine si può accedere direttamente al File System parallelo 101
  • 102. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 SPACK : user space package manager • Package manager per HPC software • Prerequisiti : necessita di Python e di un compilatore C • Configurazione: facilmente configurabile, può essere confinato all’interno di un singolo ambiente • Riusabilità e Portabilità: le ricette di installazione di SPACK sono completamente indipendenti dall’hardware 102
  • 103. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Struttura del container 103 ROOT FILE SYSTEM (777 PERMISSION) /SPACK /SPACK/OPT ALL APP /GALILEO MOUNT HOME HERE /SCRATCH MOUNT SCRATCH HERE /ETC /USR /OPT /VAR …… sudo singularity create --size 2048 ubuntu.img sudo singularity bootstrap ubuntu.img Ubuntu.def sudo singularity expand —-size 1024 ubuntu.img singularity shell --shell /bin/bash -w —bind $CINECA_SCRATCH:/scratch ubuntu.img
  • 104. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Performance Confronto run QE 16 task MPI tra Singularity container e su classico nodo HPC (Galileo) 104 0 12,5 25 37,5 50 ALL2ALL FFT ORTHO QE Singularity QE nodo QE Singularity : 744 s QE Nodo : 780 s
  • 105. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Installazione Flessibile 105 CLOUD VM CENTOS Galileo OPENMPI LINPACK CON OPENMPI PRECEDENTEMENTE INSTALLATO QE CON OPENMPI PRECEDENTEMENTE INSTALLATO PROVA DI TUTTI I SOFTWARE RIUSCITA
  • 106. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 3. Spack view, non ricompilare il software 106 COMPILATO QE CON INTEL COMPILER E INTEL MPI DI SISTEMA, AGGIUNTO COME MODULO ESTERNO ALLO SPACK DI SISTEMA CREAZIONE DI UNA SPACK VIEW DI QE INSTALLATO PRECEDENTEMENTE COMPRESSIONE IN TAR.GZ DELLA SPACK VIEW DEREFERENZIANDO I LINK COPIA DEL TAR NELL’IMG SINGULARITY E SCOMPARTIMENTOCOPIA DELL’IMG SU GALILEO CARICAMENTO VIA SHELL DELL’IMG E SISTEMAZIONE LD_LIBRARY_PATH PER INTEL MPI PROVA DI CP.X E VERIFICA DEL SUO FUNZIONAMENTO ALL’INTERNO DELL’IMG
  • 107. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Grazie dell’attenzione Spero di non avermi annoiato troppo! eric.pascolo@cineca.it HPC User Support Group - CINECA 107
  • 108. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Consorzio pubblico di diritto privato: • 70 Atenei • 8 Enti pubblici di Ricerca 109 Attività principali: • Supercalcolo • Supporto al Miur • Supporto agli Atenei • Trasferimento Tecnologico 707 Dipendenti, 3 sedi: Bologna,Milano,Roma
  • 109. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Supercalcolo in Italia Top 500 2017 111
  • 110. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Breve confronto tra sistemi di Supercalcolo 113
  • 111. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 114 Cray I • 1976 -1982-> il computer più potente al mondo! • 135 MegaFLOPS • Progettazione armi nucleari! • 80 MHz • 8 MILIONI $
  • 112. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 Cray I • 1976 -1982-> il computer più potente al mondo! • 135 MegaFLOPS • Progettazione armi nucleari! • 80 MHz • 8 MILIONI $ iPad mini (2012) • Processore A5: 171 MegaFLOP • 2 core (32 bit) • 1 GHz • 329 € 115
  • 113. HPC per l’industria 4.0 - Eric Pascolo03/10/2017 116 Intel Haswell E5-2699 v3 (2014) • 1.2 TeraFLOP • 36 core(64 bit) • 2.30 GHz • 8218€ Nvidia Tesla K20 • 2.9 TeraFLOP • 2x Kepler GK210 • 4992 CUDA core • 24 GB VRAM • 3000 €