<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Application Adaptation at Runtime through Dynamic Knobs Autotuning</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Davide Gadioli</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Gianluca Palermo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Cristina Silvano</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Politecnico di Milano - Dipartimento di Elettronica</institution>
          ,
          <addr-line>Informazione e Bioigegneria</addr-line>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2016</year>
      </pub-date>
      <abstract>
        <p>Several classes of applications expose a set of parameters that in uence their extra-functional properties, such as the quality of the result or the size of the output. This leads the application designer to tune these parameters in order to nd the con guration that produces the desired outcome. From the architectural point of view, the trend in modern systems is to expose an high level of parallelism, often involving heterogeneous resources. To exploit the full potential of the hardware, the application designer must take into account resource-related parameters in the tuning process as well. Since the requirements of the applications and the resources assigned to each application might change at runtime, we argue that nding a one- t-all con guration is not a trivial operation. For this reason we use a framework that enhances an application with an adaptation layer in order to continuously tune the parameters of the application according to the evolving situation, in a best e ort fashion.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>One of the main tasks of an application designer is to reach the required
performance on the target system. Unfortunately, the performance of an application
is seldom de ned by one metric, such as the execution time or its throughput.
The performance is instead composed by a collection of metrics that are usually
in contrast between them; for instance the time spent on elaborating the input
against the quality of the result or the power consumption.</p>
      <p>
        A common approach is to write an algorithm that exposes a set of parameters,
