![Page 1: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/1.jpg)
Aurelio Rodrí[email protected]
![Page 2: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/2.jpg)
Agenda
Administración: (1 horas)
Instalación: Procedimiento, actualización y detalles de interésConfiguración entorno: Variables de entorno de interés.
Compiladores: (4 horas)
Intel C++ Compiler XE 14.0IntroducciónEjemplos básicos de compilaciónOpciones avanzadas:Ejemplos optimizaciones: HLO, IPO y PGOEjemplos soporte OpenMPEjemplos compatibilidad y portabilidadEjemplos paralelización y vectorización automáticaIntel Fortran Compiler XE 14.0Introducción y ejemplos básicos ejecución.
![Page 3: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/3.jpg)
Intel Debugger: (2 horas)
IntroducciónUso a través de la GUI/eclipse/CLIEjemplos de uso en aplicaciones paralelas: multihilo (OpenMP) y MPI
Intel Math Kernel Library: (2 horas)
IntroducciónLinkadoEjemplos de rendimientoUso ScaLAPACK
Intel MPI: (1 hora)
IntroducciónReferencia de comandos: compilador, ejecución, gestión de procesos, información del procesador. Ejemplos.
Agenda
![Page 4: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/4.jpg)
Intel MPI: (1 hora)
Tuning: automático, pinning y binding y variables de entorno. Ejemplos.
Intel Trace Analyzer and Collector: (1 hora)
IntroducciónCollector: Uso, Instrumentación a nivel de usuario. Ejemplos.Analyzer: Introducción, GUI, CLI y conceptos. Ejemplos.
Benchmarks: (3 horas)
¿Casos de usuario?Rendimiento compiladores, MKL y MPI.Benchmarks sintéticos y aplicaciones.
Agenda
![Page 5: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/5.jpg)
Última versión de la documentación en:
https://oc.cesga.es/public.php?service=files&t=03888d31fc9363a06320aad01c2f2c6e
http://goo.gl/rC7fqE
Documentación Actualizada
![Page 6: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/6.jpg)
Administración: (1 horas)
Instalación: Procedimiento, actualización y detalles de interésConfiguración entorno: Variables de entorno de interés.
Compiladores: (4 horas)
Intel C++ Compiler XE 14.0IntroducciónEjemplos básicos de compilaciónOpciones avanzadas:Ejemplos optimizaciones: HLO, IPO y PGOEjemplos soporte OpenMPEjemplos compatibilidad y portabilidadEjemplos paralelización y vectorización automáticaIntel Fortran Compiler XE 14.0Introducción y ejemplos básicos ejecución.
Agenda
![Page 7: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/7.jpg)
Administración: Instalación
Registro de la licencia:
Ver documento adjunto (DO_Registro_intel.pdf)
Requisitos previos: paquetes de desarrollo gnu (especialmente gcc-c++)Oracle JDK
Descarga de productos: completa + de 3GBSe recomienda el uso del “online installer” siempre que se tenga acceso a internet en el servidor de instalación.
Intel Cluster Studio 2013_sp1 for Linux
Intel® C++ Composer XE for Linux l_ccompxe_online_2013_sp1.0.080.sh
Intel® Fortran Composer XE for Linux
l_ccompxe_online_2013_sp1.0.080.sh
Intel® MPI Library l_mpi_p_4.1.1.036.tgz (install.sh)
Intel® Trace Analyzer and Collector l_itac_p_8.1.3.037.tgz (install.sh)
![Page 8: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/8.jpg)
Directorios:/apps/intel
bin : comandos principalescomposerxe : link a composer_xe_2013_sp1composer_xe_2013_sp1 : Contiene links a la ultima release de la versióncomposer_xe_2013_sp1.0.080 : Ultima versiónimpi : Directorio con las versiones de impi include : link a composerxe/includeipp : link a composerxe/ipp (itac : directorio de versiones del Trace analyzer and Collectorlib : link a composerxe/lib (librerías de los compiladores)man : link a composerxe/man (man pages)mkl : link a composerxe/mkl (Intel MKL)mpirt : link a composerxe/mpirt (Intel MPI runtime) tbb : link a composerxe/tbb (Threads building blocks)
Administración: Instalación
![Page 9: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/9.jpg)
Administración: Entorno
Variables de entorno:
source /apps/intel/composerxe/bin/compilervars.sh(configura compiladores, debugger, mkl, ipp y tbb)
source /apps/intel/impi/4.1.1.036/bin64/mpivars.sh(configura impi)
source /apps/intel/itac/8.1.3.037/bin/itacvars.sh(configura itac)
Todas recogidas en el script /apps/intel/env.sh
![Page 10: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/10.jpg)
Agenda
Administración: (1 horas)
Instalación: Procedimiento, actualización y detalles de interésConfiguración entorno: Variables de entorno de interés (si utilizan modules, se incluirá la información para su configuración).
Compiladores: (4 horas)
Intel C++ Compiler XE 14.0IntroducciónEjemplos básicos de compilaciónOpciones avanzadas:Ejemplos optimizaciones: HLO, IPO y PGOEjemplos soporte OpenMPEjemplos compatibilidad y portabilidadEjemplos paralelización y vectorización automáticaIntel Fortran Compiler XE 14.0Introducción y ejemplos básicos ejecución.
![Page 11: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/11.jpg)
Compiladores: Intel C++
Rendimiento tanto en serie como paralelo para procesadores Intel.
●Introduce facilidades para la vectorización y la programación paralela para simplificar el desarrollo de aplicaciones con alto rendimiento.●Destacan entre estas características el soporte de nuevas funcionalidades de OpenMP 4.0 y la posibilidad de autoparalelización. ●Mantiene compatibilidad con los compiladores más usados.
Documentación completa: http://software.intel.com/en-us/compiler_14.0_ug_c
![Page 12: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/12.jpg)
Compiladores: Intel C++
http://software.intel.com/intel_c_composer_xe_pb_en
![Page 13: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/13.jpg)
Compiladores: Intel C++
INT:Intel Compiler 14.0: C/C++: -xAVX -ipo -O3 -no_prec-div -static -parallel -opt-prefecth -auto-p32GCC 4.8.1:C: -m64 -Ofast -ffast-math -flto -march=native -mfpmath=sse -funroll-all-loops -static -ftree-parallelize-loops=16C++: m64 -Ofast -ffast-math -flto -march=native -mfpmath=sse -funroll-all-loopsFP Speed:Intel Compiler 14.0:C/C++: -xAVX -ipo -O3 -no_prec-div -static -parallel -opt-prefecth -ansy-aliasGCC 4.8.1:C: -m64 -Ofast -ffast-math -flto -march=native -mfpmath=sse -funroll-all-loops -static -ftree-parallelize-loops=16C++: m64 -Ofast -ffast-math -flto -march=native -mfpmath=sse -funroll-all-loops
![Page 14: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/14.jpg)
Agenda
Administración: (1 horas)
Instalación: Procedimiento, actualización y detalles de interésConfiguración entorno: Variables de entorno de interés (si utilizan modules, se incluirá la información para su configuración).
Compiladores: (4 horas)
Intel C++ Compiler XE 14.0Introducción
Ejemplos básicos de compilaciónOpciones avanzadas:Ejemplos optimizaciones: HLO, IPO y PGOEjemplos soporte OpenMPEjemplos compatibilidad y portabilidadEjemplos paralelización y vectorización automáticaIntel Fortran Compiler XE 14.0Introducción y ejemplos básicos ejecución.
![Page 15: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/15.jpg)
Compiladores: Intel C++
Uso básico:
Comandos: ‘icc’ para C, y ‘icpc’ para C++
Opciones “-O” compatibles con gcc pero no idénticos
-O2 es el nivel de optimización por defecto (en gcc es -O0)
-O* no implica los mismos conjuntos de opciones para gcc que para Intel pero los conceptos son similares:
-O0 : para depuración-O2 : por defecto-O3 : optimizaciones avanzadas
icc –help, icpc -help proporciona la lista extensa de opcionesman iccman icpc
Preprocessing
Semantic parsing
Optimization
Code generation
Linking
![Page 16: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/16.jpg)
Compiladores: Intel C++
Ejemplos:
Compilar matrix.c sin optimización y con -O1 y comparar resultados
Ejecutar y comparar tiempos.
/apps/intel/composerxe/Samples/en_US/C++/optimize
Compilar int_sin.c con -O0 y -O1
Ejecutar y comparar resultados.
![Page 17: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/17.jpg)
Agenda
Administración: (1 horas)
Instalación: Procedimiento, actualización y detalles de interésConfiguración entorno: Variables de entorno de interés (si utilizan modules, se incluirá la información para su configuración).
Compiladores: (4 horas)
Intel C++ Compiler XE 14.0IntroducciónEjemplos básicos de compilación
Opciones avanzadas:Ejemplos optimizaciones: HLO, IPO y PGOEjemplos soporte OpenMPEjemplos compatibilidad y portabilidadEjemplos paralelización y vectorización automáticaIntel Fortran Compiler XE 14.0Introducción y ejemplos básicos ejecución.
![Page 18: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/18.jpg)
Compiladores: Intel C++
Disable optimization -O0Optimize for speed (no code size increase) -O1Optimize for speed (default) -O2High-level optimizer, including prefetch, unroll
-O3
Create symbols for debugging -gInter-procedural optimization -ipoProfile guided optimization (muli-step build) -prof-gen
-prof-useOptimize for speed across the entire program **warning: -fast def’n changes over time
-fast (-ipo -O3 -no-prec-div -static -xHost)
OpenMP support -openmpAutomatic parallelization -parallel
![Page 19: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/19.jpg)
Compiladores: Intel C++ y optimizaciones HLO
“High-Level Optimizer” (HLO):
Opciones de Compilación: -O2 y -O3
Optimizaciones a nivel de lazo/bucle:
Loop unrolling Cache blockingPrefetching
Análisis de dependencias agresivo: Determina si es seguro o no reordenar o paralelizar ciertas ordenes
Substitución de escalares:Su objetivo es reducir referencias a memoria con referencias a registros
![Page 20: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/20.jpg)
Ejemplos:
Compilar matrix.c con -O[2|3] sin vectorización y comparar resultados
Ejecutar y comparar tiempos.
/apps/intel/composerxe/Samples/en_US/C++/optimize
Compilar int_sin.c con -O2 y -O3 sin vectorización
Ejecutar y comparar resultados.
Compiladores: Intel C++ y optimizaciones HLO
![Page 21: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/21.jpg)
Ver man page: man icc
-O3:Performs O2 optimizations and enables more aggressive loop transformations such as Fusion, Block-Unroll-and-Jam, and collapsing IF statements.
This option may set other options. This is determined by the compiler, depending on which operating system and architecture you are using. The options that are set may change from release to release.
When O3 is used with options -ax or -x (Linux OS) or with options /Qax or /Qx (Windows OS), the compiler performs more aggressive data dependency analysis than for O2, which may result in longer compilation times.
The O3 optimizations may not cause higher performance unless loop and memory access transformations take place. The optimizations may slow down code in some cases compared to O2 optimizations.
The O3 option is recommended for applications that have loops that heavily use floating-point calculations and process large data sets.
Compiladores: Intel C++ y optimizaciones HLO
![Page 22: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/22.jpg)
Interprocedural optimization (IPO): Análisis topológico de la aplicación
-ip : Sólo para el fichero fuente actual.
-ipo :Optimizaciones a través de todos o varios ficheros
Compiladores: Intel C++ y optimizaciones IPO
Enabled optimizations:●Procedure inlining (reduced function call overhead)●Procedure reordering●Interprocedural dead code elimination and constant propagation●Enhances optimization when used in combination with other compiler features
Especialmente código con muchas funciones pequeñas se beneficia de IPO
![Page 23: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/23.jpg)
Interprocedural optimization (IPO): Análisis topológico de la aplicación
Es un proceso en 2 pasos:
Compiladores: Intel C++ y optimizaciones IPO
Paso 1
Paso 2
Objeto temporal
Ejecutable
Compilar: icc -c -ipo main.c func1.c func2.c
linkar: icc -ipo main.o func1.o func2.o
![Page 24: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/24.jpg)
Ejemplos:
Compilar matrix.c con -ipo y comparar resultados con sólo la opción -O3
Alguna mejora?
Compilar pi.c y la función externa fx.c sin -ipo y con -ipo
Ejecutar y comparar tiempos.
Compiladores: Intel C++ y optimizaciones IPO
![Page 25: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/25.jpg)
“Profile-Guide Optimizations” (PGO)Hasta ahora sólo hemos realizado análisis estáticos del código, muchas cuestiones abiertas:
Es frecuente que x > y?Cual es el tamaño de un contador concreto, es muy grande el bucle o tenemos pocas iteracciones?Que código se usa y con que frecuencia?
Compiladores: Intel C++ y optimizaciones PGO
![Page 26: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/26.jpg)
“Profile-Guide Optimizations” (PGO)La idea es usar información en tiempo de ejecución para guiar la optimización final.
Compiladores: Intel C++ y optimizaciones PGO
Enhancements with PGO:– More accurate branch prediction– Basic block movement to improve instruction cache behavior– Better decision of functions to inline (help IPO)– Can optimize function ordering– Switch-statement optimization– Better vectorization decisions
![Page 27: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/27.jpg)
“Profile-Guide Optimizations” (PGO): Proceso de 3 pasos
Compiladores: Intel C++ y optimizaciones PGO
Compilar y linkar añadiendo instrumentación:icc -prof_gen prog.c
Ejecutamos el programa instrumentado:./prog (conjunto de datos típico)
Compilar y linkar añadiendo instrumentación:icc -prof_gen prog.c
Compilaemos y linkamos con la info obtenida:icc -prof_use prog.c
Profile dinámico:12345678.dyn
Unión de todos los ficheros .dyn en pgopti.dpi y linkado del programa optimizado
1
2
3
![Page 28: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/28.jpg)
Ejemplos:
Compilar matrix.c con las opción -prof-gen
Ejecutar pgen_matrix.exe (alguna idea por qué es tan lento?)
Compilar usando -prof-use y optimización
Alguna mejora?
Compiladores: Intel C++ y optimizaciones PGO
![Page 29: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/29.jpg)
Agenda
Administración: (1 horas)
Instalación: Procedimiento, actualización y detalles de interésConfiguración entorno: Variables de entorno de interés (si utilizan modules, se incluirá la información para su configuración).
Compiladores: (4 horas)
Intel C++ Compiler XE 14.0IntroducciónEjemplos básicos de compilaciónOpciones avanzadas:Ejemplos optimizaciones: HLO, IPO y PGO
Ejemplos soporte OpenMPEjemplos compatibilidad y portabilidadEjemplos paralelización y vectorización automáticaIntel Fortran Compiler XE 14.0Introducción y ejemplos básicos ejecución.
![Page 30: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/30.jpg)
OpenMP: Conceptos
OpenMP es una colección de directivas, librerías y variables de entorno para programas en Fortran, C y C++
Es actualmente el estándar para programación de sistemas de memoria compartida y sistemas de memoria compartida físicamente distribuida
●Página oficial OpenMP: www.openmp.org
OpenMP consta básicamente de tres elementos:●Control de paralelismo
● directiva parallel● directivas de reparto de
trabajo (ej, directiva do)●Control de datos y comunicaciones
● variables privadas y compartidas
●Sincronización● Para coordinar el acceso a
los datos (barreras, secciones críticas ...)
![Page 31: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/31.jpg)
OpenMP: Conceptos
OpenMP utiliza el modelo de ejecución paralela fork-join:
●Un programa comienza su ejecución con un proceso único (thread maestro)●Cuando se encuentra la primera construcción paralela crea un conjunto de threads, cada uno con su identificador (el thread maestro tiene identificador 0)●Una forma de indicar el número de threads que se van a crear es a través de la variable de entorno OMP_NUM_THREADS●Los threads creados por el thread maestro van a ejecutar todos la misma copia de código.●Cuando termina la región paralela sólo el thread maestro continua la ejecución
![Page 32: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/32.jpg)
OpenMP: Conceptos
La paralelización del código se suele hacer de forma incremental, empezando por la paralelización de los bloques computacionalmente más costosos
Normalmente se emplea para la paralelización de lazos:●Se busca los lazos computacionalmente más costosos●Se reparten sus iteraciones entre los threads
void main(){int i;double suma[1000];for(i=0;i++;i<1000)calcular_suma(suma[i]);}
void main(){int i;double suma[1000];#pragma omp parallel forfor(i=0;i++;i<1000)calcular_suma(suma[i]);}
![Page 33: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/33.jpg)
OpenMP: Conceptos
●Los diferentes threads se comunican a través de variables compartidas
●La compartición de datos puede llevar a un mal comportamiento del programa debido al acceso simultáneo desde diferentes threads
●Para evitarlo se utilizan directivas de sincronización (protegen los datos de conflictos)
●Las sincronizaciones son costosas hay que tratar de evitarlas⇒
![Page 34: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/34.jpg)
OpenMP: Conceptos
Modelo de memoria:●El compilador de OpenMP debe expandir las zonas de memoria creadas por un compilador secuencial para almacenar los datos●Cada thread tendrá su propio stack. Se utiliza este espacio para almacenar los argumentos y variables locales de los procedimientos invocados por ese thread●El stack privado de cada thread se utilizará también para almacenar las variables privadas●El tamaño por defecto del stack de cada thread depende de la implementación, pero es configurable con la variable de entorno OMP_STACKSIZE
Heap
Stack thread 1
Stack thread 0
Datos Estáticos
Código objeto
![Page 35: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/35.jpg)
OpenMP-1
● OpenMP-1.0 Fortran: 1997● OpenMP-1.0 C/C++: 1998● OpenMP-1.1 Fortran: 1999
1997
2000
2008OpenMP-2
● OpenMP-2.0 Fortran: 2000● OpenMP-2.0 C/C++: 2002● OpenMP-2.5 Fortran y C/C++: 2005
OpenMP-3
OpenMP-3.0 Fortran y C/C++: 2008OpenMP-3.1 Fortran y C/C++: 2011
OpenMP: Estándares
http://openmp.org/wp/openmp-specifications
2013
OpenMP-4
● OpenMP-4.0: Especificaciones en Julio de 2013
![Page 36: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/36.jpg)
Compiladores: Intel C++ y soporte OpenMP
Comienza el soporte de OpenMP 4.0 (vectorización y soporte coprocesadores: target y simd) http://software.intel.com/en-us/articles/intel-c-composer-xe-2013-sp1-release-notes (sección 4.2.1)
Incluye librerías OpenMP compatibles con el soporte OpenMP de GCC (compatibilidad a nivel de objeto).
![Page 37: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/37.jpg)
Compiladores: Intel C++ y soporte OpenMP
Opciones en compilación:
-openmp : Se genera código multihilo basado en las directivas -openmp-report [= n ] : nivel de diagnóstico
0 : No diagnostico1 : bucles/regiones/secciones paralelizadas (por defecto)2 : (1) + construcciones y directivas (MASTER/SINGLE/CRITICAL/ORDERED/ATOMIC)
-openmp-simd-no-openmp-simd : Uso o no de directivas Single Instruction Multiple Data (SIMD)-openmp-stubs : compilación de programas openmp en modo secuencial-openmp-task=model : Modelo de tareas OpenMP
intel : pragmas tipo #pragma intel_omp_taskqomp : OpenMP API 3.0 (por defecto)
-openmp-threadprivate=typelegacy : Sin compatibilidad con otros compiladores (por defecto) compat : compatibilidad con compiladores GNU
Uso de funciones de runtime: #include <omp.h>http://software.intel.com/en-us/node/459486
![Page 38: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/38.jpg)
Compiladores: Intel C++ y soporte OpenMP
Thread Affinity / Binding (http://software.intel.com/en-us/node/459494)
Variable de entorno KMP_AFFINITY
KMP_AFFINITY=[<modifier>,...]<type>[,<permute>][,<offset>]
Argumento Valor por defecto Descripción
modifier noverboserespectgranularity=core
Opcional. Valores posibles: granularity=<fine, thread, core>,norespect,noverbose,nowarnings,proclist={<proc-list>},respect,verbose,warnings
type ninguno Modelo de afinidad a usar: compact, disabled, explicit, none, scatter
permute 0 Opcional. Entero positivo. No válido para type : explicit, none, o disabled
offset 0 Opcional. Entero positivo. No válido para type : explicit, none, o disabled
![Page 39: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/39.jpg)
Compiladores: Intel C++ y soporte OpenMP
Tipos de afinidad (único argumento obligatorio):
type = none (por defecto)No se usa afinidad. Se usará la interface OpenMP thread affinity para determinar la topología del nodo. Si se especifica KMP_AFFINITY=verbose,none se obtiene un mapa del nodo.
type = compactLos threads son colocados lo más próximos posible.
type = disabledLa interface de afinidad se desactiva completamente. Incluso funciones de bajo nivel como kmp_set_affinity y kmp_get_affinity se comportarán como si el SO no tuviese soporte.
type = explicitLista de IDs de proc. El modificador proclist es obligatorio. Este modificador especifica la lista de IDs de procesadores (SO) que se van a usar. También puede usar la variable de entorno GOMP_CPU_AFFINITY para este fin (compatibilidad GCC).
type = scatterDistribuye los threads lo maximo posible entre los procesadores del sistema. Lo opuesto de compact.
![Page 40: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/40.jpg)
Compiladores: Intel C++ y soporte OpenMP
Del manual GCC:
GOMP_CPU_AFFINITY: Bind threads to specific CPUs
Description:Binds threads to specific CPUs. The variable should contain a space-separated or comma-separated list of CPUs. This list may contain different kinds of entries: either single CPU numbers in any order, a range of CPUs (M-N) or a range with some stride (M-N:S). CPU numbers are zero based. For example, GOMP_CPU_AFFINITY="0 3 1-2 4-15:2" will bind the initial thread to CPU 0, the second to CPU 3, the third to CPU 1, the fourth to CPU 2, the fifth to CPU 4, the sixth through tenth to CPUs 6, 8, 10, 12, and 14 respectively and then start assigning back from the beginning of the list. GOMP_CPU_AFFINITY=0 binds all threads to CPU 0.
GOMP_CPU_AFFINITY=<proc_list> es un alias para KMP_AFFINITY=granularity=fine,proclist=[<proc_list>],explicit
![Page 41: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/41.jpg)
Compiladores: Intel C++ y soporte OpenMP
modifier = granularity
core Por defecto. Cada thread es asignado a un core y puede moverse en los contextos de threads de ese core.
fine/thread Cada thread es asignado a único contexto.
Solo para type compact o scatterpermute : Nivel del árbol de topología más significativo offset : desplazamiento con el que empiezo la colocación
respect : mantiene la mascara de afinidad del hilo que inicializa
![Page 42: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/42.jpg)
Compiladores: Intel C++ y soporte OpenMP
Topologia en los nodos del cluster UCA:Frontales: 2 packages x 8 cores/pkg x 2 threads/core (16 total cores)Nodos: 2 packages x 8 cores/pkg x 1 threads/core (16 total cores)
Nodo
Package 0
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
Package 1
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
SO: 0,16 1,17 2,18 3,19 4,20 5,21 6,22 7,23 8,24 9,25 10,26 11,27 12,28 13,29 14,30 15,31
![Page 43: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/43.jpg)
Compiladores: Intel C++ y soporte OpenMP
Nodo
Package 0
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
Package 1
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
SO: 0,16 1,17 2,18 3,19 4,20 5,21 6,22 7,23 8,24 9,25 10,26 11,27 12,28 13,29 14,30 15,31
OMP_NUM_THREADS=4KMP_AFFINITY=granularity=fine,compact
![Page 44: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/44.jpg)
Compiladores: Intel C++ y soporte OpenMP
Nodo
Package 0
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
Package 1
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
SO: 0,16 1,17 2,18 3,19 4,20 5,21 6,22 7,23 8,24 9,25 10,26 11,27 12,28 13,29 14,30 15,31
OMP_NUM_THREADS=4KMP_AFFINITY=granularity=fine,compact,1,0
![Page 45: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/45.jpg)
Compiladores: Intel C++ y soporte OpenMP
Nodo
Package 0
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
Package 1
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
SO: 0,16 1,17 2,18 3,19 4,20 5,21 6,22 7,23 8,24 9,25 10,26 11,27 12,28 13,29 14,30 15,31
OMP_NUM_THREADS=4GOMP_CPU_AFFINITY=1,3,12-15:2
![Page 46: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/46.jpg)
Compiladores: Intel C++ y soporte OpenMP
Ejemplo:/apps/intel/composer_xe_2013_sp1.0.080/Samples/en_US/C++/openmp_samples/openmp_sample.c
Compilarlo con “icc -openmp -std=c99” y ejecutar con varios hilos.
Que ocurre cuando usamos afinidad? Probar distintas combinaciones ...
![Page 47: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/47.jpg)
Agenda
Administración: (1 horas)
Instalación: Procedimiento, actualización y detalles de interésConfiguración entorno: Variables de entorno de interés (si utilizan modules, se incluirá la información para su configuración).
Compiladores: (4 horas)
Intel C++ Compiler XE 14.0IntroducciónEjemplos básicos de compilaciónOpciones avanzadas:Ejemplos optimizaciones: HLO, IPO y PGOEjemplos soporte OpenMP
Ejemplos compatibilidad y portabilidadEjemplos paralelización y vectorización automáticaIntel Fortran Compiler XE 14.0Introducción y ejemplos básicos ejecución.
![Page 48: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/48.jpg)
Compiladores: Compatibilidad y portabilidad de Intel C++
Soporte completo deC++ ISO/IEC 14882:1998 (C++ 98)C ISO/IEC 9899:1990 (ANSI C o C89, C90)
C99: ●restricted pointers (restrict keyword).●variable-length Arrays●flexible array members●complex number support (_Complex keyword)●hexadecimal floating-point constants●compound literals●designated initializers●mixed declarations and code●macros with a variable number of arguments●inline functions (inline keyword)●boolean type (_Bool keyword)
C++ 11:http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler
![Page 49: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/49.jpg)
Compiladores: Compatibilidad y portabilidad de Intel C++
Compatibilidad e interoperatividad con GCC
Alta compatibilidad: compatibilidad a nivel binario entre objetos. Es posible compilar usando ambos compiladores.
Uso de extensiones GNU (soportadas un gran nº de ellas)http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.htmlOpción de linkado -cxxlib : uso del runtime y headers de GCC (por defecto para C++).
![Page 50: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/50.jpg)
Agenda
Administración: (1 horas)
Instalación: Procedimiento, actualización y detalles de interésConfiguración entorno: Variables de entorno de interés (si utilizan modules, se incluirá la información para su configuración).
Compiladores: (4 horas)
Intel C++ Compiler XE 14.0IntroducciónEjemplos básicos de compilaciónOpciones avanzadas:Ejemplos optimizaciones: HLO, IPO y PGOEjemplos soporte OpenMPEjemplos compatibilidad y portabilidad
Ejemplos paralelización y vectorización automáticaIntel Fortran Compiler XE 14.0Introducción y ejemplos básicos ejecución.
![Page 51: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/51.jpg)
SIMD – Single Instruction Multiple Data
Modo escalar: una instrucción produce un resultadoModo SIMD : una instrucción SSE o AVX produce varios resultados
Compiladores: Vectorización con Intel C++
![Page 52: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/52.jpg)
SIMD – Single Instruction Multiple DataNecesario un soporte especifico del hardware
Intel® SSETamaño de vector: 128bitTipos de datos:8,16,32,64 bit integers32, 64bit floatsLongitud del vector: 2,4,8,16Ej: Xi, Yi bit 32 int / float
Intel® AVXTamaño de vector: 256bitTipos de datos: 32, 64 bit floatsLongitud del vector: 4, 8, 16Ej: Xi, Yi 32 bit int o floatAparece 2011
Compiladores: Vectorización con Intel C++
![Page 53: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/53.jpg)
SIMD – Single Instruction Multiple DataExtensiones especificas:
Compiladores: Vectorización con Intel C++
![Page 54: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/54.jpg)
Opciones del compilador:
-x<extension>Optimizaciones específicas para procesadores IntelEl compilador intentara usar el conjunto de instrucciones hasta la extension especifica
-m<extension>No hay chequeo de procesador.No incluye optimizaciones especificas (valido para todos los procesadores que soporten la extension)-msse2 se activa con -O2 o superior
-ax<extension>Codigo multiple: una linea de base junto versiones mas optimizadasLa linea base por defecto es -msse2La linea base se modifica con las opciones anteriores-axavx,sse4.2 – codigo optimizado para avx, sse4.2 y sse2 (lineabase por defecto)
-xHost Se usara el juego de instrucciones superior soportado por el procesador donde se compila
-no-vecDeshabilita la vectorización de manera global
Compiladores: Vectorización con Intel C++
![Page 55: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/55.jpg)
Directivas:
#pragma vector alwaysFuerza el uso de la vectorización sobre el bucle saltándose las indicaciones del compilador :problemas de alineamiento, stride (separación entre elementos a ser vectorizados) no único …Aun asi el compilador tiene que poder reconocer la transformación necesaria.#pragma vector always assert abortara la compilación si hay algún problema con la vectorización
#pragma ivdepIgnorar dependencias de datos no probadas
#pragma novectorInhabilita la vectorización de un bucle individual
Compiladores: Vectorización con Intel C++
![Page 56: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/56.jpg)
Compiladores: Vectorización con Intel C++
![Page 57: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/57.jpg)
¿Por qué no vectoriza mi bucle?
-vec-report<n> n=0: sin información (por defecto)n=1: info sobre bucles vectorizados n=2: info sobre bucles vectorizados y la razón de los no vectorizados.n=3: Añade información de dependencias n=4: reporta solo bucles no vectorizadosn=5: reporta solo bucles no vectorizados y su información de dependencia
-opt_report_phase hpo (High Performance Optimizer)proporciona información adicional para la vectorización
Compiladores: Vectorización con Intel C++
![Page 58: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/58.jpg)
Ejemplos:
Compilar matrix.c con -O[2|3], -xHost y -fast obteniendo un informe de la vectorización
Ejecutar y comparar tiempos.
Vectorizan todos los bucles? Posibilidad de mejora?
Tutorial: http://software.intel.com/en-us/node/458754
/apps/intel/composer_xe_2013_sp1.0.080/Samples/en_US/C++/vec_samples
Compiladores: Vectorización con Intel C++
![Page 59: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/59.jpg)
La vectorización depende de:
No haya dependencia de datos en las iteraciones de los bucles
Esquemas de datos regulares y predecibles para todos los operadores
Cuidado con los juegos con punteros, evitar accesos indirectos
Longitudes de vector suficientemente grandes
Datos alineados
Compiladores: Vectorización con Intel C++
![Page 60: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/60.jpg)
-parallel El compilador automaticamente convierte porciones de codigo serie en su codigo equivalente multihilo
El auto-paralelizador analiza el flujo de datos en los bucles y genera codigo multihilo para aquellos bucles que pueden ejecutarse de manera eficiente y segura en paralelo.
-par-report0|1|2|3 (0: no info, 3 nivel maximo de diagnostico)Genera informes acerca de secciones del programa que podrian ser paralelizadas por el compilador
Compiladores: Autoparalelizacion con Intel C++
![Page 61: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/61.jpg)
Ejemplos:
Compilar matrix.c con -parallel -par-report2 y combinatorias de otras opciones
Examinar el informe, posibles mejoras?
Compiladores: Autoparalelizacion con Intel C++
![Page 62: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/62.jpg)
Autoparalelizacion guiada (Guided Automatic Parallelism GAP)
Opcion del compilador:-guide (-guide -guide-vec -guide-par -guide-data-trans )
Con esta opcion el compilador no compila, analiza el codigo para dar consejo sobre vectorizacion (-guide-vec), paralelizacion (-guide-par ), o ambas ( -guide ). Tambien, GAP puede hacer sugerencias sobre como reordenar las estructuras de datos para obtener un acceso mas optimo ( -guide-data-trans ).
Compiladores: Autoparalelizacion con Intel C++
![Page 63: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/63.jpg)
TUTORIAL sobre GAPhttp://software.intel.com/en-us/node/458624
/apps/intel/composer_xe_2013_sp1.0.080/Samples/en_US/C++/guided_auto_parallel.tar.gz
Compiladores: Autoparalelizacion con Intel C++
![Page 64: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/64.jpg)
Agenda
Administración: (1 horas)
Instalación: Procedimiento, actualización y detalles de interésConfiguración entorno: Variables de entorno de interés (si utilizan modules, se incluirá la información para su configuración).
Compiladores: (4 horas)
Intel C++ Compiler XE 14.0IntroducciónEjemplos básicos de compilaciónOpciones avanzadas:Ejemplos optimizaciones: HLO, IPO y PGOEjemplos soporte OpenMPEjemplos compatibilidad y portabilidadEjemplos paralelización y vectorización automática
Intel Fortran Compiler XE 14.0Introducción y ejemplos básicos ejecución.
![Page 65: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/65.jpg)
Rendimiento tanto en serie como paralelo para procesadores Intel.
Introduce facilidades en compilación para la vectorización, la programación paralela y soporte de estándares para simplificar el desarrollo de aplicaciones Fortran con alto rendimiento. Destacan entre estas características el soporte de Fortran 2003, Fortran 2008 y nuevas funcionalidades de OpenMP 4.0 y la posibilidad de autoparalelización.
Documentación completa: http://software.intel.com/en-us/compiler_14.0_ug_f
Compiladores: Intel Fortran
![Page 66: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/66.jpg)
Compiladores: Intel Fortran
![Page 67: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/67.jpg)
http://polyhedron.com/pb05-lin64-f90bench_SBhtml
Compiladores: Intel Fortran
![Page 68: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/68.jpg)
Uso básico:
Comandos: ‘ifort’ para todos los estándares de Fortran soportados.
Opciones de optimización similares al compilador de C++
ifort –help proporciona la lista extensa de opcionesman ifort
Aspectos de la línea de comandos:
-fpscompCompatibilidad con Microsoft Fortran Power Station
-fpscomp filesfromcmdLa línea de comandos debe incluir los nombres de las unidades a las que no se ha especificado nombre de fichero.
Compiladores: Intel Fortran
![Page 69: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/69.jpg)
Compiladores: Intel Fortran
Ejemplos:/apps/intel/composerxe/Samples/en_US/Fortran
Tutorial: http://software.intel.com/en-us/composerxe_2013SP1_coarray_f
Coarray Fortran: programacion paralela usando un modelo “single program multiple data” (SPMD) soportando tanto memoria compartida como distribuida en un metodo unico.
![Page 70: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/70.jpg)
Compiladores
Opciones aritmética coma flotante:
-fp-model nameMejora de consistencia evitando ciertas optimizaciones.
fast=[1|2] : Permite optimizaciones agresivas con ligero coste de precisión y consistencia (por defecto fast=1).
precise : Sólo permite optimizaciones seguras.double/extended/source : tipo de los resultados intermedios. Implica precise a no ser que se
especifique otra cosa. Double y extended no está disponible en Fortran.except : Fuerza excepciones.strict : precise+except
Se recomienda “-fp-model precise –fp-model source” para la mayoría de las situaciones con problemas de consistencia y reproductibidad
-ftz[-]Se fijan a 0 los denormals (underflows). Activa por defecto excepto con -O0
![Page 71: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/71.jpg)
Compiladores
Opciones aritmética coma flotante:
-fimf-precision:namePrecisión de las funciones de la librería matemática. Por defecto se deja a la heurística del compilador. Posibles valores: “high”, “medium” y “low”. En general mayor precisión, peor rendimiento.
-fimf-arch-consistency=trueAsegura resultados consistentes entre los procesadores de la misma arquitectura. Por defecto es “false”.
-[no-]prec-divMejora o reduce [no-] la precisión de las divisiones. En general leve impacto en rendimiento.
-[no-]prec-sqrtMejora o reduce [no-] la precisión de las raíces cuadradas. En general leve impacto en rendimiento.
![Page 72: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/72.jpg)
Compiladores
Opciones aritmética coma flotante:Ejercicio:Probar las versiones optimizadas con “-fp-model precise –fp-model source”
![Page 73: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/73.jpg)
Compiladores
“Profiling” a nivel de función y bucle:
Similar a gprof.Opciones compilador:
-profile-functions
Inserta instrumentación en la entrada y salida de las funciones para recoger los ciclos consumidos.
-profile-loops=<inner|outer|all>
Además inserta instrumentación en los bucles donde sea capaz según el tipo
Estas opciones generan ficheros de texto (.dump) y XML (.xml).
Visualizador para los ficheros XML:
java -jar /apps/intel/composer_xe_2013_sp1.0.080/bin/loopprofileviewer.jar <xml datafile>
![Page 74: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/74.jpg)
Compiladores
“Profiling” a nivel de función y bucle:
Ejercicios:
icc -profile-functions -o prof-matrix matrix.c
icc -O1 -profile-functions -o prof-matrix matrix.c
icc -O1 -profile-loops=all -o prof-matrix matrix.c
![Page 75: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/75.jpg)
Agenda
Intel Debugger: (2 horas)
IntroducciónUso a través de la GUI/eclipse/CLIEjemplos de uso en aplicaciones paralelas: multihilo (OpenMP) y MPI
Intel Math Kernel Library: (2 horas)
IntroducciónLinkadoEjemplos de rendimientoUso ScaLAPACK
Intel MPI: (1 hora)
IntroducciónReferencia de comandos: compilador, ejecución, gestión de procesos, información del procesador. Ejemplos.
![Page 76: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/76.jpg)
Intel® Debugger (IDB)
Depurador completo con las siguientes características:●Soporta C++ y Fortran●Código máquina y valores de registros●Depuración de aplicaciones multihilo
● Análisis de compartición de datos entre hilos detectando accesos idénticos.● breakpoint inteligente para parar la ejecución a la vez en los diferentes hilos.● Vista de registros de vectores (SSE) con formatos y opciones de edición para la
depuración de aplicaciones paralelas SIMD.● Vistas especializadas en OpenMP para análisis de estado de aplicación.
●Disponible GUI
Documentación completa: http://software.intel.com/sites/products/documentation/doclib/stdxe/2013SP1/composerxe/debugger/user_guide/index.htm
Compiladores: Intel Debugger
![Page 77: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/77.jpg)
Opciones de depuración en los compiladores:
-g, -debug, -debug full, -debug allProducen información de depuración compatible con los depuradores habituales.Desactiva -O2 y hace -O0 el defecto a no ser que se especifique la opción de optimización.-debug noneNo se genera información de depuración (por defecto)-debug minimalGenera sólo nºs de línea pero no símbolos-debug inline-debug-infoSímbolos asociados a funciones “inlined” son asociadas con la función llamada. Por defecto con la opción -O2-debug extendedProduce información adicional útil para código optimizado-[no-]soxIncluye la versión del compilador y opciones usadas en el fichero objeto y el ejecutable-tracebackProporciona el “traceback” sobre los distintos fuentes con errores severos en tiempo de ejecución.
Compiladores: Intel Debugger
Preparación del ejecutable
![Page 78: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/78.jpg)
Agenda
Intel Debugger: (2 horas)
Introducción
Uso a través de la GUI/eclipse/CLIEjemplos de uso en aplicaciones paralelas: multihilo (OpenMP) y MPI
Intel Math Kernel Library: (2 horas)
IntroducciónLinkadoEjemplos de rendimientoUso ScaLAPACK
Intel MPI: (1 hora)
IntroducciónReferencia de comandos: compilador, ejecución, gestión de procesos, información del procesador. Ejemplos.
![Page 79: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/79.jpg)
Interfaz gráfico de usuario (GUI)
Comando: idbEs necesario el entorno JAVAhttp://software.intel.com/sites/products/documentation/doclib/stdxe/2013SP1/composerxe/debugger/user_guide/index.htm#GUID-06337197-DD0B-4CAB-9BFB-3E928CC05D50.htm
Compiladores: Intel Debugger
Soporta Multihilo
![Page 80: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/80.jpg)
Interfaz de Eclipse
Integrado con Eclipse + CDT
La integración soporta Eclipse 3.7. Para la depuración con fortran es necesario instalar el plugin Photran.
Uso: Iniciar EclipseCrear o abrir un “workspace”. (ej “makefile project”)Selecionar “Help” → “Install New Software”Junto al campo “Work with” click en el botón “Add” y aparece el diálogo “Add Site”Click en el botón “local” y seleccionar el directorio apropiado que contiene la integración:
/apps/intel/eclipse_support/cdt8.0/eclipseClick OKAsegurarse que no está selecionado “Group items by category”Seleccionar la integración de IDB y click en “Next”Seguir instrucciones y reiniciar Eclipse cuando se indique.
Compiladores: Intel Debugger
![Page 81: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/81.jpg)
Interfaz de línea de comandos (CLI)
Comando: idbc
Opciones disponibles: idbc –help
Modos: -idb : compatible DBX-gdb : compatible GDB
Compiladores: Intel Debugger
![Page 82: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/82.jpg)
Interfaz de línea de comandos (CLI)
Modo GDB (por defecto):
(idb) helpObtener ayuda sobre los comandos disponibles(idb) break mainbreakpoint en la entrada del programa principal.(idb) runEjecuta la aplicación hasta el siguiente breakpoint.(idb) info breakpointsLista de breakpoint existentes(idb) delete breakpoint <breakpoint id>Borra el breakpoint con el correspondiente id
Compiladores: Intel Debugger
![Page 83: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/83.jpg)
Interfaz de línea de comandos (CLI)
Modo IDB (-idb):
(idb) helpObtener ayuda sobre los comandos disponibles (mucho más completa en este modo)(idb) stop in mainbreakpoint en la entrada del programa principal.(idb) stop in 20breakpoint en la línea 20(idb) stop variable i changedbreakpoint cuando la variable “i” cambia de valor (idb) runEjecuta la aplicación hasta el siguiente breakpoint.(idb) statusLista de breakpoint existentes(idb) delete <breakpoint id>Borra el breakpoint con el correspondiente id
Compiladores: Intel Debugger
![Page 84: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/84.jpg)
Interfaz de línea de comandos (CLI)
Explorar comandos más elaborados
¿Como paro el programa cuando una variable cuando toma cierto valor?
break if
¿Puedo modificar variables internas cuando ocurre un evento determinado?
when en modo idb
Compiladores: Intel Debugger
![Page 85: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/85.jpg)
Agenda
Intel Debugger: (2 horas)
IntroducciónUso a través de la GUI/eclipse/CLI
Ejemplos de uso en aplicaciones paralelas: multihilo (OpenMP) y MPI
Intel Math Kernel Library: (2 horas)
IntroducciónLinkadoEjemplos de rendimientoUso ScaLAPACK
Intel MPI: (1 hora)
IntroducciónReferencia de comandos: compilador, ejecución, gestión de procesos, información del procesador. Ejemplos.
![Page 86: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/86.jpg)
Interfaz de línea de comandos (CLI)
Depuración de programas multihilo.
El debugger detecta automáticamente un programa OpenMP y activa su soporte
(idb) set $threadlevel="native"(idb) set $threadlevel="openmp"
Compiladores: Intel Debugger
Info OpenMP idb info threadidb info taskidb info barrieridb info taskwaitidb info lockidb info teamidb info openmp thread tree
Acceso a datos compartidos idb sharing onidb sharing stop on/offidb sharing event expandidb sharing filter
Acceso simultaneo a una expresión
idb reentrancy specifier
http://software.intel.com/sites/products/documentation/doclib/stdxe/2013SP1/composerxe/debugger/user_guide/index.htm#GUID-06337197-DD0B-4CAB-9BFB-3E928CC05D50.htm
![Page 87: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/87.jpg)
Interfaz de línea de comandos (CLI)
Depuración de programas OpenMP
Usemos varios ejemplos
Compiladores: Intel Debugger
![Page 88: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/88.jpg)
Interfaz de línea de comandos (CLI)
Depuración de programas MPI
Opciones -idb,-idba,-gdb,-gdba de mpirun
Variables:MPIEXEC_DEBUG=1IDB_PARALLEL_SHELL=/bin/sh
Uso del comando “focus” para especificar sobre que proceso/s operamos.
Problemas con la agregación de mensajes: $parallel_aggregatordelay (por defecto 3000 miliseg)Desincronización de los procesos: usar “until” (GDB) o “cont to” (IDB) especificando un lugar común.
No se localizan las fuentes: -idbopt -IO usar “use”
Compiladores: Intel Debugger
![Page 89: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/89.jpg)
Interfaz de línea de comandos (CLI)
Depuración de programas MPI
Ejercicio compilar cpi.c y depurar su ejecución. Uso de “focus”.
Compiladores: Intel Debugger
![Page 90: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/90.jpg)
Agenda
Intel Debugger: (2 horas)
IntroducciónUso a través de la GUI/eclipse/CLIEjemplos de uso en aplicaciones paralelas: multihilo (OpenMP) y MPI
Intel Math Kernel Library: (2 horas)
IntroducciónLinkadoEjemplos de rendimientoUso ScaLAPACK
Intel MPI: (1 hora)
IntroducciónReferencia de comandos: compilador, ejecución, gestión de procesos, información del procesador. Ejemplos.
![Page 91: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/91.jpg)
Intel Math Kernel Library (MKL)http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation
Librería matemática altamente optimizada con rutinas multihilo. Incluye:
● BLAS (level 1, 2, and 3) and LAPACK linear algebra routines, offering vector, vector-matrix, and matrix-matrix operations.
● The PARDISO* direct sparse solver, an iterative sparse solver, and supporting sparse BLAS (level 1, 2, and 3) routines for solving sparse systems of equations.
● ScaLAPACK distributed processing linear algebra routines for Linux* and Windows* operating systems, as well as the Basic Linear Algebra Communications Subprograms (BLACS) and the Parallel Basic Linear Algebra Subprograms (PBLAS).
● Fast Fourier transform (FFT) functions in one, two, or three dimensions with support for mixed radices (not limited to sizes that are powers of 2), as well as distributed versions of these functions provided for use on clusters of the Linux* and Windows* operating systems.
● Vector Math Library (VML) routines for optimized mathematical operations on vectors.● Vector Statistical Library (VSL) routines, which offer high-performance vectorized random
number generators (RNG) for several probability distributions, convolution and correlation routines, and summary statistics functions.
● Data Fitting Library, which provides capabilities for spline-based approximation of functions, derivatives and integrals of functions, and search.
● Extended Eigensolver, a shared memory programming (SMP) version of an eigensolver based on the Feast Eigenvalue Solver.
Intel MKL
![Page 92: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/92.jpg)
Intel Math Kernel Library (MKL)
Última versión: 11.1
Soporta varios compiladores: Intel/PGI/GNU. Probado con varios mas …Uso con Java, python ...
Adaptada a las últimas novedades en procesadores.
Antes de empezar:● Plataforma: procesador● Problema matemático: dominio de funciones● Lenguaje de programación● Uso de arrays muy extensos (> 231-1) : tipo del entero (ILP64/LP64)● Multihilo: si/no? con compilador de intel o otro?● Modelo de linkado: estático o dinámico● MPI: funciones de cluster (ScaLAPACK, Cluster FFT)
Intel MKL
![Page 93: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/93.jpg)
Agenda
Intel Debugger: (2 horas)
IntroducciónUso a través de la GUI/eclipse/CLIEjemplos de uso en aplicaciones paralelas: multihilo (OpenMP) y MPI
Intel Math Kernel Library: (2 horas)
Introducción
LinkadoEjemplos de rendimientoUso ScaLAPACK
Intel MPI: (1 hora)
IntroducciónReferencia de comandos: compilador, ejecución, gestión de procesos, información del procesador. Ejemplos.
![Page 94: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/94.jpg)
Intel MKL: Linkado
Con los compiladores de intel, uso muy sencillo:
-mkl o -mkl=parallel Estandar multihilo (OpenMP) -mkl=sequentialVersión secuencial
-mkl=clusterlink con la versión cluster (no multihilo) con Intel MPI
Guía de linkado:http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
Herramienta de línea de comandos: mkl_link_toolhttp://software.intel.com/en-us/articles/mkl-command-line-link-tool
mkl_link_tool -interactive
![Page 95: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/95.jpg)
Intel MKL: Linkado
Interfaces:
Directorio mkl/interfacesblas95/lapack95 : incluidas directamente en la mkl para los compiladores de intelfftw3xc, fftw3xf : incluidas directamente en la mkl para los compiladores de intel
fftw2xc, fftw2xf: necesario compilar fftw2x_cdft: necesario compilarfftw3x_cdft: necesario compilar
![Page 96: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/96.jpg)
Interfaces:
Explorar compilación para otros compiladores, versión de MPI …
En cada uno de de los directorios de las interfaces hay un makefile preparado. La ejecución de “make” visualiza las opciones disponibles.
Ejemplo:
mkl/interfaces/fftw2x_cdft $ make libintel64 interface=lp64 PRECISION=MKL_DOUBLE compiler=gnu mpi=mpich2 INSTALL_DIR=~/mkl
Intel MKL: Linkado
![Page 97: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/97.jpg)
Trucos para el linkado:
Podemos usar comandos del linker:http://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_mono/ld.html#SEC26como GROUP para referenciar grupos de librerías como un fichero único:
libmkl.a: GROUP (libmkl_intel_lp64.a libmkl_intel_thread.a libmkl_core.a)
libmklfftw.a: GROUP (libfftw3x_cdft.a libmkl_cdft_core.a libmkl_intel_lp64.a libmkl_sequential.a libmkl_core.a)
libmkl-gnu.a: GROUP (libmkl_gf_lp64.a libmkl_gnu_thread.a libmkl_core.a)
libmkl-gnu-sequential.a: GROUP (libmkl_gf_lp64.a libmkl_sequential.a libmkl_core.a)
libmkl-sequential.a: GROUP (libmkl_intel_lp64.a libmkl_sequential.a libmkl_core.a)
Intel MKL: Linkado
![Page 98: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/98.jpg)
Agenda
Intel Debugger: (2 horas)
IntroducciónUso a través de la GUI/eclipse/CLIEjemplos de uso en aplicaciones paralelas: multihilo (OpenMP) y MPI
Intel Math Kernel Library: (2 horas)
IntroducciónLinkado
Ejemplos de rendimientoUso ScaLAPACK
Intel MPI: (1 hora)
IntroducciónReferencia de comandos: compilador, ejecución, gestión de procesos, información del procesador. Ejemplos.
![Page 99: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/99.jpg)
Tutorial:
http://software.intel.com/en-us/mkl_11.1_tut_c
/apps/intel/composerxe/Samples/en-US/mkl/tutorials.zip
Usar:● #include "mkl.h"● malloc especializado: mkl_malloc● Función especializada: cblas_dgemm
Compilar y linkar el código: opción -mkl del compilador
Medir tiempos y comparar con la versión no MKLEjecutar con varios threads usando las funciones:
omp_set_num_threads(), mkl_set_num_threads(), mkl_domain_set_num_threads()
Intel MKL: Ejemplos
![Page 100: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/100.jpg)
Control de hilos por variables de entorno:
OMP_NUM_THREADS : Sobre toda la aplicación OpenMPMKL_NUM_THREADS : Sólo para las funciones MKL
MKL_DYNAMIC : cambio dinámico del nº de threads hasta el máximo especificado (activada por defecto)
MKL_DOMAIN_NUM_THREADS : control específico sobre un dominio de funciones MKL: export MKL_DOMAIN_NUM_THREADS="MKL_DOMAIN_ALL=1, MKL_DOMAIN_BLAS=4”http://software.intel.com/en-us/node/438644
Intel MKL: Ejemplos
![Page 101: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/101.jpg)
Agenda
Intel Debugger: (2 horas)
IntroducciónUso a través de la GUI/eclipse/CLIEjemplos de uso en aplicaciones paralelas: multihilo (OpenMP) y MPI
Intel Math Kernel Library: (2 horas)
IntroducciónLinkadoEjemplos de rendimiento
Uso ScaLAPACK
Intel MPI: (1 hora)
IntroducciónReferencia de comandos: compilador, ejecución, gestión de procesos, información del procesador. Ejemplos.
![Page 102: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/102.jpg)
Uso de la versión cluster:
Compiladores Intel + Intel MPI
mpiicc -mkl=cluster
Versión secuencial de la librería.
Uso híbrido:
-lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lmkl_blacs_intelmpi_lp64 -lpthread -lm
Compilar siempre con la opción -openmp
Intel MKL: Uso ScaLAPACK
![Page 103: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/103.jpg)
Probar ejemplos adicionales.
Intel MKL: Uso ScaLAPACK
![Page 104: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/104.jpg)
Agenda
Intel Debugger: (2 horas)
IntroducciónUso a través de la GUI/eclipse/CLIEjemplos de uso en aplicaciones paralelas: multihilo (OpenMP) y MPI
Intel Math Kernel Library: (2 horas)
IntroducciónLinkadoEjemplos de rendimientoUso ScaLAPACK
Intel MPI: (1 hora)
IntroducciónReferencia de comandos: compilador, ejecución, gestión de procesos, información del procesador. Ejemplos.
![Page 105: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/105.jpg)
Intel MPI http://software.intel.com/en-us/articles/intel-mpi-library-documentation
Librería de paso de mensajes “multi-fabric”.Implementa MPI-2.2 para plataformas Intel.Permite la actualización de los procesadores y redes de interconexión sin necesidad de cambios en el software.Se distribuye en 2 kits:
Intel MPI Library Runtime Environment (RTO): Incluye todas las herramientas necesarias para la ejecución de programas has (Multipurpose Daemon* (MPD), Hydra* y utilidades adicionales, librerías dinámicas y documentación).
Intel® MPI Library Development Kit (SDK): RTO + las herramientas de compilación (comandos de compilación como mpiicc, ficheros de cabecera, librerías estáticas y librerías de depuración, trazas y testeo de código)
Intel MPI
![Page 106: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/106.jpg)
MPI: Estándares
Especificación del estándar por mpi-forum.org
http://www.mpi-forum.org/docs/docs.html
Versiones principales:●MPI-1●MPI-2●MPI-3 (Muy reciente)
![Page 107: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/107.jpg)
MPI-1
● MPI-1.0: 1994● MPI-1.1: 1995 (definición completa del estándar)● MPI-1.2: 1997 (revisión pequeña)● MPI-1.3: 2008 (versión final de MPI-1 con correcciones)
1994
1997
2012MPI-2
Extensiones a MPI● MPI-2.0: 1997● MPI-2.1: 2008 (definición completa)● MPI-2.2: 2009 (pequeña adicción, clarificaciones y erratas)
MPI-3
MPI-3.0: 2012Extensión importante del estándar.
http://www.mpi-forum.org/docs/mpi-3.0/mpi30-report.pdf
MPI: Estándares
![Page 108: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/108.jpg)
Agenda
Intel Debugger: (2 horas)
IntroducciónUso a través de la GUI/eclipse/CLIEjemplos de uso en aplicaciones paralelas: multihilo (OpenMP) y MPI
Intel Math Kernel Library: (2 horas)
IntroducciónLinkadoEjemplos de rendimientoUso ScaLAPACK
Intel MPI: (1 hora)
Introducción
Referencia de comandos: compilador, ejecución, gestión de procesos, información del procesador. Ejemplos.
![Page 109: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/109.jpg)
Intel MPI: Referencia de comandos
Comando compilación Compilador por defecto
Lenguaje soportado
Compiladores genéricos
mpicc gcc C
mpicxx g++ C/C++
mpifc gfortran Fortran77/Fortran 95
GNU
mpigcc gcc C
mpigxx g++ C/C++
mpif77 g77 Fortran 77
mpif90 gfortran Fortran 95
Intel
mpiicc icc C
mpiicpc icpc C/C++
mpiifort ifort Fortran77/Fortran 95
![Page 110: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/110.jpg)
Intel MPI: Referencia de comandos
-mt_mpiUsar versión “Thead Safe”Niveles: MPI_THREAD_FUNNELED, MPI_THREAD_SERIALIZED, o MPI_THREAD_MULTIPLE.Por defecto: MPI_THREAD_FUNNELED (ver http://www.mpi-forum.org/docs/mpi-20-html/node165.htm)Activado por defecto con las opciones -openmp, -parallel, -threads, -reentrancy, -reentrancy threaded
-static_mpiLinkado estático de las librerías
-config=<name>Usar el fichero de configuración especificado. Personalizar opciones y entorno.
-profile=<profile_name> (Intel Trace Collector)Especificación de una librería de profiling a usar. Por ej: -profile=vt : -t o -trace , -profile=vtmc : -check_mpiVariablse de entorno relacionadas: I_MPI_{CC,CXX,FC,F77,F90}_PROFILE, I_MPI_TRACE_PROFILE y I_MPI_CHECK_PROFILE
-ilp64Habilita el soporte parcial de ILP64 (enteros 64bits).
![Page 111: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/111.jpg)
Intel MPI: Referencia de comandos
-gCompilar en modo depuración y linkar con la versión de depuración de la librería
-link_mpi=<arg>Usar versión específica de la librería: opt : versión serie optimizadaopt_mt : versión multihilo optimizadadbg : versión depuración seriedbg_mt : versión depuración multihilolog : versión de logging serielog_mt : versión de logging multihiloTambién configurable con la variable de entorno I_MPI_LINK
-OHabilita optimización
-fastOptimización máxima (implica linkado estático)
-echoEn pantalla todo lo que hace el script
![Page 112: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/112.jpg)
Intel MPI: Referencia de comandos
-showMuestra en pantalla lo que hace el script sin ejecutarlo. Útil para ver las opciones de compilación y linkado que se van a usar.
-{cc,cxx,fc,f77,f90}=<compiler>Especifica el compilador a usar.Similar comportamiento que las variables de entorno: I_MPI_{CC,CXX,FC,F77,F90} y MPICH_{CC,CXX,FC,F77,F90}
-gcc-version=<nnn> Especifica la versión de gcc: desde la 3.2.x(320) hasta la 4.7.x(470)
-vVersión del driver y el compilador a usar
Otras variables de entorno de interés:I_MPI_ROOT : especifica el directorio de instalación de la libreríaVT_ROOT : directorio de instalación del Intel Trace Collector
![Page 113: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/113.jpg)
Parallel programming models on large-scale systems require a scalable system for managing the processes that make up the execution of a parallel program.
The process-management system must be able to launch millions of processes quickly when starting a parallel program and must provide mechanisms for the processes to exchange the information needed to enable them communicate with each other.
No hay estándar.En Intel MPI por defecto (comando mpirun ~ mpiexec.hydra) se usa la implementación de PMI Hydra.También Intel MPI puede usar SLURM como gestor de procesos ejecutandose cada uno de los procesos con “srun”
Intel MPI: gestión de procesos
![Page 114: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/114.jpg)
Intel MPI: gestión de procesos
Opciones HYDRA
Globales:
-verbose o -v Muestra en pantalla argumentos de los procesos, variables de entorno que se pasan a la aplicación y el tráfico PMI originado durante la vida del trabajo MPIVariable de entorno: I_MPI_HYDRA_DEBUG
-print-rank-mapMuestra el mapeo de procesos a rangos dentro de la ejecución MPI
-print-all-exitcodesMuestra el código de salida de todos los procesos.
![Page 115: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/115.jpg)
Intel MPI: gestión de procesos
Opciones HYDRA
Locales:
-n <# of processes> o -np <# of processes> Nº de procesos MPI con los que ejecutar
-env <ENVVAR> <value> Fija la variable de entorno <ENVVAR> al valor <value> para todos los procesos MPI.
-envall Propaga todo el entorno actual a todos los procesos MPIVariable de entorno relacionada: I_MPI_HYDRA_ENV
-envnone Suprime la propagación del entorno. -envlist <list of env var names> Pasa una lista de variables de entorno junto sus valores a todos los procesos MPI
![Page 116: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/116.jpg)
Intel MPI: gestión de procesos
Opciones HYDRA
Checkpoint/restart
Sólo disponible para el módulo de red OFA
![Page 117: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/117.jpg)
Intel MPI: Información del procesador
Comando cpuinfo
Proporciona información acerca de la arquitectura del procesador.
Opciones:g: Info general: Nombre del procesador, nº de sockets en el nodo, nº de core/thread en cada socket y modo SMT.
i : Identificación lógica de socket, procesador, core y thread
d : Descomposición del nodo en sockets, procesadores y cores lógicos
c : Info sobre la compartición de los niveles de cache entre los procesadores lógicos
s : Firma del microprocesador: extended family + extended model + family + model + type + stepping
f : Características de microprocesador
A : gidcsf Por defecto gidc
![Page 118: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/118.jpg)
Intel MPI: Ejemplos de ejecución
Ejecución bajos SLURM
Con srun
Usando mpirun (hydra)
![Page 119: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/119.jpg)
Agenda
Intel MPI: (1 hora)
Tuning: automático, pinning y binding y variables de entorno. Ejemplos.
Intel Trace Analyzer and Collector: (1 hora)
IntroducciónCollector: Uso, Instrumentación a nivel de usuario. Ejemplos.Analyzer: Introducción, GUI, CLI y conceptos. Ejemplos.
Benchmarks: (3 horas)
Rendimiento compiladores, MKL y MPI.Benchmarks sintéticos y aplicaciones.
![Page 120: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/120.jpg)
Intel MPI: Tuning
¿Por qué hacer “tuning”?
Tener en cuenta todos los detalles específicos del cluster en el que se va a ejecutar.
Áreas:
● Red de interconexión● “Pinning” de procesos● Comunicaciones punto a punto● Algoritmos colectivos
Técnica:
● Aplicación compilada con optimización● Usar el “tuning” automático disponible en Intel MPI● Entender los esquemas de comunicación involucradas en la aplicación a través de la obtención de
estadísticas● Usar las opciones de “runtime” de MPI
![Page 121: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/121.jpg)
Intel MPI: Tuning
Uso de la utilidad de “tuning” automático
En el cluster:
Ejecutar después de la instalación del cluster y después de cada cambio de configuración.Usar el mismo usuario con le que se ha hecho la instalación de manera que los resultados se incorporen a la instalación.
1) mpitune2) mpirun -tune -np 32 ./mi_programa
La ejecución de mpitune es pesada y es conveniente realizarla deacuerdo a las políticas de administración ejecución.
![Page 122: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/122.jpg)
Intel MPI: Tuning
mpitune
mpitune [ -a \"<application command line>\" ] [ -of <file-name> ] \ [ -t \"<test_cmd_line>\" ] [-cm ] [ -d ] [ -D] \ [ -dl [d1[,d2...[,dN]]] ] [ -fl [f1[,f2…[,fN]]] ] [ -er ] \ [ -hf <hostsfile> ] [ -h ] [ -hr {min:max|min:|:max} ] \ [ -i <count> ] [ -mr {min:max|min:|:max}] [ -od <outputdir> ] \ [ -odr <outputdir> ] [ -r <rshcmd>] [ -pr {min:max|min:|:max}] \ [ -sf [file-path] ] [ -ss ] [ -s ] [ -td <dir-path> ] \ [ -tl <minutes> ] [ -mh ] [ -os <opt1,...,optN> ] \ [ -oe <opt1,...,optN> ] [ -V ] [ -vi {percent} ; -vix {X factor} ]\ [ - zb ] [ -t ] [ -so ] [ -ar \"reg-expr\" ] [ -trf <appoutfile> ]\ [ -m {base|optimized} ] [ -avd {min|max} ] [ -pm {mpd|hydra} ] \ [ -co ] [ -sd ] [ -soc ]
![Page 123: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/123.jpg)
Intel MPI: Tuning
mpitune:
-a \"<application command line>\"Modo de aplicación. Se optimiza para la aplicación específica.
-i <count>Nº de iteracciones en cada prueba (por defecto 3)
-mr {min:max|min:|:max}Tamaño de mensaje mínimo (por defecto 0) y máximo (por defecto 4194304) a usar. Es posible usar sufijos (kb, mb o gb)
-pr {min:max|min:|:max}Fija el máximo (nº cores en el nodo) y el mínimo (por defecto 1) nº de procesos por nodo
-tl <minutes>Limita el tiempo de ejecución
![Page 124: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/124.jpg)
Intel MPI: Tuning
“Pinning” y “binding”
Procesos MPI a procesadores lógicos determinados.
Identificador de procesadores:Numeración lógica del sistemaNumeración topológica basada en 3 niveles (package/socket, core, thread)
Nodo
Package 0
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
Package 1
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
SO: 0,16 1,17 2,18 3,19 4,20 5,21 6,22 7,23 8,24 9,25 10,26 11,27 12,28 13,29 14,30 15,31
![Page 125: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/125.jpg)
Intel MPI: Tuning
“Pinning” y “binding”
Variables de entorno:
I_MPI_PIN=<disable | no | off | 0>Se usa para inhabilitar el pinning de procesos activado por defecto en la librería
I_MPI_PIN_MODE=<pm|lib >Método de “pinning”: a través del gestor de procesos (pm) o por la librería MPI (lib)pm : a través de herramientas del sistema lo que permite pinning y binding (uso de memoria cercana en NUMA)lib : no asegura el acceso cercano a la memoria
![Page 126: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/126.jpg)
Intel MPI: Tuning
Valores explicitos para los parámetros anteriores:fine : valor mínimocore : unidades que componen un corecache1 : unidades que comparten L1cache2 : unidades que comparten L2cache3 : unidades que comparten L3cache : valor mayor de cache1, cache2 o cache2socket | sock : unidades por sockethalf | mid : medio socket third : un tercio de socketquarter : un cuarto de socketoctavo : un octavo de socket
I_MPI_PIN_PROCESSOR_LIST=<value> 1. <proclist> : lista de nºs/rangos de procesadores lógicos separados por comas2. [<procset>][:[grain=<grain>][,shift=<shift>]\[,preoffset=<preoffset>][,postoffset=<postoffset>]<procset> : all (procesadores lógicos)| allcores (cores)| allsocks (sockets)<grain> : granularidad<shift> :salto en la selección entero positivo<preoffset> : desplazamiento en la selección inicial<postoffset> : desplazamiento en la selección final (alias offset)3. [<procset>][:map=<map>]<map> : bunch (lo más próximos en le socket)| scatter (lo más alejados posibles con compartición de recursos mínima) | spread (procesos consecutivos)
“Pinning” y “Binding”
![Page 127: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/127.jpg)
Intel MPI: Tuning
“Pinning” y “binding”
export I_MPI_PIN_PROCESSOR_LIST=0,1,2,3
Nodo
Package 0
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
Package 1
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
SO: 0,16 1,17 2,18 3,19 4,20 5,21 6,22 7,23 8,24 9,25 10,26 11,27 12,28 13,29 14,30 15,31
![Page 128: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/128.jpg)
Intel MPI: Tuning
“Pinning” y “binding”
export I_MPI_PIN_PROCESSOR_LIST=”allcores:grain=2,shift=4”
Nodo
Package 0
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
Package 1
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
SO: 0,16 1,17 2,18 3,19 4,20 5,21 6,22 7,23 8,24 9,25 10,26 11,27 12,28 13,29 14,30 15,31
![Page 129: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/129.jpg)
Intel MPI: Tuning
“Pinning” y “binding”
Probar ejemplos:
Nodo
Package 0
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
Package 1
c0 c1 c2 c3 c4 c5 c6 c7
t0,t1 t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1t0,t1
SO: 0,16 1,17 2,18 3,19 4,20 5,21 6,22 7,23 8,24 9,25 10,26 11,27 12,28 13,29 14,30 15,31
![Page 130: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/130.jpg)
Agenda
Intel MPI: (1 hora)
Tuning: automático, pinning y binding y variables de entorno. Ejemplos.
Intel Trace Analyzer and Collector: (1 hora)
IntroducciónCollector: Uso, Instrumentación a nivel de usuario. Ejemplos.Analyzer: Introducción, GUI, CLI y conceptos. Ejemplos.
Benchmarks: (3 horas)
Rendimiento compiladores, MKL y MPI.Benchmarks sintéticos y aplicaciones.
![Page 131: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/131.jpg)
Intel Trace Analyzer and Collector
http://software.intel.com/en-us/articles/intel-trace-analyzer-and-collector-documentation
Visualización y compresión del comportamiento de la aplicación paralela MPIEvaluación de estadísticas de profile y de balance de carga Rendimiento de rutinas y bloques de códigoAprender sobre el modelo de comunicaciones y datos de rendimiento.Identificación de “hotspots”.
Intel Trace Collector produce ficheros de traza que pueden ser analizados posteriormente con la herramienta Intel Trace Analyzer.Las trazas recogen información sobre las llamadas MPI y los mensajes transmitidos e incluso eventos específicos definidos por el usuario.
Su uso requiere simplemente el relinkado de la aplicación.
![Page 132: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/132.jpg)
Agenda
Intel MPI: (1 hora)
Tuning: automático, pinning y binding y variables de entorno. Ejemplos.
Intel Trace Analyzer and Collector: (1 hora)
Introducción
Collector: Uso, Instrumentación a nivel de usuario. Ejemplos.Analyzer: Introducción, GUI, CLI y conceptos. Ejemplos.
Benchmarks: (3 horas)
Rendimiento compiladores, MKL y MPI.Benchmarks sintéticos y aplicaciones.
![Page 133: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/133.jpg)
Intel Trace Collector
Compilación:No es necesario ningún cambio a no ser que se use específicamente el API propio del “Collector”.
API Collector: VT.h para C/C++ y VT.inc para Fortran. (-I$(VT_ROOT)/include)
Linkado:Mediante el uso de las variables de entorno: VT_ADD_LIBS VT_LIB_DIRMétodo simple: opción -trace
mpiicc -trace -o ctest.exe ctest.c
Aplicaciones C++ y compiladores GNU: -lmpigc/-lmpigc3/-lmpigc4 (según versión de g++)
Ejecución:
mpirun -trace -n 4 myApp
export LD_PRELOAD=libVTmc.so (Message Checker)mpirun -n 4 myApp
Ficheros de traza originados: *.stf (Structured Trace File Format (STF))
![Page 134: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/134.jpg)
Intel Trace Collector
Aplicaciones MPI que fallan:
Existe la versión tolerante a fallos que permite la generación de las trazas:
mpicc -profile=vtfs -o ctest ctest.c
MPI-IO
Intel Trace Collector no soporta ROMIO lo que imposibilita la obteción de trazas de este tipo de aplicaciones.
Ejemplos: /apps/intel/itac/8.1.3.037/examples
![Page 135: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/135.jpg)
Intel Trace Collector
Aplicaciones no MPI
Es posible la obtención de trazas de aplicaciones no MPI mediante la librería libVTcs.a
-lVTcs $VT_ADD_LIBS
La aplicación debe llamar VT_initialize() y VT_finalize() para generar la traza.
Los compiladores de Intel pueden instrumentar automaticamente las funciones en compilación.
Opciones:
-tcollect y -tcollect=VTcs (aplicaciones no MPI)Todas las funciones son instrumentadas
-tcollect-filter <file>Para filtrar las funciones a instrumentar:func1 onfunc2 off
gcc/g++ : Compilar con -finstrument-function
![Page 136: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/136.jpg)
Intel Trace Collector
Aplicaciones binarias
Utilidad itcpin:
itcpin [<ITC options>] -- <application command line>
--list : lista las funciones del ejecutable (acompañar con --debug : funciones agrupadas por ficheros fuente, --demangle útil para C++ mostrando los métodos por clases ...)
--run : ejecuta el programa. Por defecto usa libVT si encuentra funciones MPI sino con la opción –-insert se especifica la librería a usar.
--profile : tracing de funciones (filtros con --state, --activity, --symbol, --config)
![Page 137: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/137.jpg)
Intel Trace Collector
Soporta Multihilo
Información estadística: útil cuando desconocemos la magnitud de la traza. Variables de entorno: VT_STATISTICS=ON y VT_PROCESS=OFFstftool –print-statistics : obtener las estadisticas de los ficheros stf
Combinación con información de rendimiento hardware: llamada de sistema getrusage() + PAPI (Performance Application Programming Interface)
Combinación con contadores del sistema operativo: Opción de configuración COUNTER <counter name> ON.disk_io| net_io | cpu_idle | cpu_sys | cpu_usr
Tracing de aplicaciones distribuidas (comunicación distinta de MPI): VTserver
![Page 138: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/138.jpg)
Intel Trace Collector
Probemos ejemplos ...
![Page 139: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/139.jpg)
Agenda
Intel MPI: (1 hora)
Tuning: automático, pinning y binding y variables de entorno. Ejemplos.
Intel Trace Analyzer and Collector: (1 hora)
IntroducciónCollector: Uso, Instrumentación a nivel de usuario. Ejemplos.
Analyzer: Introducción, GUI, CLI y conceptos. Ejemplos.
Benchmarks: (3 horas)
Rendimiento compiladores, MKL y MPI.Benchmarks sintéticos y aplicaciones.
![Page 140: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/140.jpg)
Intel Trace Analyzer
Comando:
traceanalyzer <fichero de traza>
Aplicación gráfica que permite visualizar los datos de las trazas. Cada vez que se abre un fichero de traza se crea un fichero de cache con datos procesados de la información de la traza para facilitar la gestión.
![Page 141: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/141.jpg)
Intel Trace Analyzer
![Page 142: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/142.jpg)
Intel Trace Analyzer
Interface de línea de comandos
Procesado de los ficheros de traza sin la necesidad de usar la GUI
Por ej: creación de ficheros de cache (en algunos casos es un proceso demandante):traceanalyzer --cli trace.stf -c0 -w
Están disponibles numerosas opciones de uso experto de utilidad en el desarrollo de scripts de automatización aunque no se asegura el mantenimiento de estas opciones entre versiones.
![Page 143: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/143.jpg)
Probemos ejemplos ...
Intel Trace Analyzer
![Page 144: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/144.jpg)
Agenda
Intel MPI: (1 hora)
Tuning: automático, pinning y binding y variables de entorno. Ejemplos.
Intel Trace Analyzer and Collector: (1 hora)
IntroducciónCollector: Uso, Instrumentación a nivel de usuario. Ejemplos.Analyzer: Introducción, GUI, CLI y conceptos. Ejemplos.
Benchmarks: (3 horas)
¿Casos de usuarios?Rendimiento compiladores, MKL y MPI.Benchmarks sintéticos y aplicaciones.
![Page 145: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/145.jpg)
Benchmarks
Rendimiento pico (Peak performance):
FLOPS=cores×clock×(FLOPscycle
)
GFLOPS = #chassis * #nodes/chassis * #sockets/node * #cores/socket * GHz/core * FLOPs/cycle
http://www.intel.com/support/processors/sb/CS-017346.htm
FLOPs/cycle: se consideran operaciones de datos de 64bits de coma flotante. Depende de la implementación hardware de las operaciones de coma flotante en el procesador (ver https://sites.google.com/a/stanford.edu/fpgen/why). Habitualmente 4 (2 FPUs con capacidad de 2 operaciones simultaneas por ciclo) aunque puede ser 2 por ej en los atom o 8 si vamos a los procesadores del intel mic (8 Fused Multiply and Add (FMA) floating point operations in double precision).
Lista de rendimientos pico de los procesadores de intel:
![Page 146: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/146.jpg)
Benchmarks
Intel MPI Benchmarks (Ver guía de usuario):
1) Descomprimir:tar zxvf imb-3.2.4-updated.tgz- ./doc (ReadMe_IMB.txt; IMB_Users_Guide.htm; IMB_Users_Guide.pdf, the methodology description)- ./src (program source code and Makefiles)- ./license (Source license agreement, trademark and use license agreement)- ./versions_news (version history and news)- ./WINDOWS (Microsoft* Visual Studio* projects)
2) Compilar con las herramientas de intel:module load icc impigmake -f make_ict
Alternativamente con mvapich2: gmake -f make_mpich (editar make_mpich y fijar MPI_HOME adecuadamente)
Se obtienen los siguientes ejecutables: IMB-EXT,IMB-IO,IMB-MPI1
3) Ejecutar como cualquier programa mpi
![Page 147: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/147.jpg)
Benchmarks: HPL Linpack
Intel LinpackIncluido en la mkl: composerxe/mkl/benchmarks Incluye código fuente y binarios precompilados para todas las arch de intel.Incluye el modo híbrido (MPI/OpenMP) que puede ser muy interesante en casos de una red lenta.Descargable directamente:http://software.intel.com/en-us/articles/intel-math-kernel-library-linpack-download
HPL - A Portable Implementation of the High-Performance Linpack Benchmark for Distributed-Memory Computershttp://www.netlib.org/benchmark/hpl
La compilación necesita librerías de blas/lapack. No es recomendable el uso de las versiones que vienen como paquete por defecto en la rhel. Sin embargo se puede instalar como paquete atlas (atlas-sse3.x86_64 librerías en /usr/lib64/atlas-sse3).
Librería opensource blas/lapack con buen rendimiento: http://www.openblas.netSería necesario compilarla adecuadamente previo al hpl.
![Page 148: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/148.jpg)
Benchmarks: HPL Linpack
HPL – Parametros principales (HPL.dat)
N: Tamaño del problema. Se suele recomendar un tamaño del problema que ocupe el 80% de la memoria disponible. Sin embargo actualmente esto es muy alto y hace que el tiempo de computo sea enorme: incrementar hasta obtener pico.
P,Q:grid de procesos. Define el nº de procesadores a usar: P*QSe recomienda que sean lo más parecido posibles.Aproximación a la memoria requerida: 8 * N * N / (P * Q) bytes
NBs: Tamaño de bloque de la rutina de multiplicación de matrices. En el caso de las Intel MKL se recomienda probar estos 3: 256, 192, 128. Con otras librerías algún otro puede ser el óptimo … Tocaría probar: desde el pto. de vista de la distribución de los datos conviene tamaños pequeños pero desde el pto. de vista del computo conviene que no sea muy pequeño ya que perderías reutilización y desaprovecharías caches.
Broadcast: Tipo de algoritmo para hacer el broadcastEn general probar las 5 opciones, 4 y 5 deberían ser óptimas para el caso de tener nodos muy rápidos comparados con las comunicaciones (red de alta latencia).
![Page 149: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/149.jpg)
Benchmarkings Sintéticos
MPI:Intel MPI Benchmarks:http://software.intel.com/en-us/articles/intel-mpi-benchmarkshttp://software.intel.com/sites/products/documentation/hpc/ics/imb/32/IMB_Users_Guide/IMB_Users_Guide.pdf
Fácil uso. Validación de una instalación.
OSU Micro Benchmarks:http://mvapich.cse.ohio-state.edu/benchmarks
Similar al IMB aunque más actualizado.
![Page 150: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/150.jpg)
Benchmarkings Sintéticos
HPCC Challenge Benchmark: HPL (LINPACK) + Adicionales (STREAM,FFT …):
http://icl.cs.utk.edu/hpcc
●Uso de kernels más cercanos al “mundo real”●Escalado del tamaño de datos y tiempo deacuerdo al sistema
![Page 151: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/151.jpg)
Benchmarkings Sintéticos
NAS Parallel Benchmarks
http://www.nas.nasa.gov/publications/npb.html
●Kernels de aplicaciones de CFD (elementos finitos, mallados, ...)●Escalado del tamaño de datos y tiempo deacuerdo al sistema●Disponibles tanto para MPI como para OpenMP●Distintos parámetros y tamaños agrupados en clases:http://www.nas.nasa.gov/publications/npb_problem_sizes.html
![Page 152: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/152.jpg)
Benchmarkings Aplicaciones
Muy heterogéneos.No suele haber referencias estándar, depende de cada aplicación.
http://www.deisa.eu/science/benchmarking
Intentos de referencias “estándar”:
![Page 153: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/153.jpg)
Servidor UCA
![Page 154: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/154.jpg)
Servidor UCA
![Page 155: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/155.jpg)
SLURM
Guía básica de uso
Lanzar un trabajo a cola que utilizará 2 nodos: sbatch -N2 trabajo.sh
Ver el estado de las colas: squeue sjstat
Ver la salida estándar del trabajo con identificador 8: cat slurm-8.out
Lanzar un comando en interactivo en 2 nodos: srun -N2 -l /bin/hostname
Ver información general sobre los nodos y las particiones de SLURM: sinfo
![Page 156: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/156.jpg)
SLURM
sbatch
Con este comando se envía a Slurm un script a ejecutar, el cual contendrá la llamada al/los ejecutable/s que se quiere ejecutar en los recursos asignados al trabajo.Las opciones del comando se le pueden pasar de forma interactiva, o dentro del script, con #SBATCH y la forma larga de la opción.El comando devuelve el identificador del trabajo.
sbatch -N2 -n32 trabajo.sh
![Page 157: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/157.jpg)
SLURM
srun
Con este comando se envía directamente el ejecutable, en lugar de un script, que correrá en todos los recursos solicitados a través de opciones del comando.El comando devuelve la salida del ejecutable que se pasa como parámetro.
srun -N2 -l /bin/hostname
![Page 158: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/158.jpg)
SLURM
salloc
Con este comando se solicita una asignación de resursos para el ejecutable que se le pasa como parámetro, generalmente un programa para usar de forma interactiva. Si no se le pasa ningún programa como parámetro toma por defecto la shell predefinida del usuario (p.ej:bash) y la abre, de tal forma que desde esa shell el usuario tiene control directo sobre los recursos que le acaban de ser asignados.
salloc -n2
![Page 159: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/159.jpg)
SLURM
scancel <job-id>
Con este comando se cancela un trabajo. También puede usarse para mandar señales específicas.
scancel 832scancel --signal=USR1 --batch 1236
![Page 160: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/160.jpg)
SLURM
Opciones básicas
-n, --ntasks=<number>For srun this option specify the number of tasks to run.
sbatch and salloc do not launch tasks, they request an allocation of resources and submits a batch script (sbatch) or executes some command (salloc).
-N, --nodes=<minnodes[-maxnodes]> Request that a minimum of minnodes nodes be allocated to this job. A maximum node count may
also be specified with maxnodes. If only one number is specified, this is used as both the minimum and maximum node count. If -N is not specified, the default behavior is to allocate enough nodes to satisfy the requirements of the -n and -c options.
-t, --time=<time> Acceptable time formats include "minutes", "minutes:seconds", "hours:minutes:seconds",
"days-hours", "days-hours:minutes" and "days-hours:minutes:seconds".
![Page 161: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/161.jpg)
SLURM
Otras opciones
-p, --partition=<partition_names> Request a specific partition for the resource allocation. If not specified, the default behavior is to allow the slurm controller to select the default partition as designated by the system administrator. If the job can use more than one partition, specify their names in a comma separate list and the one offering earliest initiation will be used.
--ntasks-per-node=<ntasks> Request the maximum ntasks be invoked on each node. Meant to be used with the --nodes option. This is related to --cpus-per-task=ncpus, but does not require knowledge of the actual number of cpus on each node. In some cases, it is more convenient to be able to request that no more than a specific number of tasks be invoked on each node. Examples of this include submitting a hybrid MPI/OpenMP app where only one MPI "task/rank" should be assigned to each node while allowing the OpenMP portion to utilize all of the paral- lelism present in the node, or submitting a single setup/cleanup/monitoring job to each node of a pre-existing allocation as one step in a larger job script.
![Page 162: Aurelio Rodríguez aurelio@cesga - UCAsupercomputacion.uca.es/wp-content/uploads/2013/10/PT... · 2017-06-14 · Intel MPI: (1 hora) Tuning: automático, pinning y binding y variables](https://reader030.vdocuments.pub/reader030/viewer/2022041105/5f066be87e708231d417e989/html5/thumbnails/162.jpg)
SLURM
Probemos ejemplos