Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas...

46
Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET ([email protected]) Yannick KUNEGEL ([email protected])

Transcript of Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas...

Page 1: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

Silicon Graphics, Inc.

Présenté par :

02/03/2005

SGI Proprietary

Développement sur ALTIX

Thomas VARLET ([email protected])

Yannick KUNEGEL ([email protected])

Page 2: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 2| | SGI Proprietary

PLAN :

• Introduction à l'ALTIX – Introduction à l'architecture des systèmes HPC– Présentation hardware de l'ALTIX– Présentation software de l'ALTIX

•Développement sur ALTIX •Utilisation des ALTIX•Comprendre les performances sur ALTIX•Ressources et documentation

Page 3: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 3| | SGI Proprietary

Altix : Présentation Software • Système d’exploitation : Linux 64 bits

– basé sur une RHEL Advance Server + SGI Propack (xfs, Numatools, XSCSI, XVM, PCP, O(1), MPT, SCSL, maj kernel, … ) :

• Propack 2.4 = RHEL AS 2.1 (+kernel 2.4.21) + glibc 2.2.4 + linux threads + ...

• Propack 3.0 = RHEL AS 3.0 (+kernel 2.4.21) + glibc 2.3.3 + Native Posix Threads + ...

• Environnement de développement (cf plus loin):– Compilateurs : Intel (C, C++, F90), mais aussi Gnu (C, C++, f77)– Deboggage : GDB, IDB, DDD– Librairies Scientifiques : SGI SCSL, Intel MKL– Parallélisme :

• MPI et SHMEM : SGI MPT

• OpenMP : compilateurs Intels

– Analyse de performance : PCP, Pfmon, SGI histx ,Intel Vtune, ...

• Administration et Gestion des ressources :– Administration : outils Red Hat / Linux– Exploitation : Numatools– Monitoring systemes : SGI PCP + outils Linux– Traitement par lots : PBS Pro, LSF, ...

SGI

Page 4: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 4| | SGI Proprietary

SGI ALTIX™ : point de vue utilisateur • Sur un système :

– un seul OS :• utilisation optimale de ces ressources.

– les ressources sont partagées :• mémoires, disques, réseau

• La mémoire :– physiquement : distribuée,

– logiquement : un seul espace d'adressage• Altix 350 : jusqu ’a 192Go adressable par un seul processus• Altix 3000 : jusqu ’a 2To adressable par un seul processus

• Entre plusieurs systèmes :– partage des systèmes de fichier XFS : CXFS (si cluster de plusieurs machines), NFS

• Programmation parallèle : – type mémoire distribuée (MPI, SHMEM)

– type mémoire partagée (threads, OpenMP)

– type mixte (MPI+OpenMP)

SGI

Page 5: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 5| | SGI Proprietary

PLAN :

• Introduction à l'ALTIX •Développement sur ALTIX :

– Les compilateurs

– Debbuging

– Bibliothèques optimisés sur ALTIX

•Utilisation des ALTIX

•Comprendre les performances sur ALTIX

•Ressources et documentation

Page 6: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 6| | SGI Proprietary

“Modules”

• Outils de gestion dynamique de l’environnement des utilisateurs :– Sur Origin (IRIX/MIPS) et sur Altix (Linux/Itanium)– Positionne/ supprime les variables d ’environnement nécessaire d’un « logiciel »

• permet de gérer sur un même système plusieurs versions d ’un même outils

– p.ex. :• compilateurs Intel / Gnu

• bibliothèques SCSL, MPT, MKL

• …

– initialise les variables d ’environnement :• PATH, MANPATH

• LD_LIBRARY_PATH, LIBRARY_PATH

• …

– pour tous les utilisateurs d ’un ou plusieurs systèmes,– un utilisateur peut créer ses modules,

Page 7: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 7| | SGI Proprietary

Utilisation de “module”

• Initialisation de l’environnement (dans le “.cshrc” par exemple) :

% source /opt/modules/default/init/[le_shell] (où [le_shell] = csh, sh, bash, …. )

% module load modules (man pages de modules)

• Commandes utiles :

% module avail : affiche la liste des modules disponibles

% module list : affiche la liste des modules chargés

% module load module_name : charge un module (positionne les variables d’env.)

% module unload module_name : “décharge” un module (« dépositionne » les variables d’env.)

% module avail

intel-compilers.7.1.031 scsl-1.4.1rel mkl.7.0.007

intel-fc-8/8.0.050 mpt-1.9-1 modules

intel-cc-8/8.0.070 mpt-1.10totalview.6.3.1-0

% module load mpt-1.10; echo $LD_LIBRARY_PATH