also known as dynamic knobs [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] in literature, that in uence the performance
of the application, such as the number of trials in a Monte Carlo solver or
the resolution of the output frame in a video encoder. The possible values of
these parameters de ne the design space of the application and in literature are
described several Design Space Exploration (DSE) techniques[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] that are able
to automatically and e ciently compute the Pareto set, which represent all the
optimal trade-o between the metrics of interest.
      </p>
      <p>Since the application requirements may change at runtime { for instance if
the platform is at rst powered by a battery, then plugged in a power supply {
and the system might vary the resources allocated to the application as well, we
argue that is not trivial to select a priori one- t-all con guration.</p>
      <p>
        For this reason we rely on the argo1 framework[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]: it is grounded on the
Monitor-Analyze-Plan-Execute (MAPE) feedback loop[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] and it is able to
automatically tune the application parameters according to the evolution of the
system.
      </p>
      <p>The main idea of the framework is to exploit design time knowledge of the
application, obtained through a DSE, to select the best con guration according
to the actual application requirements and the observed performance, both of
them composed by a collection of metrics of interest.</p>
      <p>argo is implemented as an external library to be linked against the target
application. It takes autonomous decision without interacting with any other
element. For these reasons we are able to minimize the intrusiveness of the
integration, expressed in terms of lines of code to be changed.</p>
      <sec id="sec-1-1">
        <title>Execution environment</title>
      </sec>
      <sec id="sec-1-2">
        <title>Application</title>
      </sec>
      <sec id="sec-1-3">
        <title>Monitors</title>
      </sec>
      <sec id="sec-1-4">
        <title>Elaboration</title>
      </sec>
      <sec id="sec-1-5">
        <title>Goals</title>
        <p>AS-RTM
Static
Goals</p>
      </sec>
      <sec id="sec-1-6">
        <title>Knowledge</title>
        <p>
          1 The name argo, has been borrowed by Greek mythology. argo was the ship on
which Jason and the Argonauts sailed to retrieve the Golden Fleece. As that boat was
a means for achieving the Golden Fleece (their goal): it aims at letting applications
to reach their goals too.
cation (Monitor element). argoships with a monitor suite to observe the most
common metrics:
{ The elapsed time or the application throughput.
{ The resident set size of the virtual memory that the process is using.
{ The process- and system-wide CPU usage.
{ Low-level metrics exposed by the widely adopted PAPI framework[
          <xref ref-type="bibr" rid="ref6">6</xref>
          ].
        </p>
        <p>Moreover, to observe application-speci c metrics, such as the quality-related
ones, the object-oriented implementation enable the application designer to
easily integrate a custom monitor, de ning the methods that actually gather the
new data.</p>
        <p>
          On the other side, argoembeds the design time knowledge in the list of
Operating Points (OPs), where each OP represents a con guration and the
performance reached by the application using that con guration. The framework
is agnostic about the technique used to perform the DSE, in the current
implementation it parses the MULTICUBE[
          <xref ref-type="bibr" rid="ref5">5</xref>
          ] syntax.
        </p>
        <p>The Application-Speci c RunTime Manager is the main component of the
framework that selects the best con guration (Plan element), within the list of
OPs, according to a multi-objective constrained optimization that might involve
observed metrics (using Goals) or design time computed metrics (using Static
Goals).</p>
        <p>Since the dynamic knobs are heavily application-dependent, is the application
itself that is in charge to apply the con guration selected by argo(Execute
element), closing the MAPE loop. In this way it is possible to deploy the framework
in a wide range of applications, while minimizing the integration e ort. In fact,
we model the application as a sequence of di erent blocks of code that perform
the elaboration iteratively. The idea is that at the beginning of each iteration,
the application retrieves the con guration to use in the current iteration.
3</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>Framework integration</title>
      <p>To employ separation of concerns, our work ow is based on three kind of les.
The source code of the application describes the functional behavior, while we
use two con guration les written in XML to express the adaptation layer: one
le describes the design time knowledge and the third one describes the monitor
infrastructure and the multi-objective optimization. argouses a tool that
automatically generates the glue-code required to integrate the framework in the
target application.</p>
      <p>To better clarify the required e ort, Figure 2 provides an integration example
considering a toy application. It shows the original source code written in black,
while the integration code required to adopt argo is written in bold red. The
application itself is very simple: on lines 9-16 the elaboration block, named \foo",
performs the loop over the available jobs, while the function do job (line 14)
actually performs the computation.
1 #include ``argo.hpp''
2
3 int p a r a m ;</p>
      <p>argo :: init () ;</p>
      <p>In this example, we suppose that the elaboration is in uenced by the
parameter param, expressing the amount of processed data and representing the
software knobs of the application. Since the code of toy application expose
directly the elaboration loop, the integration requires only to include the created
header le, initialize the framework and then wrap the execution call with the
generated macro, highlighted in bold red. In this way the framework is able to
observe and tune the elaboration block. Since no assumptions are made on the
structure of the application code, the tool generates a hierarchy of methods to
interact with the application, that requires to write the glue-code using more ne
grained functions. In the worst case, the application designer is able to directly
use the framework API.
4</p>
    </sec>
    <sec id="sec-3">
      <title>Conclusion</title>
      <p>In this work we have described a framework that enhances an application with
an adaptation layer. In particular it adapts the knowledge base obtained at
design time with the information gathered by the monitor infrastructure. Using
this information, argo selects the best con guration according to the actual
requirement of the application.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>D.</given-names>
            <surname>Gadioli</surname>
          </string-name>
          , G. Palermo, and
          <string-name>
            <given-names>C.</given-names>
            <surname>Silvano</surname>
          </string-name>
          .
          <article-title>Application autotuning to support runtime adaptivity in multicore architectures</article-title>
          . In Embedded Computer Systems: Architectures, Modeling, and
          <string-name>
            <surname>Simulation</surname>
          </string-name>
          (SAMOS), 2015 International Conference on, pages
          <volume>173</volume>
          {
          <fpage>180</fpage>
          . IEEE,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2. H. Ho mann, S. Sidiroglou,
          <string-name>
            <given-names>M.</given-names>
            <surname>Carbin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Misailovic</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Agarwal</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Rinard</surname>
          </string-name>
          .
          <article-title>Dynamic knobs for responsive power-aware computing</article-title>
          .
          <source>In ACM SIGPLAN Notices</source>
          , volume
          <volume>46</volume>
          , pages
          <fpage>199</fpage>
          {
          <fpage>212</fpage>
          . ACM,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>J. O.</given-names>
            <surname>Kephart</surname>
          </string-name>
          and
          <string-name>
            <given-names>D. M.</given-names>
            <surname>Chess</surname>
          </string-name>
          .
          <article-title>The vision of autonomic computing</article-title>
          .
          <source>Computer</source>
          ,
          <volume>36</volume>
          (
          <issue>1</issue>
          ):
          <volume>41</volume>
          {
          <fpage>50</fpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>G.</given-names>
            <surname>Palermo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Silvano</surname>
          </string-name>
          , and
          <string-name>
            <given-names>V.</given-names>
            <surname>Zaccaria</surname>
          </string-name>
          .
          <article-title>Respir: a response surface-based pareto iterative re nement for application-speci c design space exploration</article-title>
          .
          <source>Computer-Aided Design of Integrated Circuits and Systems</source>
          , IEEE Transactions on,
          <volume>28</volume>
          (
          <issue>12</issue>
          ):
          <year>1816</year>
          {
          <year>1829</year>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>C.</given-names>
            <surname>Silvano</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Fornaciari</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Palermo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Zaccaria</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Castro</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Martinez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Bocchio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Zafalon</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Avasare</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Vanmeerbeeck</surname>
          </string-name>
          , et al.
          <article-title>Multicube: Multi-objective design space exploration of multi-core architectures</article-title>
          .
          <source>In VLSI 2010 Annual Symposium</source>
          , pages
          <volume>47</volume>
          {
          <fpage>63</fpage>
          . Springer,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>V. M.</given-names>
            <surname>Weaver</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Terpstra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>McCraw</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Johnson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Kasichayanula</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Ralph</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Nelson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Mucci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Mohan</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S.</given-names>
            <surname>Moore</surname>
          </string-name>
          .
          <article-title>Papi 5: Measuring power, energy, and the cloud</article-title>
          .
          <source>In Performance Analysis of Systems and Software (ISPASS)</source>
          ,
          <source>2013 IEEE International Symposium on</source>
          , pages
          <volume>124</volume>
          {
          <fpage>125</fpage>
          . IEEE,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>