Corrigiendo Errores de Paralelización con Intel® Thread Checker para Hilos Explícitos Intel Software College.

Slides:



Advertisements
Presentaciones similares
MOVIMIENTO JOVENES DE LA CALLE CIUDAD DE GUATEMALA chi siamo quienes-somos qui sommes-nous who we are attività actividades activités activities scuola.
Advertisements

¿PARA QUE ESTAMOS AQUÍ? LOS OBJETIVOS DE LA ENCARNACIÓN.
SIES – SISTEMA INTEGRADO DE EDUCACIÓN SUPERIOR
SIES – SISTEMA INTEGRADO DE EDUCACIÓN SUPERIOR
1 Datos sobre webloggers Datos extraidos de la encuesta a webloggers disponibles en la web de los autores.
el 1, el 4 y el 9 tres cuadrados perfectos autosuficientes
Juan F. Velazquez Mayra E. Beltran Jaime Lopez
Metodología de programación paralela
Programación Multi-core: Conceptos básicos
Seminario El Futuro del Seguro de Vida
1 PRINCIPALES INDICADORES DEL DESARROLLO DE LA SOCIEDAD DE LA INFORMACIÓN EN GALICIA CUADRO DE MANDO Apartado: Empresas Septiembre de 2004.
1 INFORME RESUMEN SOBRE EL NIVEL DE UTILIZACION DE LAS TIC EN LAS EMPRESAS GALLEGAS ( Resumen PYMES ) Noviembre de 2004.
1 INFORME RESUMEN SOBRE EL NIVEL DE UTILIZACION DE LAS TIC EN LAS EMPRESAS GALLEGAS (MICROEMPRESAS, resultados provisionales) 29 de julio de 2004.
AYUDA A LA FUNCIÓN DOCENTE Internet
TEMA 2 MÚLTIPLOS Y DIVISORES
02- Plan Organización Docente v.2 Noviembre 2009 SIES – SISTEMA INTEGRADO DE EDUCACIÓN SUPERIOR.
02- PLAN DOCENTE Febrero 2009 SIES – SISTEMA INTEGRADO DE EDUCACIÓN SUPERIOR.
01- OFERTA FORMATIVA v.2 Noviembre 2009 SIES – SISTEMA INTEGRADO DE EDUCACIÓN SUPERIOR.
Respuestas Buscando a Nemo.
ABECEDARIO FIGURAS GEOMÉTRICAS NÚMERO
A la izquierda A la derecha Todo recto
Área Razón Social 0 0 Telefónica Servicios Audiovisuales S.A. / Telefónica España S.A. Título de la ponencia / Otros datos de interés / Kit.
BLOQUE 3: Adaptación de multifocales
Los Objetos de la Clase Escriban la palabra (the word) en español para los objetos de la clase (#1-20).
ARQUITECTURA DE COMPUTADORES - PIPELINING
Programando con Hilos POSIX* Intel Software College.
Programación con OpenMP* Intel Software College. Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or.
Hilos Capítulo 5 Silberschatz Galvin. Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered.
Programando con Hilos de Windows* Intel Software College.
MOVIMIENTO JOVENES DE LA CALLE CIUDAD DE GUATEMALA chi siamo quienes-somos qui sommes-nous who we are attività actividades activités activities alimentazione.
1. Apoyo exterior sobre ala inferior de viga de acero
DIRECCIÓN DE COMUNICACIÓN PÚBLICA CORTE SUPREMA DE JUSTICIA DE LA NACIÓN DIRECCIÓN DE COMUNICACIÓN PÚBLICA.
Examen FRAD Empezar. 1. ¿Cu á l es la diferencia entre FRAD y FRANAR? 1.FRAD son las siglas de un grupo de trabajo de OCLC y FRANAR las siglas de un grupo.
Microsoft Office Power Point, es una herramienta que nos proporciona Microsoft, para editar presentaciones graficas, de tal forma que se nos feliciten.
Instrumentación Industrial
Entrada y salida Fundamentos de programación/Programación I
Visual basic Curso de Habilitación Laboral IV. ¿Qué es Visual Basic Visual Basic es uno de los tantos lenguajes de programación que podemos encontrar.
Un constructor es un método que inicia un objeto inmediatamente después de su creación. De esta forma nos evitamos el tener que iniciar las variables.
Funciones Excel. Parte 1. Introducción 2 Una función Excel es una fórmula o un procedimiento que se realiza en el ambiente de Visual Basic, fuera de.
CENTRO DE BACHILLERATO TECNOLOGICO INDUSTRIAL Y DE SERVIVCIOS No 3
Pasos para realizar la declaración Jurada de Patrimonio Has clic en el botón naranja para iniciar el registro de datos Para llenar la planilla debe utilizar.
Procedimientos Almacenados y Disparadores
-17 Expectativas sobre la situación económica (Europa) Septiembre 2013 Indicador > +20 Indicador 0 a +20 Indicador 0 a -20 Indicador < -20 Total Unión.
Repaso del capítulo Primer Paso
Capítulo 2 El Vocabulario Nuevo.
Copyright © 2008 SERVIR Project. All rights reserved. SERVIR Data Portal Workshop SERVIR Map Maker Studio - MMS -
Corrigiendo Errores en la Paralelización con Intel® Parallel Inspector.
INFORME USDA NOVIEMBRE TRIGO 2 MERCADO INTERNACIONAL (Millones de Toneladas) 3.
Calendario 2008 Imágenes variadas Venezuela Elaborado por: MSc. Lucía Osuna Wendehake psicopedagogiaconlucia.com Enero 2008.
EL OSO APRENDIZ Y SUS AMIGOS
Las NIC MARCO CONCEPTUAL NIC 1: PRESENTACIÓN ESTADOS FINANCIEROS
1 PROYECTO DE PRESUPUESTO DE EGRESOS DE LA FEDERACION 2002 COORDINACIÓN DE POLITICA ECONOMICA GP-PRD.
RETIRO DE COMALCALCO DIC. 2012
Proyecto para Centros que trabajan una vez por semana.
Ecuaciones Cuadráticas
3 Enero 2010 PERÚ: IV CENSO NACIONAL ECONÓMICO, APURÍMAC.
Mecanismos 3º ESO Soluciones cuestiones teóricas Curso
para desarrolladores Minimizar el cambio Concentrarse en estabilidad, confiabilidad y rendimiento. Ayudar a mejorar la productividad Reducir la curva.
ESTRUCTURAS DE CONTROL
Proyecto Fin de Carrera E.T.S. Ingeniería Informática 26 de Septiembre de 2006 DESARROLLO DE UN COMPONENTE TECLADO ALUMNO: Fco. Javier Sánchez Ramos TUTORES:
EVOLUCION DE PRECIOS Y MARGENES DE MOLIENDA MAYO
CULENDARIO 2007 Para los Patanes.
BEATRIZ LAFONT VILLODRE
CURSO MULTIHAZ HYPACK ®
SpanishNumbers Uno 2 Dos 3 Tres 4 Quatro.
MSc. Lucía Osuna Wendehake
Calendario 2009 “Imágenes variadas” Venezuela Elaborado por: MSc. Lucía Osuna Wendehake psicopedagogiaconlucia.com Enero 2009.
Manual de Procedimientos Procedimiento de ejecución del programa de
CHAPTER 4 VOCABULARY: PART II
Transcripción de la presentación:

Corrigiendo Errores de Paralelización con Intel® Thread Checker para Hilos Explícitos Intel Software College

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 2 Intel® Thread Checker Objetivos Al término de este módulo será capaz de… Usar el Thread Checker para detectar e identificar la variedad de problemas de paralelizar correctamente en aplicaciones paralelizadas en Windows* Determinar si las funciones de librería son thread-safe

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 3 Intel® Thread Checker Agenda ¿Qué es el Intel® Thread Checker? Detectando condiciones de concurso Thread Checker como un asistente de paralelización Algunos otros errores de paralelización Verificando librerías thread-safety Otras características del Thread Checker

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 4 Intel® Thread Checker Motivación Desarrollar aplicaciones con hilos puede ser una tarea completa Nuevos problemas a causa de la interacción entre hilos concurrentes Condiciones de concurso o conflictos en el almacenamiento Más de un hilo accede memoria sin sincronización Deadlocks Un hilo espera un evento que nunca sucederá

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 5 Intel® Thread Checker Herramienta de depuración para software multihilos Encuentra errores en software multihilos en Windows*, POSIX*, y OpenMP* Localiza los errores rápidamente que pueden llevar días usando métodos y herramientas tradicionales Aísla problemas, no los síntomas Un error no tiene que ocurrir para encontrarlo Se instala en el VTune Performance Analyzer Misma interfaz que el ambiente VTune

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 6 Intel® Thread Checker Características del Intel® Thread Checker Soporta varios compiladores diferentes Compiladores Intel® C++ y Fortran v7 y posterior Microsoft* Visual* C++, v6 Microsoft* Visual* C++.NET* ediciones 2002, 2003 y 2005 Integrado en el Microsoft Visual Studio.NET* IDE Ver código fuente para diagnósticos Ayuda de Un-click para diagnósticos Posibles causas y sugerencias para solucionarlo API para primitivas de sincronización definidas por el usuario

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 7 Intel® Thread Checker Thread Checker: Análisis Dinámico como se ejecuta el software Datos (workload) – arrojados por la ejecución Incluye monitoreo de: Hilos y APIs de Sincronización usadas Orden de ejecución de hilos El planificador impacta en los resultados Accesos a memoria entre hilos La ruta del código debe ejecutarse para ser analizada

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 8 Intel® Thread Checker Thread Checker: Antes de Comenzar Instrumentación: background Añade llamadas a la librería para registrar información Hilos y APIs de sincronización Accesos a memoria Incrementa el tiempo y tamaño de ejecución Usar conjuntos de datos pequeños El tiempo y espacio de ejecución se expande Múltiples ejecuciones sobre diferentes rutas dan mejores resultados La selección de carga de trabajo es importante

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 9 Intel® Thread Checker Consejos para la Carga de Trabajo Ejecutar el código problema una vez por hilo a identificarse Utilizar el conjunto de datos de trabajo lo más pequeño posible Minimizar el tamaño del conjunto de datos Tamaños de imágenes más pequeños Minimizar iteraciones de ciclos o escalas de tiempo Simula minutos en vez de días Minimizar tasas de actualización Menos cuadros por segundo Encuentra errores de paralelización más rápido

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 10 Intel® Thread Checker Compilando para el Thread Checker Compilar Usar librerías dinámicamente encadenadas (thread-safe runtime libraries) ( /MD, /MDd ) Genera información simbólica ( /Zi, /ZI, /Z7 ) Deshabilita optimizaciones ( /Od ) Encadenar (link) Preserva información simbólica ( /debug ) Especifica secciones de código relocalizables ( /fixed:no )

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 11 Intel® Thread Checker Instrumentación Binaria Construir binario con un compilador soportado Ejecutando la aplicación Debe ejecutarse dentro del Thread Checker La aplicación es instrumentada cuando se ejecuta Los DLLs externos se instrumentan conforme se van necesitando

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 12 Intel® Thread Checker Instrumentación Fuente Compiladores de Intel® C++ o Fortran Compila con /Qtcheck Ejecutando la aplicación Inicia en el ambiente VTune Inicia desde la línea de comandos de Windows* Los datos son almacenados en el archivo de resultados threadchecker.thr Ver los resultados (archivo.thr) en el ambiente Vtune DLLs adicionales no son instrumentados o analizados Diagnósticos más detallados

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 13 Intel® Thread Checker Intel® Thread Checker Wizard Intel® Thread Profiler Wizard Advanced Activity Configuration Iniciando Thread Checker 1) Debe seleccionar Threading Wizards Intel® Thread Checker Wizard 2) Para mostrar Wizards

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 14 Intel® Thread Checker Diagnósticos del Thread Checker

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 15 Intel® Thread Checker Agrupando Diagnósticos

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 16 Intel® Thread Checker Ver Código Fuente

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 17 Intel® Thread Checker Diagnósticos, Ayuda 1) Haz click aquí... 2) Más Ayuda!

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 18 Intel® Thread Checker Actividad 1a – Energía Potencial Crear y ejecutar la versión serial Crear la versión paralelizada Ejecutar la aplicación en el Thread Checker para identificar problemas con la paralelización

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 19 Intel® Thread Checker Análisis de Dependencias Considere el código serial: Dependencias de flujo entre S1 y S2 Valor de A actualizado en S1 se usa en S2 Anti-dependencia entre S2 y S3 Se lee el valor de A en S2 antes de que sea escrito en S3 Dependencia de salida entre S3 y S4 Valor de A asignado en S3 debe ocurrir antes de la asignación en S4 S1: A = 1.0; S2: B = A ; S3: A = 1/3 * (C – D); S4: A = (B * 3.8) / 2.7;

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 20 Intel® Thread Checker Dependencias Thread Checker Dependencia de Salida Conflicto Escritura-Escritura: un hilo actualiza una variable que es subsecuentemente actualizada por otro hilo Anti-dependencia Conflicto Lectura-Escritura: un hilo lee una variable que es subsecuentemente actualizada por otro hilo Dependencia de Flujo Conflicto Escritura-Lectura: un hilo actualiza una variable que es subsecuentemente leída por otro hilo

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 21 Intel® Thread Checker Condiciones de Concurso El orden de ejecución se asume pero no puede garantizarse Acceso concurrente a la misma variable por varios hilos El error más común en programas multihilos No siempre obvios

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 22 Intel® Thread Checker Resolviendo Condiciones de Concurso Solución: Variables locales en los hilos Cuando usarlas Valor calculado no se usa fuera de la región paralela Variables temporales o de trabajo Cómo implementar OpenMP cláusulas ( private, shared ) Declara variables dentro de las funciones de los hilos Asigna las variables dentro del stack del hilo TLS (Thread Local Storage) API

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 23 Intel® Thread Checker Resolviendo Condiciones de Concurso Solución: Controla el acceso compartido con regiones críticas Cuando usar El valor calculado se usa fuera de la región paralela El valor compartido es requerido por cada hilo Cómo implementar Exclusión mutua y sincronización Locks, semáforos, eventos, secciones críticas, operaciones atómicas… Regla del pulgar: Usar un lock por elemento de datos

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 24 Intel® Thread Checker Actividad 1b – Energía Potencial Arreglar los errores encontrados por el Thread Checker

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 25 Intel® Thread Checker Asistente de Implementación Cuando se están implementando hilos Variables que obviamente son públicas y privadas pueden ser identificadas y manejadas ¿Deben analizarse las variables restantes por dependencias? ¿Qué pasa si el código paralelo es cientos de líneas? ¿Qué sucede si una variable es usada en funciones? ¿Podemos decir si los apuntadores se refieren a la misma posición de memoria? Usar Thread Checker como un asistente para paralelizar Paralelizar especulativamente (¿prototipo OpenMP?) Compilar y ejecutar el programa en Thread Checker Revisar diagnósticos Actualizar directivas y/o reestructurar Permite que Thread Checker haga el trabajo pesado

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 26 Intel® Thread Checker Deadlock (interbloqueo) Causado por un hilo que espera un evento que nunca ocurrirá La causa más común es jerarquía en los bloqueos Siempre bloquea y desbloquea en el mismo orden Evita jererquías si es posible DWORD WINAPI threadA(LPVOID arg) { EnterCriticalSection(&L1); EnterCriticalSection(&L2); processA(data1, data2); LeaveCriticalSection(&L2); LeaveCriticalSection(&L1); return(0); } DWORD WINAPI threadB(LPVOID arg) { EnterCriticalSection(&L2); EnterCriticalSection(&L2); EnterCriticalSection(&L1); EnterCriticalSection(&L1); processB(data2, data1) ; processB(data2, data1) ; LeaveCriticalSection(&L1); LeaveCriticalSection(&L1);LeaveCriticalSection(&L2); return(0); return(0);} ThreadA: L1, después L2 ThreadB: L2, después L1

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 27 Intel® Thread Checker Deadlock (interbloqueo) Añade un lock por elemento Bloquea solo elementos, no todo el arreglo de elementos void swap (shape_t A, shape_t B) { lock(a.mutex); lock(b.mutex); // Swap data between A & B unlock(b.mutex); unlock(a.mutex); } typedef struct { // some data things SomeLockType mutex; } shape_t; shape_t Q[1024]; swap(Q[986], Q[34]); Hilo 4 swap(Q[34], Q[986]); Hilo 1 Tomar mutex 34 Tomar mutex 986

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 28 Intel® Thread Checker Hilos Detenidos Un hilo espera una cantidad de tiempo excesiva Usualmente en un recurso Comunmente causado por locks que no son liberados Asegurarse que los hilos liberen todos los locks retenidos

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 29 Intel® Thread Checker ¿Qué está mal? int data; DWORD WINAPI threadFunc(LPVOID arg) { int localData; EnterCriticalSection(&lock); if (data == DONE_FLAG) return(1); localData = data; LeaveCriticalSection(&lock); process(local_data); return(0); } Lock nunca liberado

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 30 Intel® Thread Checker Actividad 2 - Deadlock Use Intel® Thread Checker para encontrar y corregir el problema potencial de deadlock.

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 31 Intel® Thread Checker Rutinas Thread Safe Todas las rutinas llamadas concurrentemente de múltiples hilos deben ser thread safe ¿Cómo podemos probar thread safety? Use OpenMP y Thread Checker para el análisis Simulador de OpenMP es sistemático Use secciones para crear ejecución concurrente

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 32 Intel® Thread Checker Ejemplo Thread Safety Verificar problemas de seguridad entre Múltiples instancias de routine1() Instancias de routine1() y routine2() Establece secciones para probar todas las permutaciones Aun se requiere proveer conjuntos de datos para ejercitar porciones relevantes de código #pragma omp parallel sections { #pragma omp section routine1(&data1); #pragma omp section routine1(&data2); #pragma omp section routine2(&data3); }

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 33 Intel® Thread Checker Es mejor hacer una rutina reentrante que agregar sincronización Evita potencial sobrecarga Dos Formas de Asegurar Thread Safety Las rutinas pueden escribirse para ser reentrantes Cualquiera de las variables modificadas por la rutina deben ser locales cada vez que se invoquen No modificar variables globalmente compartidas Las rutinas pueden usar exclusión mutua para evitar conflictos con otros hilos Si no se puede evitar el acceso a variables compartidas ¿Qué sucede si librerías de terceros no son thread safe? Sería como necesitar controlar a los hilos en el acceso a la librería

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 34 Intel® Thread Checker Actividad 3 – Thread Safety Usar OpenMP para llamar funciones de librería concurrentemente Tres llamadas de librería = 6 combinaciones por probar A:A, B:B, C:C, A:B, A:C, B:C

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 35 Intel® Thread Checker Niveles de Instrumentación Nivel de Instrumenta cuón Descripción Full ImageCada instrucción en el módulo es instrumentada para comprobar si puede generar un mensaje de diagnóstico. Custom Image Igual que Full Image excepto que el usuario puede seleccionar funciones para deshabilitar de la instrumentación. All Functions Establece instrumentación completa para aquellas partes de un módulo que fueron compiladas con información de debug. Custom Functions Igual que All Functons excepto que el usuario puede seleccionar funciones para deshabilitar de la instrumentación. API Imports Solo funciones de la API del sistema que necesitan instrumentarse por la herramienta serán instrumentadas. El código de usuario no es instrumentado. Module Imports Deshabilita instrumentación. Este es el default en imágenes del sistema, imágenes sin relocalizaciónes base, e imágenes que no contienen información de debug. Niveles altos aumentan el uso de la memoria y tiempo de análisis, pero proveen más detalles La instrumentación binaria disminuye el nivel desde el default hasta el exitoso Manualmente ajusta el nivel de instrumentación para mejorar la velocidad o cantidad de información de control obtenida

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 36 Intel® Thread Checker Demasiados Diagnósticos ¿Qué hacer si se tienen 5000 diagnósticos? ¿Por dónde comenzamos a depurar? ¿Todos los mensajes de diagnóstico son igualmente importantes/serios? Sugerencias para organizar y priorizar Añade la columna de 1er Acceso Agrupar por 1er Acceso Ordenar por columna Descripción Corta

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 37 Intel® Thread Checker Demasiados Diagnósticos Añade la columna de 1 er Acceso si aún no está presente

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 38 Intel® Thread Checker Demasiados Diagnósticos

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 39 Intel® Thread Checker Demasiados Diagnósticos Agrupar errores reportados por la misma línea de código; cada grupo puede verse como el mismo problema

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 40 Intel® Thread Checker Demasiados Diagnósticos Ordenar por Descripción rápida

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 41 Intel® Thread Checker Intel® Thread Checker Lo Que se Cubrió Los errores de paralelización son fáciles de introducir Depurar esos errores por técnicas tradicionales es difícil Intel® Thread Checker encuentra esos errores Los errores no tienen que ocurrir para detectarse Gratamente reduce el tiempo de depuración Añade robustez en la aplicación

Copyright © 2006, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. 42 Intel® Thread Checker