/sw/com/scsl/1.4.1rel/lib:/sw/sdev/mpt-ia64/1.10/lib

% module unload mpt-1.10; echo $LD_LIBRARY_PATH

/sw/com/scsl/1.4.1rel/lib

Page 8: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 8| | SGI Proprietary

• Compilateur GNU :• gcc, g77, g++

• Compilateur Intel® sur Linux pour Itanium2– Positionnement de l’environnement :

• Utilisation de module : module load [nom_module]• Source des fichiers d’initialisation : [install_comp]/bin/[nom_comp]vars.{sh|csh}

– Version : 7.1• efc: compilateur Fortran95• ecc: compilateur C/C++

– Version : 8.0• ifort : compilateur Fortran95• icc : compilateur C/C++

– Version : 8.1• ifort : compilateur Fortran95• icc : compilateur C• icpc : compilateur C++

Les compilateurs

Page 9: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 9| | SGI Proprietary

Compilateur Intel ® : les bases

• Vérification de la validité numérique – désactiver les optimisations spécifiques :

• «-O0» : pas d ’optimisation• «-g» : pour debuging,• «-mp» : limite les optimisations sur les flottants et maintient la précision déclarée, • «-IPF_fltacc» : désactive les optimisations qui affectent la précision des

opérations flottantes,• «-r» «-i» : taille des réels, entiers, booléen

– «-r{4|8}» et «-i{2|4|8}»

• «-CB -traceback» : notifie au runtime les dépassements de tableaux/chaînes de caractères avec des infos (fichier srce + num. ligne)

• Lecture/écriture de fichiers non formatés big/little-endian– Avant l’exécution :

