5 research outputs found
OCLoptimizer: an iterative optimization tool for OpenCL
Abstract Nowadays, computers include several computational devices with parallel capacities, such as multicore processors and Graphic Processing Units (GPUs). OpenCL enables the programming of all these kinds of devices. An OpenCL program consists of a host code which discovers the computational devices available in the host system and it queues up commands to the devices, and the kernel code which defines the core of the parallel computation executed in the devices. This work addresses two of the most important problems faced by an OpenCL programmer: (1) hosts codes are quite verbose but they can be automatically generated if some parameters are known; (2) OpenCL codes that are hand-optimized for a given device do not get necessarily a good performance in a different one. This paper presents a source-to-source iterative optimization tool, called OCLoptimizer, that aims to generate host codes automatically and to optimize OpenCL kernels taking as inputs an annotated version of the original kernel and a configuration file. Iterative optimization is a well-known technique which allows to optimize a given code by exploring different configuration parameters in a systematic manner. For example, we can apply tiling on one loop and the iterative optimizer would select the optimal tile size by exploring the space of possible tile sizes. The experimental results show that the tool can automatically optimize a set of OpenCL kernels for multicore processors
An automatic optimizer for heterogeneous devices
Versión final aceptada de: https://doi.org/10.1016/j.future.2020.01.018This version of the article: Fernández-Fabeiro, J., Andrade, D., Fraguela, B. B., & Doallo, R. (2020). 'An automaticoptimizer for heterogeneous devices' has been accepted for publication in: Future Generation Computer Systems, 106, 572–584.
The Version of Record is available online at: https://doi.org/10.1016/j.future.2020.01.018 .[Abstract]: Codes written in a naive way seldom effectively exploit the computing resources, while writing optimized codes is usually a complex task that requires certain levels of expertise. This problem is further increased in the presence of heterogeneous devices, which present more tunable parameters than regular CPUs and high sensitivity to the optimization decisions taken. Furthermore, portability is an added concern given the wide variety of accelerators available. This paper tackles this problem adding an automatic optimizer to a library that already provides an easy and portable way to program heterogeneous devices, the Heterogeneous Programming Library (HPL). Our optimizer takes as input a simple version of a code and then tunes it for the device where it is going to be executed by performing the most usual set of optimizations applicable in heterogeneous devices. These optimizations are parametrized using a set of optimization parameters that need to be tuned for the device. The HPL library has also been equipped with an autotuner that can be used to this purpose. The effectiveness of the autotuner and the optimizer has been tested on several codes and devices. The results show that the combination of the autotuner and the optimizer make the tested codes 16 times faster on average than the original codes written by the programmer.This research was supported by the Ministry of Economy and Competitiveness of Spain and FEDER funds (80%) of the EU (TIN2016-75845-P), and by the Government of Galicia (Xunta de Galicia, Spain) co-founded by the European Regional Development Fund (ERDF) under the Consolidation Programme of Competitive Reference Groups (ED431C 2017/04) as well as under Xunta de Galicia and FEDER funds of the EU (Centro de Investigación de Galicia accreditation 2019–2022, ref. ED431G2019/01)Xunta de Galicia; ED431C 2017/04Xunta de Galicia; ED431G2019/0
Tools for improving performance portability in heterogeneous environments
Programa Oficial de Doutoramento en Investigación en TecnoloxÃas da Información. 524V01[Abstract]
Parallel computing is currently partially dominated by the availability of heterogeneous
devices. These devices differ from each other in aspects such as the
instruction set they execute, the number and the type of computing devices that
they offer or the structure of their memory systems. In the last years, langnages,
libraries and extensions have appeared to allow to write a parallel code once aud
run it in a wide variety of devices, OpenCL being the most widespread solution of
this kind. However, functional portability does not imply performance portability.
This way, one of the probletns that is still open in this field is to achieve automatic
performance portability. That is, the ability to automatically tune a given code for
any device where it will be execnted so that it ill obtain a good performance. This
thesis develops three different solutions to tackle this problem. The three of them
are based on typical source-to-sonrce optimizations for heterogeneous devices. Both
the set of optimizations to apply and the way they are applied depend on different
optimization parameters, whose values have to be tuned for each specific device.
The first solution is OCLoptimizer, a source-to-source optimizer that can optimize
annotated OpenCL kemels with the help of configuration files that guide the
optimization process. The tool optimizes kernels for a specific device, and it is also
able to automate the generation of functional host codes when only a single kernel
is optimized.
The two remaining solutions are built on top of the Heterogeneous Programming
Library (HPL), a C++ framework that provides an easy and portable way to exploit
heterogeneous computing systexns. The first of these solutions uses the run-time
code generation capabilities of HPL to generate a self-optimizing version of a matrix
multiplication that can optimize itself at run-time for an spedfic device. The last solutÃon is the development of a built-in just-in-time optirnizer for HPL, that can
optirnize, at run-tirne, a HPL code for an specific device. While the first two solutions
use search processes to find the best values for the optimization parameters, this Iast
alternative relies on heuristics bMed on general optirnization strategies.[Resumen]
Actualmente la computación paralela se encuentra dominada parcialmente por
los múltiples dispositivos heterogéneos disponibles. Estos dispositivos difieren entre
sà en caracterÃsticas tales como el conjunto de instrucciones que ejecutan, el número
y tipo de unidades de computación que incluyen o la estructura de sus sistemas de
memoria. Durante los últimos años han aparecido lenguajes, librerÃas y extensiones
que permiten escribir una única vez la versión paralela de un código y ejecutarla en
un amplio abanico de dispositivos, siendo de entre todos ellos OpenCL la solución
más extendida. Sin embargo, la portabilidad funcional no implica portabilidad de
rendimiento. AsÃ, uno de los grandes problemas que sigue abierto en este campo
es la automatización de la portabilidad de rendimiento, es decir, la capacidad de
adaptar automáticamente un código dado para su ejecución en cualquier dispositivo
y obtener un buen rendimiento. Esta tesis aborda este problema planteando tres
soluciones diferentes al mismo. Las tres se basan en la aplicación de optimizaciones
de código a código usadas habitualmente en dispositivos heterogéneos. Tanto el
conjunto de optimizaciones a aplicar como la forma de aplicarlas dependen de varios
parámetros de optimización, cuyos valores han de ser ajustados para cada dispositivo
concreto.
La primera solución planteada es OCLoptirnizer, un optimizador de código a
código que a partir de kernels OpenCL anotados y ficheros de configuración como
apoyo, obtiene versiones optimizada de dichos kernels para un dispositivo concreto.
Además, cuando el kernel a optimizar es único, automatiza la generación de un
código de host funcional para ese kernel.
Las otras dos soluciones han sido implementadas utilizando Heterogeneous Prograrnming
LibranJ (HPL), una librerÃa C++ que permite programar sistemas heterogéneos de forma fácil y portable. La primera de estas soluciones explota las
capacidades de generación de código en tiempo de ejecución de HPL para generar
versiones de un producto de matrices que se adaptan automáticamente en tiempo
de ejecución a las caracterÃsticas de un dispositivo concreto. La última solución consiste
en el desarrollo e incorporación a HPL de un optimizador al vuelo, de fonna
que se puedan obtener en tiempo de ejecución versiones optimizadas de un código
HPL para un dispositivo dado. Mientras las dos primeras soluciones usan procesos
de búsqueda para encontrar los mejores valores para los parámetros de optimización,
esta última altemativa se basa para ello en heurÃsticas definidas a partir de
recomendaciones generales de optimización.[Resumo]
Actualmente a computación paralela atópase dominada parcialmente polos múltiples
dispositivos heteroxéneos dispoñibles. Estes dispositivos difiren entre si en caracterÃsticas
tales como o conxunto de instruccións que executan, o número e tipo
de unidades de computación que inclúen ou a estrutura dos seus sistemas de mem~
rÃa. Nos últimos anos apareceron linguaxes, bibliotecas e extensións que permiten
escribir unha soa vez a versión paralela dun código e executala nun amplio abano de
dispositivos, senda de entre todos eles OpenCL a solución máis extendida. Porén, a
portabilidade funcional non implica portabilidade de rendemento. Deste xeito, uns
dos grandes problemas que segue aberto neste campo é a automatización da portabilidade
de rendemento, isto é, a capacidade de adaptar automaticamente un código
dado para a súa execución en calquera dispositivo e obter un bo rendemento. Esta
tese aborda este problema propondo tres solucións diferentes. As tres están baseadas
na aplicación de optimizacións de código a código usadas habitualmente en disp~
sitivos heteroxéneos. Tanto o conxunto de optimizacións a aplicar como a forma de
aplicalas dependen de varios parámetros de optimización para os que é preciso fixar
determinados valores en función do dispositivo concreto.
A primeira solución pro posta é OCLoptirnizer, un optimizador de código a código
que partindo de kemels OpenCL anotados e ficheiros de configuración de apoio,
obtén versións optimizadas dos devanditos kernels para un dispositivo concreto.
Amais, cando o kernel a optimizaré único, tarnén automatiza a xeración dun código
de host funcional para ese kernel.
As outras dúas solucións foron implementadas utilizando Heterogeneous Programming
Library (HPL), unha biblioteca C++ que permite programar sistemas
heteroxéneos de xeito fácil e portable. A primeira destas solucións explota as capacidades de xeración de código en tempo de execución de HPL para xerar versións
dun produto de matrices que se adaptan automaticamente ás caracterÃsticas dun
dispositivo concreto. A última solución consiste no deseuvolvemento e incorporación
a HPL dun optimizador capaz de obter en tiempo de execución versións optimizada<;
dun código HPL para un dispositivo dado. Mentres as dúas primeiras solucións usan
procesos de procura para atopar os mellares valores para os parámetros de optimización,
esta última alternativa baséase para iso en heurÃsticas definidas a partir de
recomendacións xerais de optimización
Improving the programmability of heterogeneous systems by means of libraries
Programa Oficial de Doutoramento en Investigación en TecnoloxÃas da Información. 524V01[Resumo]
O emprego de dispositivos heteroxéneos coma co-procesadores en entornos de
computación de altas prestacións (HPC) medrou ininterrompidamente nos últimos
anos debido ás súas excelentes propiedades en termos de rendemento e consumo de
enerx:Ãa. A ma.ior dispoñibilidade de sistemas HPC hÃbridos conlevou de forma natural
a necesidade de desenrolar ferra.mentas de programación adecuadas para eles,
sendo CUDA e OpenCL as máis a.mplamente empregadas na actualidade. Desafortunadamente,
estas ferramentas son relativamente de baixo nivel, o cal emparellado co
ma.ior número de detalles que deben de ser controlados cando se programan aceleradoras,
fa.i da programación destes sistemas mediante elas, moito roáis complexa que a.
programación tradicional de CPUs. Isto levou á. proposta de alternativas de roáis alto
nivel para facilitar a programación de dispositivos heteroxéneos. Esta tesis contribúe
neste campo presentando dúas librerÃe.<i que mellora.n ampla.mente a programabilidade
de sistemas heteroxéneos en C++, permitindo aos usuarios centrarse no que hai
que facer en vez de nas tarefas de baixo nivel. As nosas propostas, a librerÃa. Heterogeneous
Progromming Libmry (HPL) e a. librerÃa Heterogene.ous Hiemrchically Tiled
Arrays (H2TA), están deseñadas para nodos con unha ou má.is aceleradoras, e para
clusters heteroxéneos, respectivamente. Ambas librerÃas, demostraron ser capaces de
incrementar a. productividade dos usuarios mellora.ndo a programabilidade dos sem;
códigos, e ó mesmo tempo, lograr un rendemento semella.nte ó de solucións de roáis
baixo nivel.[Abstract]
The usage of heterogeneous devices as co-processors in high performance computing
(HPC) environments has steadily grown during the last years due to their
excellent properties in terms of perfonnance and energy consumption. The larger
a.vailability of hybrid HPC systems naturally led to the need to develop suitable
programming tools for them, being the most widely tL'ied nowadays CUDA and
OpenCL. Unfortlmatciy, these tools are relativcly low leve), which coupled with the
large DUlllber of deta.ils that must be monaged when programming accelerators, makes
the programm.ing of these systems using them much more complex thon that
of trad.itional CPUs. This has led to the proposal of higher leve) alternatives that
facilitate the progranuning of heterogeneous devices. This thesis contri bu tes to this
field presenting two libraries that largely improve the programma.bility of heterogeneous
systeins in C++, helping users to focus on what todo rather thtlJl onlow leve)
tasks. These two libraries, the Heterogeneous Programming Library (HPL) and the
Heterogeneous Hierarch.ically Tiled Arrays (H2TA), are well suited to nodes with
one or more accelerators, a.nd to heterogeneous clusters, respectively. Both libraries
have proveo to be able to incresse the productivity of the users improving the progro.
mmability of their codes, and at the s8llle time, achieving performance similar
to that of lower leve) solutions.[Resumen]
El empleo de dispositivos heterogéneos como co-procesadores en entornos de
computación de altas prestaciones (HPC) ha. crecido ininterrumpidamente durante
los últimos años debido a. sus excelentes propiedades en términos de rendimiento y
consumo de energÃa. La mayor disponibilidad de sistemas HPC hÃbridos conllevó de
forma natural la necesidad de desarrollar herramientas de programación adecuadas
para. ellos, siendo CUDA y OpenCL las más ampliamente utilizadas en la actualidad.
Desafortunadamente, estas herramientas son relativamente de bajo nivel, lo cual
emparejado con el mayor número de detalles que han de ser controlados cuando se
programan aceleradoras, hacen de la programación de estos sistemas mediante ell8S
mucho más compleja que la programación tradicional de CPUs. Esto ha llevado a la
propuesta de alternativ8S de más alto nivel para facilitar la programación de dispositivos
heterogéneos. Esta tesis contribuye a este campo presentando dos librerÃas que
mejoran ampliamente la programabilidad de sistemas heterogéneos en C++, permitiendo
a los usuarios centrarse en lo que hay que hacer en vez de en las tareas de bajo
nivel. Nuestras propuestas, la librerÃa Heterogeneous Progromming Librory (HPL) y
la librerÃa Heterogeneous HierorchÃoolly TÃled Arrays (H2TA), están diseñadas para
nodos con una o más aceleradoras, y para clusters heterogéneos, respectivamente.
Ambas librerÃas, han demostrado ser capaces de incrementar la productividad de los
usuarios mejorando la programabilidad de sus códigos, y al mismo tiempo, lograr
un rendimiento similar al de soluciones de más bajo nivel
Machine Learning Based Auto-tuning for Enhanced OpenCL Performance Portability
Heterogeneous computing, which combines devices with different architectures,
is rising in popularity, and promises increased performance combined with
reduced energy consumption. OpenCL has been proposed as a standard for
programing such systems, and offers functional portability. It does, however,
suffer from poor performance portability, code tuned for one device must be
re-tuned to achieve good performance on another device. In this paper, we use
machine learning-based auto-tuning to address this problem. Benchmarks are run
on a random subset of the entire tuning parameter configuration space, and the
results are used to build an artificial neural network based model. The model
can then be used to find interesting parts of the parameter space for further
search. We evaluate our method with different benchmarks, on several devices,
including an Intel i7 3770 CPU, an Nvidia K40 GPU and an AMD Radeon HD 7970
GPU. Our model achieves a mean relative error as low as 6.1%, and is able to
find configurations as little as 1.3% worse than the global minimum.Comment: This is a pre-print version an article to be published in the
Proceedings of the 2015 IEEE International Parallel and Distributed
Processing Symposium Workshops (IPDPSW). For personal use onl