setenv F_UFMTENDIAN big:[#unit] little:[#unit]

– A la compilation (8.x):

  -convert [big_endian|little_endian] 

Page 10: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 10| | SGI Proprietary

Compilateur Intel ® : Pousser le compilateur

• Options :-O0 : pas d’optimisation

-O1 : optimisations qui minimisent la taille

-O2 : default, inlining, un peu de loop pipelining (SWP)

-O3 : plus SWP + prefetching + loop reorg

-ip[o] : interprocedural optimisation (un/plusieurs fichier)

-fast : “-O3 -ipo -static” (version 8.0)

-prof_gen puis -prof_use : Profile guided optimisation

compile avec « -prof_gen » run (création de fichiers de profil) compile avec « -prof_use »

-fno-alias/-fno-fnalias : pas d ’aliasing de pointeurs

-ftz : forcer les sous-dépassements à zéro pour éviter les trappes du système

• Quand ? : bits exposant=0, bits mantisse≠0 (valeur en précision simple < 1.1 e-38)

• Pourquoi ? : Traité par du software (100s de cycles)

Page 11: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 11| | SGI Proprietary

Compilateur Intel ®

• Autres options utiles :– Crée un rapport d ’optimisation :  -opt_report 

– prise en compte des directives OpenMP™ :  -openmp– Parallélisations automatique :  -parallel – Mode verbose :  -v 

– Pour le Fortran :• -free / -fixed : sources au format libre / fixé • -extend_source [72|80|132] : précision du format• -safe_cray_ptr : pas d ’aliasing pour les pointeurs Cray™• -auto : toutes les variables locales sont « automatic  »

(-auto_scalar est le défaut); • -stack_temps (v7.x) : alloue les tableaux temporaire dans la « stack »

– Pour le Fortran (V8.0) :

• -fpe0 : mise à zéro automatique des underflows et crée un

core à l'apparition de tout autre Floating Point Exception

Page 12: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 12| | SGI Proprietary

PLAN :

• Introduction à l'ALTIX •Développement sur ALTIX :

– Les compilateurs

– Debbuging

– Bibliothèques optimisés sur ALTIX

•Utilisation des ALTIX

•Comprendre les performances sur ALTIX

•Ressources et documentation

Page 13: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 13| | SGI Proprietary

Debugging

– En standard :• « gdb » debugger GNU pour C, C++ et Fortran95

– C et C++ : « -g »

– Fortran : « -g » et « -O0 »

– http://sources.redhat.com/gdb/onlinedocs/gdb_toc.html

• « idb » debugger Intel– C, C++, f77, F90

– ni multi-processeurs, ni multi-threads

• « ddd » DataDisplayDebuger (www.gnu.org/software/ddd/), – GUI pour debugger a base de ligne de commande

» supporte gdb et idb

– Fonctionne aussi :• « TotalView »• « DDT »

Page 14: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 14| | SGI Proprietary

Debugging de code (trucs et astuces)

• Compilation (8.x) avec « -traceback », arbre d’appel quand erreur sévère• Exploitation du fichier « core » :

% idb [exécutable] [core_file], puis « where » (arbre d’appel)

• Job MPI :– Vérifications des arguments des appels MPI (!! pour debugger seulement !!) :

% setenv MPI_CHECK_ARGS

– Si le job reçoit un signal « core-dump » :• Affichage d’un arbre d’appel• Variable d’environnement (cf man mpi):

– Réglage du comportement quand signal core-dump : % setenv MPI_COREDUMP [NONE,FIRST,ALL,INHIBIT]– Debugger % setenv MPI_COREDUMP_DEBUGGER

– Utilisation de idb / gdb :• Debugger séquentiels,• Variable d’environnement (cf man mpi):

% setenv MPI_SLAVE_DEBUG_ATTACH [rang_MPI]

• affichage de la commande pour attacher le debugger avec le processus MPI

– Utilisation de Totalview / DDT :% totalview mpirun -a -np 4 a.out

Page 15: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 15| | SGI Proprietary

Problèmes de corruptions de la heap

• Programmes qui utilisent les fonctions malloc/ free

– Variables d’environnement : MALLOC_CHECK_“MALLOC_CHECK_=1” : affichage de message de diag.“MALLOC_CHECK_=2” : abort

• Bibliothèque : Electric Fence– compilation : «-lefence »,

– livré en standard avec RedHat• accès en dehors des zones allouées par malloc• accès à une zone mémoire retournée au système par un appel à free().• détection des problèmes d'alignement.

– ATTENTION : ne marche pas avec MPT !

Page 16: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 16| | SGI Proprietary

PLAN :

• Introduction à l'ALTIX •Développement sur ALTIX :

– Les compilateurs

– Debbuging

– Bibliothèques optimisés sur ALTIX

•Utilisation des ALTIX

•Comprendre les performances sur ALTIX

•Ressources et documentation

Page 17: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 17| | SGI Proprietary

• Intel® Math Kernel Library (MKL V7.0) :– Utilisation : lib. static « -lmkl_ipf » et lib. dyn. « -lmkl »

– BLAS : • BLAS1, BLAS2 , BLAS3 et opération basique sur des vecteurs creux,

– LAPACK, ScaLAPACK, (“-lmkl[_ipf] -lmkl_lapack –lguide -lpthreads“)

– FFTs (Fast Fourier Transforms),

– DFTs (Discrete Fourier Transforms),

– VSL (Vector Statistical Library ) : • ensemble de générateurs de nombre aléatoires

– Vector Math Library (VML) :• fonctions mathématiques sur des vecteurs :

– puissance, trigonométriques, exponentiel, etc...

– PARDISO Direct Sparse Solver : (“-lmkl[_ipf]  -lmkl_solver –lguide -lpthreads“)• Solveur pour des systèmes linéaire creux, symétrique/asymétrique (thread-safe),

• Basé sur le solveur PARDISO (Parallel Direct Solver) de l’ Université de Basel,

– En partie parallélisé en OpenMP (BLAS3, DFTs, FFTs, solveurs, qqs LAPACKS )

Librairies scientifiques

Page 18: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 18| | SGI Proprietary

• SGI Scientifique Computing Software Library (SCSL V1.5)– utilisation :

• édition de lien : « -lscs », « -lscs_i8 » et « -lsdsm » (SCALAPACK)

– Traitement du signal : • FFT • opérations de filtrage linéaire (convolution, correlation)

– Fonctions BLAS :• BLAS1, BLAS2 , BLAS3

– LAPACK, ScaLAPACK

– Solveur pour des matrices creuses :• Solveur direct pour résolution de systèmes linéaires creux

– symétrique et non symétrique,

– double precision et complex.

• plusieurs types possible de renumérotation• “in-core” et “out-of-core”

– parallélisé en OpenMP• « -lscs_mp », « -lscs_i8_mp » et « -lsdsm_mp » (SCALAPACK)

Librairies scientifiques

Page 19: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 19| | SGI Proprietary

Message Passing Toolkit (MPT 1.10)

• Message Passing Interface :– SGI MPI est une versions optimisé pour Altix de MPI,– Conformité complète au standard MPI 1.2– Conformité partielle au standard MPI 2

• Parallel I/O• One sided put/get model messaging• MPI_Comm_spawn/MPI_Comm_spawn_multiple• MPI_Alloc_mem/MPI_Free_mem• Transfer handles• Replacements for deprecated MPI-1 functions• Generalized Requests

– utilisation : • edition de lien : « -lmpi » (pr C++ : « -lmpi++ » )

– Latence : 1.5 secondes– Débit : 1.5 Go/s

• SHMEM :– Logically Shared, Distributed Memory (SHMEM) SHMEM data passing– «  one-sided communication  », un processus écrit/lit des données dans la mémoire

d ’un autre processeur sans que ce dernier intervienne directement,

Page 20: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 20| | SGI Proprietary

PLAN :

• Introduction à l'ALTIX •Développement sur ALTIX

•Utilisation des ALTIX– Lancement des jobs– Outils NUMA– Tunning

•Comprendre les performances sur ALTIX•Ressources et documentation

Page 21: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 21| | SGI Proprietary

Configuration du système : hinv

– Utilisation : Usage: /usr/bin/hinv [-v] [-c class ] [-b [BrickID] ] Class are: serial processor otherscsi scsi memory io9 otherpci ethernet

– Par exemple : profit.engr.sgi.com {576}-> hinv

Sorry only root user can get scsi information from /dev/xscsi/pci01.01.0/target0/lun0/ds

0 P-Brick

4 R-Brick

8 C-Brick

4 1000 MHz Itanium 2 Rev. 7 Processor

28 1000 MHz Itanium 2 Rev. 6 Processor

Main memory size: 114.05 Gb

IO9 Controller Card (Silicon Graphics, Inc.) (rev 69). on pci01.01.0

QLogic 12160 Dual Channel Ultra3 SCSI (Rev 6) on pci01.03.0

Disk Drive: unit 1 on SCSI controller pci01.03.0-1

Disk Drive: unit 2 on SCSI controller pci01.03.0-1

BROADCOM Corporation NetXtreme BCM5701 Gigabit Ethernet (rev 21). on pci01.04.0

SCSI storage controller: QLogic Corp. QLA2200 (rev 5). pci02.01.0

Disk Drive: unit 34 lun 0 on SCSI controller pci02.01.0 0

Disk Drive: unit 35 lun 0 on SCSI controller pci02.01.0 0 ….

Page 22: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 22| | SGI Proprietary

Configuration du système : “/proc”

• « uname -a » :

Linux bigbang 2.4.21-sgi240rp04080615_10094 #1 SMP Fri Aug 6 16:01:54 PDT 2004 ia64 unknown

• « /proc/cpuinfo » : info. sur les processeurs,

• « /proc/meminfo » : info. général sur la mémoire du système,

• « /proc/discontig » : utilisation de la mémoire en page par nœuds,profit : more /proc/discontig

node total free

0 507904 368360

1 507904 489235

2 507904 487940

• « /proc/pal/cpu0/cache_info » : structure cache L1, L2, et L3,

• « /proc/version » : information sur le kernel% more /proc/version

Linux version 2.4.21-sgi240rp04080615_10094 ([email protected]) (gcc version 2.96 20000731

(Red Hat Linux 7.2 2.96-118.7.2)) #1 SMP Fri Aug 6 16:01:54 PDT 2004

Version kernel Version ProPack + patch

Page 23: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 23| | SGI Proprietary

Configuration du système : “/proc”

• « /proc/mounts » : information sur les systèmes de fichiers montés• « /proc/modules » : module du kernel

• « topology » :

profit.engr.sgi.com {582}-> topology

Machine profit.engr.sgi.com has: 32 cpu's16 memory nodes4 routers

The cpus are:cpu 0 is /dev/hw/module/004c05/slab/0/node/cpubus/0/acpu 1 is /dev/hw/module/004c05/slab/0/node/cpubus/0/c ...

The nodes are:node 0 is /dev/hw/module/004c05/slab/0/node...The routers are:/dev/hw/module/004r14/slab/0/router

The topology is defined by:/dev/hw/module/004c05/slab/0/node/link/1 is /dev/hw/module/004c05/slab/1/node.../dev/hw/module/004c05/slab/0/node/xtalk/0/link -> /dev/hw/module/004c05/slab/0/IXbrick.../dev/hw/module/004r14/slab/0/router/1 -> /dev/hw/module/004r24/slab/0/router

profit.engr.sgi.com {628}-> more /proc/modulesvtune_drv-2.4.19-sgi212r2smp 275056 0 (unused)arsess 37872 1nls_iso8859-1 6048 1 (autoclean)nls_cp437 7728 1 (autoclean)qlfc_mod 539312 6

xpnet 13392 0 (unused)xpmem 118448 0numatools 13904 1xpc 140688 0 (unused)xp 7816 0 [xpnet xpmem xpc]xvm-standalone 698528 0

Page 24: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 24| | SGI Proprietary

Lancement des jobs

• Un seul OS qui gére jusqu ’a 256 cpu et 2 To de mémoire :– simplicité d ’utilisation !– utilisations d ’outils Numa pour optimiser le temps d exécution en charge

• Séquentiels : ./a _seq.exe – temps du job : « time »

• MPI :mpirun -np [NB_MPI] ./a_mpi.exe– statistiques MPI : « setenv MPI_VERBOSE on »

• OpenMP :– nombre de threads OpenMP :

setenv OMP_NUM_THREADS [NB_OMP]

./a_omp.exe

Page 25: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 25| | SGI Proprietary

PLAN :

• Introduction à l'ALTIX •Développement sur ALTIX •Utilisation des ALTIX

– Lancement des jobs– Outils NUMA– Tunning

•Comprendre les performances sur ALTIX

•Ressources et documentation

Page 26: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 26| | SGI Proprietary

Numatools : cpuset

• Système de réservation de ressource :– CPU (mémoire)– Mécanisme dynamique – Création par admin. (ou système de batch), pour les jobs utilisateurs,

• Toujours un seule OS et une seule machine– Accès aux autres ressources de la machine

• Propriété :– Notion d’étanchéité (≈ GORE-TEX)– Allocation préférentielle des ressources locales (mémoire)

• Usage :– Partitionnement soft. du système– « garantie » des ressources cpu (mémoire)– Limite les perturbations entre les jobs tournant sur le système

Page 27: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 27| | SGI Proprietary

Numatools : dlook

dlook [-a] [-c] [-h] [-l] [-o outfile] [-s secs] command [command-args]

dlook [-a] [-c] [-h] [-l] [-o outfile] [-s secs] pid

• Pour un processus:– informations sur la répartition mémoire

• Pour chaque page de l’espace d’adressage :– L’objet au quel appartient la page :

» fichier, SYSV, mémoire partagé,drivers, …

– Le type de page : » Random acess memory (RAM), FETCHOP, IOSPACE

– Si la page est de type RAM :» Attribut (SHARED, DIRTY, …),

» Le nœud où est localisé la page,

» Adresse physique de la page

– Utilisation du CPU.• Temps elapsed, temps system du processus.

Page 28: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 28| | SGI Proprietary

Numatools : dlookdlook 4702

Peek: sleep Pid: 4702 Thu Aug 22 10:45:34 2002

Cputime by cpu (in seconds): user system TOTAL 0.002 0.033 cpu1 0.002 0.033

Process memory map:

2000000000000000-2000000000030000 r-xp 0000000000000000 04:03 4479 /lib/ld-2.2.4.so [2000000000000000-200000000002c000] 11 pages on node 1 MEMORY|SHARED

2000000000030000-200000000003c000 rw-p 0000000000000000 00:00 0 [2000000000030000-200000000003c000] 3 pages on node 0 MEMORY|DIRTY

...

2000000000128000-2000000000370000 r-xp 0000000000000000 04:03 4672 /lib/libc-2.2.4.so [2000000000128000-2000000000164000] 15 pages on node 1 MEMORY|SHARED [2000000000174000-2000000000188000] 5 pages on node 2 MEMORY|SHARED

mpirun -np 2 dlook -o dlook.out ft.C.2 Contents of dlook.out:

_______________________________________________________________________________ Exit: ft.C.2Pid: 2306 Fri Aug 30 14:33:37 2002 Process memory map:

2000000000030000-200000000003c000 rw-p 0000000000000000 00:00 0 [2000000000030000-2000000000034000] 1 page on node 21 MEMORY|DIRTY [2000000000034000-200000000003c000] 2 pages on node 12 MEMORY|DIRTY|SHARED

2000000000044000-2000000000060000 rw-p 0000000000000000 00:00 0 [2000000000044000-2000000000050000] 3 pages on node 12 MEMORY|DIRTY|SHARED_______________________________________________________________________________Exit: ft.C.2 Pid: 2310 Fri Aug 30 14:33:37 2002 Process memory map: 2000000000030000-200000000003c000 rw-p 0000000000000000 00:00 0 [2000000000030000-2000000000034000] 1 page on node 25 MEMORY|DIRTY [2000000000034000-200000000003c000] 2 pages on node 12 MEMORY|DIRTY|SHARED

2000000000044000-2000000000060000 rw-p 0000000000000000 00:00 0 [2000000000044000-2000000000050000] 3 pages on node 12 MEMORY|DIRTY|SHARED [2000000000050000-2000000000054000] 1 page on node 25 MEMORY|DIRTY

Page 29: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 29| | SGI Proprietary

Numatools : dplace

• Permet de contrôler les placements des processus sur les processeurs

dplace [-c cpu_numbers] liste des CPU (« -c0 », « -c2-4 » ou « -c1,4-8,3 » ) [-s skip_count] nombre de processus a passer avant le placement [-n process_name] spécification du nom des processus a placer [-x skip_mask] (bitmask) pour ne pas placer certains processus (PP2.4) N=6 : 1er thread sur le 1er CPU, pas pour 2nd et

3ème, etc…

[-p placement_file] pas encore implémenté,

command [command-args] commande

– le scheduling et le placements mémoire sont déterminés en fonction

des arguments de « dplace » :

• Si possible : allocation de la mémoire sur le nœuds (physique)

• Le processus est fixé sur le nœud désigné,

– Le placement explicite sur des CPU n’est pas obligatoire

Page 30: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 31| | SGI Proprietary

PLAN :

• Introduction à l'ALTIX •Développement sur ALTIX •Utilisation des ALTIX

– Lancement des jobs (séquentiel, MPI, OpenMP)– Outils NUMA (dlook, dplace, cpuset, ...)– Exploitation

– Tunning (séquentiel, parallèle)

•Comprendre les performances sur ALTIX

•Ressources et documentation

Page 31: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 32| | SGI Proprietary

Les outils de profiling

•Où passe t-on du temps ???– « time » :

• temps user, elapsed, system

– « gprof »: • code source compile avec “-p”,• execution de l’application,• compte-rendu d'exécution pour les programmes C ou Fortran

– « ja »– « histx » 

• Profil de code + exploitation des compteurs de l’Itanium

– Vtune : • Outil Intel de monitoring de code,

Page 32: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 33| | SGI Proprietary

Tunning MPI

– Statistiques MPI : • Nombre d’appels, quantité d’informations échangées, …

– « setenv MPI_STATS 1»– « mpirun -stats -prefix “%g:” -np 8 a.out »

3: *** Dumping MPI internal resource statistics...3:3: 0 retries allocating mpi PER_PROC headers for collective calls3: 0 retries allocating mpi PER_HOST headers for collective calls3: 0 retries allocating mpi PER_PROC headers for point-to-point calls3: 0 retries allocating mpi PER_HOST headers for point-to-point calls3: 0 retries allocating mpi PER_PROC buffers for collective calls3: 0 retries allocating mpi PER_HOST buffers for collective calls3: 0 retries allocating mpi PER_PROC buffers for point-to-point calls3: 0 retries allocating mpi PER_HOST buffers for point-to-point calls3: 0 send requests using shared memory for collective calls3: 6357 send requests using shared memory for point-to-point calls3: 0 data buffers sent via shared memory for collective calls3: 2304 data buffers sent via shared memory for point-to-point calls3: 0 bytes sent using single copy for collective calls3: 0 bytes sent using single copy for point-to-point calls3: 0 message headers sent via shared memory for collective calls3: 6357 message headers sent via shared memory for point-to-point calls3: 0 bytes sent via shared memory for collective calls3: 15756000 bytes sent via shared memory for point-to-point calls

Page 33: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 34| | SGI Proprietary

Tunning MPI

• Placements NUMA :

– « setenv MPI_DSM_CPU_LIST …. »» Exemple 1 : setenv MPI_DSM_CPULIST 4,5

mpirun -np 2 a.out

» Exemple 2 : setenv MPI_DSM_CPULIST 32-63:0-31

mpirun -a arrayname hosta, hostb -np 32 a.out

– « setenv MPI_DSM_MUSTRUN » (MPT1.9 = MPI_DSM_DISTRIBUTE)» Distribution des processus sur le système ou dans le CPUSET

– dplace, cpuset, ...

• Single copy : – pour des applications sensibles à la bande passante, utilisation du

module xpmem pour mapper de la mémoire entre processus,

– « setenv MPI_BUFFER_MAX 2000 »

Page 34: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 35| | SGI Proprietary

Tunning MPI

• Eliminer les « retries » : – Les communications point à point sont bufferisées

– Si les stat. MPI donnent un grand nombre de « retries » : » Attente d’entrée de buffers,

– MPI_BUFS_PER_PROC, – MPI_BUFS_PER_HOSTS,– MPI_MSGS_PER_HOSTS.

• SHMEM : « -lsma »– inter-partition (depuis MPT 1.8)

– éliminer l’overhead du aux appels MPI

– Bande-passante,

• Inter-Partitions : – Utilisation du driver XPMEM

Page 35: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 36| | SGI Proprietary

Tunning OpenMP• La Bibliothèque “run-time library” est libguide, développé par KAI

– construit sur linuxthreads, linké automatiquement par le compilateur

• Autres flags:– Affiche des diagnostics avec -openmp_report[0|1|2]

• 0: pas de diagnostics• 1: boucles, regions, et sections parallélisé avec sucés (default)• 2: affiche d ’autres informations sur les autres constructions OpenMP

– -openmp_profile

• Edition de lien avec des « runtimes » qui supporte les composantes OpenMP de VTune™

• Variables d ’environnement :– KMP_STACKSIZE:

• stack privée des threads ( le défaut est de 4 Mo sur Itanium)– KMP_LIBRARY: mode d exécution « runtime »

• serial – exécution mono-processeur.

• throughput – (défaut) pour environnement multi-utilisateur, libère le processeurs pour d ’autres

processus quand la threads OpenMP est en attente (équivalent sur IRIX : _DSM_WAIT=YIELD)

• turnaround – les threads ne libère pas le processeurs quand elles sont en attente de travail

(équivalent sur IRIX : _DSM_WAIT=SPIN)

Page 36: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 37| | SGI Proprietary

PLAN :

• Introduction à l'ALTIX

•Développement sur ALTIX

•Utilisation des ALTIX

•Comprendre les performances sur ALTIX– Observer le comportement de la machine– Observer le comportement du code

•Ressources et documentation

Page 37: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 38| | SGI Proprietary

Performance Co-PilotPerformance Co-Pilot• Architecture client/serveur pour un contrôle centralisé de calcul distribué,

– Possibilité de surveiller plusieurs hôtes.– Données temps réelles et historiques.– Monitoring automatisé des performances.

– Composantes :• Collecteur :

– Collecte des données de performance,• Moniteur :

– archivage + visualisation des données,

– Données récupérées (+700 métriques)• Instrumentation Hardware,• Noyau de l’OS• Librairies• Service layers, daemons, etc.• Applications

–  % pmchart -h [host] • visualisation de compteur du système

–  % pmgcluster [host] / pmgsys • visualisation rapide de la charge du système

Page 38: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 39| | SGI Proprietary

PLAN :

• Introduction à l'ALTIX

•Développement sur ALTIX

•Utilisation des ALTIX

•Comprendre les performances sur ALTIX– Observer le comportement de la machine– Observer le comportement du code

•Ressources et documentation

Page 39: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 40| | SGI Proprietary

lipfpm (Linux IPF Performance Monitor)

• lipfpm permet d'obtenir les valeurs des compteurs de l’Itanium pour l'exécution d’une application

• utilisation du cache L2 et le Mflop :lipfpm -e FP_OPS_RETIRED -e L2_MISSES -e L2_REFERENCES $COMMANDE

lipfpm summary====== =======Retired FP Operations...................................... 152499228284L2 Misses.................................................. 3159051506Requests Made To L2........................................ 69829240763CPU Cycles................................................. 348231157730Percentage of L2 misses.................................... 0.0452397Average MFLOP/s............................................ 569.303Average MB/s requested by L2............................... 1509.53

• utilisation du cache L3 et des debits des accès en mémoirelipfpm -e FP_OPS_RETIRED -e L3_READS.DATA_READ.ALL \

-e L3_READS.DATA_READ.MISS $COMMANDElipfpm summary====== =======Retired FP Operations...................................... 152499228205L3 Reads -- L3 Load References ............................ 2499734811L3 Reads -- L3 Load Misses ............................... 1712387197CPU Cycles................................................. 348636126093Average MFLOP/s............................................ 568.642Average data read MB/s requested by L3..................... 817.303

Page 40: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 41| | SGI Proprietary

lipfpm (Linux IPF Performance Monitor)

• Nombre d’instruction moyen par cycle et le Mflop :

lipfpm -f -e FP_OPS_RETIRED -e L2_MISSES -e IA64_INST_RETIRED.THIS ./a.out

lipfpm summary ====== ======= Retired FP Operations...................................... 2001011274 L2 Misses.................................................. 15960698 Retired IA-64 Instructions -- Retired IA-64 Instructions... 3016657827 CPU Cycles................................................. 753810840 Average number of Itanium instructions per cycle........... 4.000188 Average MFLOP/s............................................ 3981.079059 Average MB/s requested by L2............................... 4065.02825

• Avec des applications OpenMP : %setenv OMP_NUM_THREADS 4 (le défault est 16)

%lipfpm -e [compteur] -o toto ./a.out

– Création de 4+1 fichiers (toto.a.out.pid1, toto.a.out.pid2, etc).

• Avec des applications MPI : % mpirun -np 4 /opt/sgi/histx+/1.1/bin/lipfpm –f -e [evenements] … -o fp ./a.out

– Création de 4+1 fichiers “fp.a.out.pid”.

Page 41: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 42| | SGI Proprietary

histx : HISTogram eXecution

– histx (SGI) permet de comprendre : • où est passé le temps,• où sont générés les événements de performances.

– Compiler le code avec -g

– Mode « instruction pointer » : <count>: <library>:<function> [<file>:<line>]

– Par ligne : « -l » : <count>: [<file>:<line>] (library)

– Mode « callstack » : <count> <N> <library1>:<function1> [<file1>:<line1>]

...

<libraryN>:<functionN> [<fileN>:<lineN>]

– Rapport séparé pour chaque pthread, thread OpenMP, ou processus MPI.

Page 42: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 43| | SGI Proprietary

histx : HowTo

• Mode : IP Sampling – format : <count>: <library>:<function> [<file>:<line>]

histx -f -o [nom_fichier_histx] [COMMANDE]

• Mode : IP Sampling + info par ligne – format :<count>: [<file>:<line>] (library)

histx -l -f -o [nom_fichier_histx] [COMMANDE]

• Exploitation des fichiersiprep [nom_fichier_histx] > [nom_fichier_formaté]

En c++ : iprep [nom_fichier_histx] | c++filt > [nom_fichier_formaté]

• Mode : Callstack– format :< count> <N>

<library1>:<function1> [<file1>:<line1>] <library2>:<function2> [<file2>:<line2>] … <libraryN>:<functionN> [<fileN>:<lineN>]

histx -o [nom_fichier_histx] -s callstack10 [COMMANDE]

• Exploitation des fichierscsrep [nom_fichier_histx] > [nom_fichier_formaté]

Page 43: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 44| | SGI Proprietary

Histx : Exemple

% histx -f -l -o out_histx ./a.out

% iprep < out_histx.a.out.29591 > prof.out

Count Self% Cum.% Name

-------------------- ------- ------- --------------------

25007 46.383 46.383 a.out:prod_mat_trans_ [libmat-art.f:659]

12815 23.769 70.152 a.out:prod_mat_ [libmat-art.f:630]

4195 7.781 77.933 libmpi.so:MPI_SGI_shared_progress

3275 6.074 84.008 a.out:comp_mat_ligne_ [libmat-art.f:350]

2067 3.834 87.842 libmpi.so:MPI_SGI_request_test

Page 44: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 45| | SGI Proprietary

Profiling de code MPI : perfcatcher• Profile des appels aux fonctions MPI :

– Code qui « scale » mal– Grand nombre de fonctions MPI dans un histx

• Utilisation :– Refaire l’édition de lien avec la librairie de profil– Création d’un fichier «  MPI_PROFILING_STATS  »

Summary counts and timingsTotal job time 1.035689e+01 secTotal MPI processes 2Wtime resolution is 4.000000e-08 sec

activity on process rank 0 comm_rank calls 2 time 5.080001e-06 recv calls 12 time 4.54182e+00 avg datacnt 61516459 \

waits 11 wait time 2.01604e-03 barrier calls 10 time 4.252240e-03

…recv profile

cnt/sec for all remote rankslocal ANY_SOURCE 0 1

rank 0 0/0.0e+00 0/0.0e+00 12/4.5e+00 1 0/0.0e+00 11/4.5e+00 0/0.0e+00

Page 45: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 46| | SGI Proprietary

PLAN :

• Introduction à l'ALTIX

•Développement sur ALTIX

•Utilisation des ALTIX

•Comprendre les performances sur ALTIX

•Ressources et documentation

Page 46: Silicon Graphics, Inc. Présenté par : 02/03/2005 SGI Proprietary Développement sur ALTIX Thomas VARLET (tvarlet@sgi.com) Yannick KUNEGEL (ykunegel@sgi.com)

23/02/2005 Page 47| | SGI Proprietary

Pour en savoir plus …

• man pages :• efc, ecc, ...• mpi, scsl, ...• pfmon, histx, ...• cpuset, dplace, ...

• Documents PDF :– Documentation sur les compilateurs dans le répertoire d’installation.

• Site SGI, Techpubs : http://techpubs.sgi.com/ – « Linux® Application Tuning Guide  » Document Numéro : 007-4639-003 – « Message Passing Toolkit (MPT) User's Guide  » Document Numéro : 007-3773-001

• Site Intel : http://developer.intel.com/– « Scientific Computing on Itanium®-based Systems  » Intel Press

– « Introduction to Microarchitectural Optimization for Itanium® 2 Processors  » Document Numéro : 251464-001

• Web de clients SGI :– CALMIP : http://www.calmip.cict.fr/spip/ – NASA NAS : http://www.nas.nasa.gov/User/Systemsdocs/Altix/altix.html– Texas A&M Supercomputing Facility : http://sc.tamu.edu/help/altix/

• Equipes SGI …